@open-mercato/core 0.6.6-develop.6551.1.1511bfa890 → 0.6.6

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 (304) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/dist/generated/entities.ids.generated.js +0 -1
  3. package/dist/generated/entities.ids.generated.js.map +2 -2
  4. package/dist/generated/entity-fields-registry.js +0 -12
  5. package/dist/generated/entity-fields-registry.js.map +2 -2
  6. package/dist/modules/api_keys/api/keys/route.js +13 -30
  7. package/dist/modules/api_keys/api/keys/route.js.map +2 -2
  8. package/dist/modules/api_keys/cli.js +1 -2
  9. package/dist/modules/api_keys/cli.js.map +2 -2
  10. package/dist/modules/attachments/api/file/[id]/route.js +7 -9
  11. package/dist/modules/attachments/api/file/[id]/route.js.map +2 -2
  12. package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +7 -9
  13. package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
  14. package/dist/modules/attachments/api/route.js +17 -21
  15. package/dist/modules/attachments/api/route.js.map +2 -2
  16. package/dist/modules/attachments/components/AttachmentContentPreview.js +35 -6
  17. package/dist/modules/attachments/components/AttachmentContentPreview.js.map +2 -2
  18. package/dist/modules/audit_logs/backend/audit-logs/page.js +24 -14
  19. package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
  20. package/dist/modules/auth/api/users/route.js +2 -6
  21. package/dist/modules/auth/api/users/route.js.map +2 -2
  22. package/dist/modules/auth/cli.js +2 -3
  23. package/dist/modules/auth/cli.js.map +2 -2
  24. package/dist/modules/configs/lib/upgrade-actions.js +0 -22
  25. package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
  26. package/dist/modules/customer_accounts/api/admin/roles/[id]/acl.js +0 -1
  27. package/dist/modules/customer_accounts/api/admin/roles/[id]/acl.js.map +2 -2
  28. package/dist/modules/customer_accounts/api/admin/roles/[id].js +3 -17
  29. package/dist/modules/customer_accounts/api/admin/roles/[id].js.map +2 -2
  30. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js +1 -6
  31. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js.map +2 -2
  32. package/dist/modules/customer_accounts/api/portal/users-invite.js +1 -6
  33. package/dist/modules/customer_accounts/api/portal/users-invite.js.map +2 -2
  34. package/dist/modules/customer_accounts/services/customerInvitationService.js +0 -1
  35. package/dist/modules/customer_accounts/services/customerInvitationService.js.map +2 -2
  36. package/dist/modules/customer_accounts/services/customerRbacService.js +1 -6
  37. package/dist/modules/customer_accounts/services/customerRbacService.js.map +2 -2
  38. package/dist/modules/customer_accounts/widgets/injection-table.js +2 -0
  39. package/dist/modules/customer_accounts/widgets/injection-table.js.map +2 -2
  40. package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +1 -7
  41. package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
  42. package/dist/modules/customers/backend/customers/deals/pipeline/components/ViewTabsRow.js +2 -2
  43. package/dist/modules/customers/backend/customers/deals/pipeline/components/ViewTabsRow.js.map +2 -2
  44. package/dist/modules/customers/components/detail/CompanyDetailTabs.js +43 -37
  45. package/dist/modules/customers/components/detail/CompanyDetailTabs.js.map +2 -2
  46. package/dist/modules/customers/components/detail/DealDetailTabs.js +35 -23
  47. package/dist/modules/customers/components/detail/DealDetailTabs.js.map +2 -2
  48. package/dist/modules/customers/components/detail/DetailTabsLayout.js +21 -6
  49. package/dist/modules/customers/components/detail/DetailTabsLayout.js.map +2 -2
  50. package/dist/modules/customers/components/detail/MobilePersonDetail.js +32 -26
  51. package/dist/modules/customers/components/detail/MobilePersonDetail.js.map +2 -2
  52. package/dist/modules/customers/components/detail/PersonDetailTabs.js +39 -29
  53. package/dist/modules/customers/components/detail/PersonDetailTabs.js.map +2 -2
  54. package/dist/modules/dashboards/api/roles/widgets/route.js +3 -22
  55. package/dist/modules/dashboards/api/roles/widgets/route.js.map +2 -2
  56. package/dist/modules/dashboards/api/users/widgets/route.js +3 -22
  57. package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
  58. package/dist/modules/dashboards/cli.js +3 -4
  59. package/dist/modules/dashboards/cli.js.map +2 -2
  60. package/dist/modules/dashboards/lib/widgetAssignmentScope.js +1 -9
  61. package/dist/modules/dashboards/lib/widgetAssignmentScope.js.map +2 -2
  62. package/dist/modules/dictionaries/commands/entries.js +14 -7
  63. package/dist/modules/dictionaries/commands/entries.js.map +2 -2
  64. package/dist/modules/dictionaries/commands/entry-operations.js +16 -7
  65. package/dist/modules/dictionaries/commands/entry-operations.js.map +2 -2
  66. package/dist/modules/dictionaries/commands/factory.js +3 -9
  67. package/dist/modules/dictionaries/commands/factory.js.map +2 -2
  68. package/dist/modules/dictionaries/fields/dictionary.js +41 -56
  69. package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
  70. package/dist/modules/directory/utils/organizationScope.js +3 -10
  71. package/dist/modules/directory/utils/organizationScope.js.map +2 -2
  72. package/dist/modules/entities/api/records.js +4 -5
  73. package/dist/modules/entities/api/records.js.map +2 -2
  74. package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js +0 -1
  75. package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js.map +2 -2
  76. package/dist/modules/entities/backend/entities/user/[entityId]/page.js +49 -49
  77. package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
  78. package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js +0 -1
  79. package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js.map +2 -2
  80. package/dist/modules/entities/cli.js +1 -2
  81. package/dist/modules/entities/cli.js.map +2 -2
  82. package/dist/modules/feature_toggles/api/check/boolean/route.js +14 -0
  83. package/dist/modules/feature_toggles/api/check/boolean/route.js.map +2 -2
  84. package/dist/modules/feature_toggles/defaults.json +0 -8
  85. package/dist/modules/integrations/backend/integrations/[id]/page.js +80 -9
  86. package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
  87. package/dist/modules/payment_gateways/data/entities.js +0 -45
  88. package/dist/modules/payment_gateways/data/entities.js.map +2 -2
  89. package/dist/modules/payment_gateways/lib/gateway-service.js +38 -173
  90. package/dist/modules/payment_gateways/lib/gateway-service.js.map +3 -3
  91. package/dist/modules/planner/backend/planner/availability-rulesets/[id]/page.js +14 -16
  92. package/dist/modules/planner/backend/planner/availability-rulesets/[id]/page.js.map +2 -2
  93. package/dist/modules/planner/components/AvailabilityRulesEditor.js +30 -18
  94. package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
  95. package/dist/modules/query_index/api/status.js +8 -2
  96. package/dist/modules/query_index/api/status.js.map +2 -2
  97. package/dist/modules/resources/backend/resources/resources/[id]/page.js +24 -24
  98. package/dist/modules/resources/backend/resources/resources/[id]/page.js.map +2 -2
  99. package/dist/modules/sales/backend/sales/channels/create/page.js +0 -6
  100. package/dist/modules/sales/backend/sales/channels/create/page.js.map +2 -2
  101. package/dist/modules/sales/backend/sales/channels/create/page.meta.js +0 -2
  102. package/dist/modules/sales/backend/sales/channels/create/page.meta.js.map +2 -2
  103. package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -6
  104. package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
  105. package/dist/modules/sales/backend/sales/channels/offers/page.meta.js +0 -2
  106. package/dist/modules/sales/backend/sales/channels/offers/page.meta.js.map +2 -2
  107. package/dist/modules/sales/backend/sales/channels/page.js +0 -6
  108. package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
  109. package/dist/modules/sales/backend/sales/channels/page.meta.js +0 -2
  110. package/dist/modules/sales/backend/sales/channels/page.meta.js.map +2 -2
  111. package/dist/modules/sales/backend/sales/documents/[id]/page.js +4 -6
  112. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  113. package/dist/modules/sales/commands/documents.js +0 -44
  114. package/dist/modules/sales/commands/documents.js.map +2 -2
  115. package/dist/modules/sales/commands/returns.js +27 -2
  116. package/dist/modules/sales/commands/returns.js.map +2 -2
  117. package/dist/modules/sales/components/documents/AddressesSection.js +2 -6
  118. package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
  119. package/dist/modules/sales/components/documents/ItemsSection.js +0 -1
  120. package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
  121. package/dist/modules/sales/components/documents/LineItemDialog.js +0 -9
  122. package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
  123. package/dist/modules/sales/components/documents/SalesDocumentForm.js +3 -51
  124. package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
  125. package/dist/modules/sales/components/documents/SalesDocumentsTable.js +8 -10
  126. package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
  127. package/dist/modules/sales/components/documents/ShipmentDialog.js +38 -59
  128. package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
  129. package/dist/modules/sales/lib/shipments/snapshots.js +1 -27
  130. package/dist/modules/sales/lib/shipments/snapshots.js.map +2 -2
  131. package/dist/modules/staff/backend/staff/team-members/[id]/page.js +25 -22
  132. package/dist/modules/staff/backend/staff/team-members/[id]/page.js.map +2 -2
  133. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +14 -12
  134. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  135. package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js +29 -10
  136. package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js.map +2 -2
  137. package/dist/modules/sync_excel/lib/adapters/customers.js +20 -19
  138. package/dist/modules/sync_excel/lib/adapters/customers.js.map +2 -2
  139. package/dist/modules/sync_excel/lib/parser.js +0 -185
  140. package/dist/modules/sync_excel/lib/parser.js.map +2 -2
  141. package/dist/modules/sync_excel/lib/upload-storage.js +1 -20
  142. package/dist/modules/sync_excel/lib/upload-storage.js.map +2 -2
  143. package/dist/modules/workflows/frontend/checkout-demo/page.js +8 -1
  144. package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
  145. package/dist/modules/workflows/lib/activity-executor.js +1 -1
  146. package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
  147. package/dist/modules/workflows/lib/find-definition.js +18 -2
  148. package/dist/modules/workflows/lib/find-definition.js.map +2 -2
  149. package/dist/modules/workflows/lib/signal-handler.js +3 -2
  150. package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
  151. package/dist/modules/workflows/lib/step-handler.js +4 -8
  152. package/dist/modules/workflows/lib/step-handler.js.map +2 -2
  153. package/dist/modules/workflows/lib/task-handler.js +3 -5
  154. package/dist/modules/workflows/lib/task-handler.js.map +2 -2
  155. package/dist/modules/workflows/lib/timer-handler.js +2 -1
  156. package/dist/modules/workflows/lib/timer-handler.js.map +2 -2
  157. package/dist/modules/workflows/lib/transition-handler.js +5 -13
  158. package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
  159. package/dist/modules/workflows/lib/workflow-executor.js +11 -9
  160. package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
  161. package/dist/modules/workflows/migrations/Migration20260715120000.js +68 -0
  162. package/dist/modules/workflows/migrations/Migration20260715120000.js.map +7 -0
  163. package/dist/modules/workflows/migrations/Migration20260716120000.js +24 -0
  164. package/dist/modules/workflows/migrations/Migration20260716120000.js.map +7 -0
  165. package/dist/modules/workflows/workflows.js +2 -0
  166. package/dist/modules/workflows/workflows.js.map +2 -2
  167. package/generated/entities.ids.generated.ts +0 -1
  168. package/generated/entity-fields-registry.ts +0 -12
  169. package/package.json +8 -9
  170. package/src/modules/api_keys/api/keys/route.ts +13 -36
  171. package/src/modules/api_keys/cli.ts +3 -2
  172. package/src/modules/attachments/api/file/[id]/route.ts +7 -11
  173. package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +7 -11
  174. package/src/modules/attachments/api/route.ts +21 -26
  175. package/src/modules/attachments/components/AttachmentContentPreview.tsx +44 -9
  176. package/src/modules/audit_logs/backend/audit-logs/page.tsx +22 -12
  177. package/src/modules/auth/api/users/route.ts +2 -11
  178. package/src/modules/auth/cli.ts +2 -3
  179. package/src/modules/configs/i18n/de.json +1 -5
  180. package/src/modules/configs/i18n/en.json +1 -5
  181. package/src/modules/configs/i18n/es.json +1 -5
  182. package/src/modules/configs/i18n/pl.json +1 -5
  183. package/src/modules/configs/lib/upgrade-actions.ts +0 -24
  184. package/src/modules/customer_accounts/AGENTS.md +6 -8
  185. package/src/modules/customer_accounts/api/admin/roles/[id]/acl.ts +0 -1
  186. package/src/modules/customer_accounts/api/admin/roles/[id].ts +3 -17
  187. package/src/modules/customer_accounts/api/portal/users/[id]/roles.ts +1 -6
  188. package/src/modules/customer_accounts/api/portal/users-invite.ts +1 -6
  189. package/src/modules/customer_accounts/services/customerInvitationService.ts +0 -1
  190. package/src/modules/customer_accounts/services/customerRbacService.ts +2 -9
  191. package/src/modules/customer_accounts/widgets/injection-table.ts +2 -0
  192. package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +1 -11
  193. package/src/modules/customers/backend/customers/deals/pipeline/components/ViewTabsRow.tsx +2 -6
  194. package/src/modules/customers/components/detail/CompanyDetailTabs.tsx +55 -39
  195. package/src/modules/customers/components/detail/DealDetailTabs.tsx +49 -24
  196. package/src/modules/customers/components/detail/DetailTabsLayout.tsx +24 -13
  197. package/src/modules/customers/components/detail/MobilePersonDetail.tsx +31 -25
  198. package/src/modules/customers/components/detail/PersonDetailTabs.tsx +50 -29
  199. package/src/modules/dashboards/api/roles/widgets/route.ts +3 -22
  200. package/src/modules/dashboards/api/users/widgets/route.ts +3 -22
  201. package/src/modules/dashboards/cli.ts +9 -4
  202. package/src/modules/dashboards/lib/widgetAssignmentScope.ts +0 -18
  203. package/src/modules/dictionaries/commands/entries.ts +16 -7
  204. package/src/modules/dictionaries/commands/entry-operations.ts +18 -8
  205. package/src/modules/dictionaries/commands/factory.ts +2 -8
  206. package/src/modules/dictionaries/fields/dictionary.tsx +32 -55
  207. package/src/modules/dictionaries/i18n/de.json +0 -2
  208. package/src/modules/dictionaries/i18n/en.json +0 -2
  209. package/src/modules/dictionaries/i18n/es.json +0 -2
  210. package/src/modules/dictionaries/i18n/pl.json +0 -2
  211. package/src/modules/directory/utils/organizationScope.ts +2 -36
  212. package/src/modules/entities/api/records.ts +7 -5
  213. package/src/modules/entities/backend/entities/system/[entityId]/page.meta.ts +0 -1
  214. package/src/modules/entities/backend/entities/user/[entityId]/page.meta.ts +0 -1
  215. package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +49 -51
  216. package/src/modules/entities/cli.ts +1 -2
  217. package/src/modules/entities/i18n/de.json +0 -34
  218. package/src/modules/entities/i18n/en.json +0 -34
  219. package/src/modules/entities/i18n/es.json +0 -34
  220. package/src/modules/entities/i18n/pl.json +0 -34
  221. package/src/modules/feature_toggles/api/check/boolean/route.ts +15 -0
  222. package/src/modules/feature_toggles/defaults.json +0 -8
  223. package/src/modules/integrations/backend/integrations/[id]/page.tsx +59 -16
  224. package/src/modules/payment_gateways/data/entities.ts +0 -39
  225. package/src/modules/payment_gateways/lib/gateway-service.ts +40 -211
  226. package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +0 -236
  227. package/src/modules/planner/backend/planner/availability-rulesets/[id]/page.tsx +20 -14
  228. package/src/modules/planner/components/AvailabilityRulesEditor.tsx +34 -16
  229. package/src/modules/query_index/api/status.ts +8 -2
  230. package/src/modules/resources/backend/resources/resources/[id]/page.tsx +37 -27
  231. package/src/modules/sales/backend/sales/channels/create/page.meta.ts +0 -3
  232. package/src/modules/sales/backend/sales/channels/create/page.tsx +0 -7
  233. package/src/modules/sales/backend/sales/channels/offers/page.meta.ts +0 -3
  234. package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -7
  235. package/src/modules/sales/backend/sales/channels/page.meta.ts +0 -4
  236. package/src/modules/sales/backend/sales/channels/page.tsx +0 -7
  237. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +5 -7
  238. package/src/modules/sales/commands/documents.ts +0 -65
  239. package/src/modules/sales/commands/returns.ts +32 -2
  240. package/src/modules/sales/components/documents/AddressesSection.tsx +2 -6
  241. package/src/modules/sales/components/documents/ItemsSection.tsx +0 -5
  242. package/src/modules/sales/components/documents/LineItemDialog.tsx +0 -10
  243. package/src/modules/sales/components/documents/SalesDocumentForm.tsx +3 -53
  244. package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +8 -10
  245. package/src/modules/sales/components/documents/ShipmentDialog.tsx +40 -65
  246. package/src/modules/sales/i18n/de.json +0 -5
  247. package/src/modules/sales/i18n/en.json +0 -5
  248. package/src/modules/sales/i18n/es.json +0 -5
  249. package/src/modules/sales/i18n/pl.json +0 -5
  250. package/src/modules/sales/lib/shipments/snapshots.ts +0 -30
  251. package/src/modules/staff/backend/staff/team-members/[id]/page.tsx +34 -25
  252. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +17 -11
  253. package/src/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.tsx +28 -11
  254. package/src/modules/sync_excel/lib/adapters/customers.ts +22 -20
  255. package/src/modules/sync_excel/lib/parser.ts +0 -245
  256. package/src/modules/sync_excel/lib/upload-storage.ts +1 -23
  257. package/src/modules/workflows/frontend/checkout-demo/page.tsx +12 -1
  258. package/src/modules/workflows/lib/activity-executor.ts +22 -2
  259. package/src/modules/workflows/lib/find-definition.ts +53 -1
  260. package/src/modules/workflows/lib/signal-handler.ts +5 -4
  261. package/src/modules/workflows/lib/step-handler.ts +4 -8
  262. package/src/modules/workflows/lib/task-handler.ts +2 -4
  263. package/src/modules/workflows/lib/timer-handler.ts +3 -2
  264. package/src/modules/workflows/lib/transition-handler.ts +5 -13
  265. package/src/modules/workflows/lib/workflow-executor.ts +11 -8
  266. package/src/modules/workflows/migrations/Migration20260715120000.ts +114 -0
  267. package/src/modules/workflows/migrations/Migration20260716120000.ts +57 -0
  268. package/src/modules/workflows/workflows.ts +2 -0
  269. package/dist/generated/entities/gateway_session_initialization/index.js +0 -23
  270. package/dist/generated/entities/gateway_session_initialization/index.js.map +0 -7
  271. package/dist/modules/attachments/lib/reconcileOrganization.js +0 -110
  272. package/dist/modules/attachments/lib/reconcileOrganization.js.map +0 -7
  273. package/dist/modules/attachments/lib/requestScope.js +0 -10
  274. package/dist/modules/attachments/lib/requestScope.js.map +0 -7
  275. package/dist/modules/auth/api/autologin.js +0 -85
  276. package/dist/modules/auth/api/autologin.js.map +0 -7
  277. package/dist/modules/auth/lib/autologin.js +0 -19
  278. package/dist/modules/auth/lib/autologin.js.map +0 -7
  279. package/dist/modules/customers/components/detail/useDealsAccess.js +0 -16
  280. package/dist/modules/customers/components/detail/useDealsAccess.js.map +0 -7
  281. package/dist/modules/payment_gateways/lib/session-idempotency.js +0 -104
  282. package/dist/modules/payment_gateways/lib/session-idempotency.js.map +0 -7
  283. package/dist/modules/payment_gateways/migrations/Migration20260709220938_payment_gateways.js +0 -11
  284. package/dist/modules/payment_gateways/migrations/Migration20260709220938_payment_gateways.js.map +0 -7
  285. package/dist/modules/sales/components/SalesChannelsDisabledNotice.js +0 -15
  286. package/dist/modules/sales/components/SalesChannelsDisabledNotice.js.map +0 -7
  287. package/dist/modules/sales/components/useSalesChannelsEnabled.js +0 -44
  288. package/dist/modules/sales/components/useSalesChannelsEnabled.js.map +0 -7
  289. package/dist/modules/sales/lib/salesChannelsToggle.js +0 -18
  290. package/dist/modules/sales/lib/salesChannelsToggle.js.map +0 -7
  291. package/dist/modules/sales/lib/salesChannelsToggleId.js +0 -5
  292. package/dist/modules/sales/lib/salesChannelsToggleId.js.map +0 -7
  293. package/generated/entities/gateway_session_initialization/index.ts +0 -10
  294. package/src/modules/attachments/lib/reconcileOrganization.ts +0 -188
  295. package/src/modules/attachments/lib/requestScope.ts +0 -27
  296. package/src/modules/auth/api/autologin.ts +0 -100
  297. package/src/modules/auth/lib/autologin.ts +0 -36
  298. package/src/modules/customers/components/detail/useDealsAccess.ts +0 -19
  299. package/src/modules/payment_gateways/lib/session-idempotency.ts +0 -142
  300. package/src/modules/payment_gateways/migrations/Migration20260709220938_payment_gateways.ts +0 -10
  301. package/src/modules/sales/components/SalesChannelsDisabledNotice.tsx +0 -21
  302. package/src/modules/sales/components/useSalesChannelsEnabled.ts +0 -59
  303. package/src/modules/sales/lib/salesChannelsToggle.ts +0 -26
  304. package/src/modules/sales/lib/salesChannelsToggleId.ts +0 -1
@@ -1,6 +1,4 @@
1
1
  import React from 'react'
2
- import type { RouteVisibilityContext } from '@open-mercato/shared/modules/registry'
3
- import { isSalesChannelsEnabledForTenant } from '../../../../lib/salesChannelsToggle'
4
2
 
5
3
  const createIcon = React.createElement(
6
4
  'svg',
@@ -13,7 +11,6 @@ const createIcon = React.createElement(
13
11
  export const metadata = {
14
12
  requireAuth: true,
15
13
  requireFeatures: ['sales.channels.manage'],
16
- visible: (ctx: RouteVisibilityContext) => isSalesChannelsEnabledForTenant(ctx.auth?.tenantId ?? null),
17
14
  pageTitle: 'Create channel',
18
15
  pageTitleKey: 'sales.channels.form.createTitle',
19
16
  pageGroup: 'Sales',
@@ -9,20 +9,13 @@ import { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customF
9
9
  import { flash } from '@open-mercato/ui/backend/FlashMessages'
10
10
  import { useT } from '@open-mercato/shared/lib/i18n/context'
11
11
  import { useChannelFields, buildChannelPayload, type ChannelFormValues } from '@open-mercato/core/modules/sales/components/channels/channelFormFields'
12
- import { useSalesChannelsEnabled } from '@open-mercato/core/modules/sales/components/useSalesChannelsEnabled'
13
- import { SalesChannelsDisabledNotice } from '@open-mercato/core/modules/sales/components/SalesChannelsDisabledNotice'
14
12
  import { E } from '#generated/entities.ids.generated'
15
13
 
16
14
  export default function CreateChannelPage() {
17
15
  const t = useT()
18
16
  const { fields, groups } = useChannelFields()
19
- const { enabled: channelsEnabled, isLoading: channelsEnabledLoading } = useSalesChannelsEnabled()
20
17
  const router = useRouter()
21
18
 
22
- if (!channelsEnabled && !channelsEnabledLoading) {
23
- return <SalesChannelsDisabledNotice />
24
- }
25
-
26
19
  return (
27
20
  <Page>
28
21
  <PageBody>
@@ -1,6 +1,4 @@
1
1
  import React from 'react'
2
- import type { RouteVisibilityContext } from '@open-mercato/shared/modules/registry'
3
- import { isSalesChannelsEnabledForTenant } from '../../../../lib/salesChannelsToggle'
4
2
 
5
3
  const globeIcon = React.createElement(
6
4
  'svg',
@@ -14,7 +12,6 @@ const globeIcon = React.createElement(
14
12
  export const metadata = {
15
13
  requireAuth: true,
16
14
  requireFeatures: ['sales.channels.manage'],
17
- visible: (ctx: RouteVisibilityContext) => isSalesChannelsEnabledForTenant(ctx.auth?.tenantId ?? null),
18
15
  pageTitle: 'Sales channel offers',
19
16
  pageTitleKey: 'sales.channels.offers.listTitle',
20
17
  pageGroup: 'Sales',
@@ -18,8 +18,6 @@ import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuarde
18
18
  import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
19
19
  import { useT } from '@open-mercato/shared/lib/i18n/context'
20
20
  import { mapOfferRow, renderOfferPriceSummary, type OfferRow } from '@open-mercato/core/modules/sales/components/channels/offerTableUtils'
21
- import { useSalesChannelsEnabled } from '@open-mercato/core/modules/sales/components/useSalesChannelsEnabled'
22
- import { SalesChannelsDisabledNotice } from '@open-mercato/core/modules/sales/components/SalesChannelsDisabledNotice'
23
21
  import { createLogger } from '@open-mercato/shared/lib/logger'
24
22
 
25
23
  const logger = createLogger('sales')
@@ -36,7 +34,6 @@ const SAVE_CONTEXT_ID = 'sales-channel-offers-list'
36
34
 
37
35
  export default function SalesChannelOffersListPage() {
38
36
  const t = useT()
39
- const { enabled: channelsEnabled, isLoading: channelsEnabledLoading } = useSalesChannelsEnabled()
40
37
  const router = useRouter()
41
38
  const { runMutation, retryLastMutation } = useGuardedMutation<{
42
39
  formId: string
@@ -335,10 +332,6 @@ export default function SalesChannelOffersListPage() {
335
332
  </div>
336
333
  )
337
334
 
338
- if (!channelsEnabled && !channelsEnabledLoading) {
339
- return <SalesChannelsDisabledNotice />
340
- }
341
-
342
335
  return (
343
336
  <Page>
344
337
  <PageBody>
@@ -1,10 +1,6 @@
1
- import type { RouteVisibilityContext } from '@open-mercato/shared/modules/registry'
2
- import { isSalesChannelsEnabledForTenant } from '../../../lib/salesChannelsToggle'
3
-
4
1
  export const metadata = {
5
2
  requireAuth: true,
6
3
  requireFeatures: ['sales.channels.manage'],
7
- visible: (ctx: RouteVisibilityContext) => isSalesChannelsEnabledForTenant(ctx.auth?.tenantId ?? null),
8
4
  pageTitle: 'Sales channels',
9
5
  pageTitleKey: 'sales.channels.nav.title',
10
6
  pageGroup: 'Sales',
@@ -16,8 +16,6 @@ import { buildOptimisticLockHeader, extractOptimisticLockConflict } from '@open-
16
16
  import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
17
17
  import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
18
18
  import { useT } from '@open-mercato/shared/lib/i18n/context'
19
- import { useSalesChannelsEnabled } from '../../../components/useSalesChannelsEnabled'
20
- import { SalesChannelsDisabledNotice } from '../../../components/SalesChannelsDisabledNotice'
21
19
  import { createLogger } from '@open-mercato/shared/lib/logger'
22
20
 
23
21
  const logger = createLogger('sales')
@@ -44,7 +42,6 @@ const SAVE_CONTEXT_ID = 'sales-channels-list'
44
42
 
45
43
  export default function SalesChannelsPage() {
46
44
  const t = useT()
47
- const { enabled: channelsEnabled, isLoading: channelsEnabledLoading } = useSalesChannelsEnabled()
48
45
  const router = useRouter()
49
46
  const { runMutation, retryLastMutation } = useGuardedMutation<{
50
47
  formId: string
@@ -193,10 +190,6 @@ export default function SalesChannelsPage() {
193
190
  }
194
191
  }, [handleRefresh, mutationContext, runMutation, t])
195
192
 
196
- if (!channelsEnabled && !channelsEnabledLoading) {
197
- return <SalesChannelsDisabledNotice />
198
- }
199
-
200
193
  return (
201
194
  <Page>
202
195
  <PageBody>
@@ -69,7 +69,6 @@ import { readMarkdownPreferenceCookie, writeMarkdownPreferenceCookie } from '@op
69
69
  import { InjectionSpot, useInjectionWidgets } from '@open-mercato/ui/backend/injection/InjectionSpot'
70
70
  import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
71
71
  import { buildRecordInjectionContext, useSetCurrentRecordInjectionContext } from '@open-mercato/ui/backend/injection/recordContext'
72
- import { useSalesChannelsEnabled } from '@open-mercato/core/modules/sales/components/useSalesChannelsEnabled'
73
72
  import { createLogger } from '@open-mercato/shared/lib/logger'
74
73
 
75
74
  const logger = createLogger('sales')
@@ -1895,7 +1894,6 @@ export default function SalesDocumentDetailPage({
1895
1894
  includeAmountInMessageMetadata?: boolean
1896
1895
  }) {
1897
1896
  const t = useT()
1898
- const { enabled: channelsEnabled } = useSalesChannelsEnabled()
1899
1897
  const router = useRouter()
1900
1898
  const searchParams = useSearchParams()
1901
1899
  const pathname = usePathname()
@@ -2580,11 +2578,11 @@ export default function SalesDocumentDetailPage({
2580
2578
  }, [record])
2581
2579
 
2582
2580
  React.useEffect(() => {
2583
- if (channelsEnabled) loadChannels().catch(() => {})
2581
+ loadChannels().catch(() => {})
2584
2582
  loadStatuses().catch(() => {})
2585
2583
  loadShippingMethods().catch(() => {})
2586
2584
  loadPaymentMethods().catch(() => {})
2587
- }, [channelsEnabled, loadChannels, loadPaymentMethods, loadShippingMethods, loadStatuses, scopeVersion])
2585
+ }, [loadChannels, loadPaymentMethods, loadShippingMethods, loadStatuses, scopeVersion])
2588
2586
 
2589
2587
  React.useEffect(() => {
2590
2588
  void refreshPaymentPresence()
@@ -3957,11 +3955,11 @@ export default function SalesDocumentDetailPage({
3957
3955
  emptyLabel: t('sales.documents.detail.empty', 'Not set'),
3958
3956
  type: 'email' as const,
3959
3957
  },
3960
- ...(channelsEnabled ? [{
3961
- key: 'channel' as const,
3958
+ {
3959
+ key: 'channel',
3962
3960
  title: t('sales.documents.detail.channel', 'Channel'),
3963
3961
  value: record?.channelId ?? null,
3964
- }] : []),
3962
+ },
3965
3963
  {
3966
3964
  key: 'status',
3967
3965
  title: t('sales.documents.detail.status', 'Status'),
@@ -125,7 +125,6 @@ import {
125
125
  type SalesLineCalculationResult,
126
126
  type SalesDocumentCalculationResult,
127
127
  } from "../lib/types";
128
- import { loadShippedQuantityByLine } from "../lib/shipments/snapshots";
129
128
  import { resolveDictionaryEntryValue } from "../lib/dictionaries";
130
129
  import { resolveStatusEntryIdByValue } from "../lib/statusHelpers";
131
130
  import { SalesDocumentNumberGenerator } from "../services/salesDocumentNumberGenerator";
@@ -6522,69 +6521,6 @@ const quoteAdjustmentDeleteSchema = z.object({
6522
6521
  quoteId: z.string().uuid(),
6523
6522
  });
6524
6523
 
6525
- const SHIPPED_QUANTITY_TOLERANCE = 1e-6;
6526
-
6527
- const hasNumericChange = (
6528
- next: number | null | undefined,
6529
- previous: number | null | undefined,
6530
- ): boolean => {
6531
- if (next === undefined || next === null) return false;
6532
- if (previous === undefined || previous === null) return true;
6533
- return Math.abs(next - previous) > SHIPPED_QUANTITY_TOLERANCE;
6534
- };
6535
-
6536
- const hasUnitChange = (
6537
- next: string | null | undefined,
6538
- previous: string | null | undefined,
6539
- ): boolean => {
6540
- if (next === undefined || next === null) return false;
6541
- const normalizedPrevious = (previous ?? "").trim().toLowerCase();
6542
- if (!normalizedPrevious) return false;
6543
- return next.trim().toLowerCase() !== normalizedPrevious;
6544
- };
6545
-
6546
- async function assertShippedOrderLineEditable(
6547
- em: EntityManager,
6548
- order: SalesOrder,
6549
- existingSnapshot: SalesLineSnapshot | null,
6550
- parsed: z.infer<typeof orderLineUpsertSchema>,
6551
- ): Promise<void> {
6552
- const lineId = existingSnapshot?.id;
6553
- if (!existingSnapshot || !lineId) return;
6554
- const shippedByLine = await loadShippedQuantityByLine(em, order.id, {
6555
- tenantId: order.tenantId,
6556
- organizationId: order.organizationId,
6557
- });
6558
- const shippedQuantity = shippedByLine.get(lineId) ?? 0;
6559
- if (shippedQuantity <= 0) return;
6560
-
6561
- const { translate } = await resolveTranslations();
6562
- const nextQuantity = parsed.quantity ?? existingSnapshot.quantity;
6563
- if (nextQuantity < shippedQuantity - SHIPPED_QUANTITY_TOLERANCE) {
6564
- throw new CrudHttpError(409, {
6565
- error: translate(
6566
- "sales.documents.items.errorQuantityBelowShipped",
6567
- "You cannot lower the quantity below the {{shipped}} already shipped.",
6568
- { shipped: shippedQuantity },
6569
- ),
6570
- });
6571
- }
6572
-
6573
- const pricingChanged =
6574
- hasNumericChange(parsed.unitPriceNet, existingSnapshot.unitPriceNet) ||
6575
- hasNumericChange(parsed.unitPriceGross, existingSnapshot.unitPriceGross) ||
6576
- hasNumericChange(parsed.taxRate, existingSnapshot.taxRate) ||
6577
- hasUnitChange(parsed.quantityUnit, existingSnapshot.quantityUnit);
6578
- if (pricingChanged) {
6579
- throw new CrudHttpError(409, {
6580
- error: translate(
6581
- "sales.documents.items.errorPriceShipped",
6582
- "You cannot change the price or unit of a line that has shipped items.",
6583
- ),
6584
- });
6585
- }
6586
- }
6587
-
6588
6524
  const orderLineUpsertCommand: CommandHandler<
6589
6525
  { body?: Record<string, unknown>; query?: Record<string, unknown> },
6590
6526
  { orderId: string; lineId: string }
@@ -6629,7 +6565,6 @@ const orderLineUpsertCommand: CommandHandler<
6629
6565
  const existingSnapshot = parsed.id
6630
6566
  ? (lineSnapshots.find((line) => line.id === parsed.id) ?? null)
6631
6567
  : null;
6632
- await assertShippedOrderLineEditable(em, order, existingSnapshot, parsed);
6633
6568
  const priceMode =
6634
6569
  parsed.priceMode === "gross"
6635
6570
  ? "gross"
@@ -15,8 +15,8 @@ import type { SalesCalculationService } from '../services/salesCalculationServic
15
15
  import type { SalesAdjustmentDraft, SalesLineSnapshot, SalesDocumentCalculationResult } from '../lib/types'
16
16
  import { cloneJson, deriveLineNetFromGross, ensureOrganizationScope, ensureSameScope, ensureTenantScope, extractUndoPayload, toNumericString, enforceSalesDocumentOptimisticLock, SALES_RESOURCE_KIND_ORDER, SALES_RESOURCE_KIND_RETURN } from './shared'
17
17
  import { resolveRedoSnapshot } from '@open-mercato/shared/lib/commands/redo'
18
- import { SalesOrder, SalesOrderAdjustment, SalesOrderLine, SalesReturn, SalesReturnLine } from '../data/entities'
19
- import { loadShippedQuantityByLine } from '../lib/shipments/snapshots'
18
+ import { SalesOrder, SalesOrderAdjustment, SalesOrderLine, SalesReturn, SalesReturnLine, SalesShipment, SalesShipmentItem } from '../data/entities'
19
+ import { coerceShipmentQuantity } from '../lib/shipments/snapshots'
20
20
  import { computeAvailableReturnQuantity } from '../lib/returnQuantity'
21
21
  import {
22
22
  returnCreateSchema,
@@ -581,6 +581,36 @@ async function restoreReturnEffects(
581
581
  return createdLines
582
582
  }
583
583
 
584
+ async function loadShippedQuantityByLine(
585
+ em: EntityManager,
586
+ orderId: string,
587
+ scope: { tenantId: string; organizationId: string },
588
+ ): Promise<Map<string, number>> {
589
+ const shipments = await findWithDecryption(
590
+ em,
591
+ SalesShipment,
592
+ { order: orderId, deletedAt: null },
593
+ {},
594
+ scope,
595
+ )
596
+ const shippedByLine = new Map<string, number>()
597
+ if (!shipments.length) return shippedByLine
598
+ const items = await findWithDecryption(
599
+ em,
600
+ SalesShipmentItem,
601
+ { shipment: { $in: shipments.map((shipment) => shipment.id) } },
602
+ {},
603
+ scope,
604
+ )
605
+ items.forEach((item) => {
606
+ const orderLineId = typeof item.orderLine === 'string' ? item.orderLine : item.orderLine?.id ?? null
607
+ if (!orderLineId) return
608
+ const next = (shippedByLine.get(orderLineId) ?? 0) + coerceShipmentQuantity(item.quantity)
609
+ shippedByLine.set(orderLineId, next)
610
+ })
611
+ return shippedByLine
612
+ }
613
+
584
614
  function normalizeLinesInput(lines: ReturnCreateInput['lines']): ReturnLineInput[] {
585
615
  const seen = new Set<string>()
586
616
  const result: ReturnLineInput[] = []
@@ -890,12 +890,8 @@ export function SalesDocumentAddressesSection({
890
890
  if (res?.result?.id) billingId = res.result.id
891
891
  }
892
892
 
893
- if (shippingSnapshot || !shippingId) {
894
- payload.shippingAddressSnapshot = shippingSnapshot ?? null
895
- }
896
- if (billingSnapshot || !billingId) {
897
- payload.billingAddressSnapshot = billingSnapshot ?? null
898
- }
893
+ payload.shippingAddressSnapshot = shippingSnapshot ?? null
894
+ payload.billingAddressSnapshot = billingSnapshot ?? null
899
895
  payload.shippingAddressId = shippingSnapshot ? null : shippingId
900
896
  payload.billingAddressId = billingSnapshot ? null : billingId
901
897
 
@@ -817,11 +817,6 @@ export function SalesDocumentItemsSection({
817
817
  organizationId={resolvedOrganizationId}
818
818
  tenantId={resolvedTenantId}
819
819
  initialLine={lineForEdit}
820
- shippedQuantity={
821
- lineForEdit
822
- ? Math.max(0, shippedTotals.get(lineForEdit.id) ?? 0)
823
- : 0
824
- }
825
820
  onSaved={async () => {
826
821
  await loadItems();
827
822
  emitSalesDocumentTotalsRefresh({ documentId, kind });
@@ -278,7 +278,6 @@ type SalesLineDialogProps = {
278
278
  organizationId: string | null;
279
279
  tenantId: string | null;
280
280
  initialLine?: SalesLineRecord | null;
281
- shippedQuantity?: number;
282
281
  onOpenChange: (open: boolean) => void;
283
282
  onSaved?: () => Promise<void> | void;
284
283
  };
@@ -473,7 +472,6 @@ export function LineItemDialog({
473
472
  organizationId,
474
473
  tenantId,
475
474
  initialLine,
476
- shippedQuantity = 0,
477
475
  onOpenChange,
478
476
  onSaved,
479
477
  }: SalesLineDialogProps) {
@@ -1328,14 +1326,6 @@ export function LineItemDialog({
1328
1326
  },
1329
1327
  );
1330
1328
  }
1331
- if (shippedQuantity > 0 && qtyNumber < shippedQuantity) {
1332
- const message = t(
1333
- "sales.documents.items.errorQuantityBelowShipped",
1334
- "You cannot lower the quantity below the {{shipped}} already shipped.",
1335
- { shipped: shippedQuantity },
1336
- );
1337
- throw createCrudFormError(message, { quantity: message });
1338
- }
1339
1329
  const resolvedQuantityUnit = (() => {
1340
1330
  const entered = normalizeUnitCode(values.quantityUnit);
1341
1331
  if (isCustomLine) return entered;
@@ -57,7 +57,6 @@ import {
57
57
  type AddressValue,
58
58
  } from '@open-mercato/core/modules/customers/utils/addressFormat'
59
59
  import { AddressEditor, type AddressEditorDraft } from '@open-mercato/core/modules/customers/components/AddressEditor'
60
- import { useSalesChannelsEnabled } from '../useSalesChannelsEnabled'
61
60
  import { createLogger } from '@open-mercato/shared/lib/logger'
62
61
 
63
62
  const logger = createLogger('sales')
@@ -169,7 +168,6 @@ function CustomerQuickCreate({ t, onCreated }: CustomerQuickCreateProps) {
169
168
  async (values: PersonFormValues) => {
170
169
  setSaving(true)
171
170
  try {
172
- const addresses = Array.isArray(values.addresses) ? values.addresses : []
173
171
  const payload = buildPersonPayload(values, organizationId)
174
172
  const { result } = await createCrud<{ id?: string; entityId?: string }>('customers/people', payload, {
175
173
  errorMessage: t('sales.documents.form.customer.quick.error', 'Failed to create customer.'),
@@ -179,51 +177,6 @@ function CustomerQuickCreate({ t, onCreated }: CustomerQuickCreateProps) {
179
177
  (result && typeof result.id === 'string' && result.id) ||
180
178
  null
181
179
  if (!id) throw new Error('Missing customer id')
182
- if (addresses.length) {
183
- const normalize = (value?: string | null) => {
184
- if (typeof value !== 'string') return undefined
185
- const trimmed = value.trim()
186
- return trimmed.length ? trimmed : undefined
187
- }
188
- for (const entry of addresses) {
189
- const normalizedLine1 = normalize(entry.addressLine1)
190
- if (!normalizedLine1) continue
191
- const body: Record<string, unknown> = {
192
- entityId: id,
193
- ...(organizationId ? { organizationId } : {}),
194
- addressLine1: normalizedLine1,
195
- isPrimary: entry.isPrimary ?? false,
196
- }
197
- const name = normalize(entry.name)
198
- if (name !== undefined) body.name = name
199
- const purpose = normalize(entry.purpose)
200
- if (purpose !== undefined) body.purpose = purpose
201
- const line2 = normalize(entry.addressLine2)
202
- if (line2 !== undefined) body.addressLine2 = line2
203
- const buildingNumber = normalize(entry.buildingNumber)
204
- if (buildingNumber !== undefined) body.buildingNumber = buildingNumber
205
- const flatNumber = normalize(entry.flatNumber)
206
- if (flatNumber !== undefined) body.flatNumber = flatNumber
207
- const city = normalize(entry.city)
208
- if (city !== undefined) body.city = city
209
- const region = normalize(entry.region)
210
- if (region !== undefined) body.region = region
211
- const postalCode = normalize(entry.postalCode)
212
- if (postalCode !== undefined) body.postalCode = postalCode
213
- const country = normalize(entry.country)
214
- if (country !== undefined) body.country = country.toUpperCase()
215
- if (typeof entry.latitude === 'number') body.latitude = entry.latitude
216
- if (typeof entry.longitude === 'number') body.longitude = entry.longitude
217
- try {
218
- await createCrud('customers/addresses', body)
219
- } catch (addressErr) {
220
- const message =
221
- (addressErr instanceof Error && addressErr.message ? addressErr.message : null) ||
222
- t('customers.people.detail.addresses.error')
223
- flash(message, 'error')
224
- }
225
- }
226
- }
227
180
  const displayName =
228
181
  typeof values.displayName === 'string' && values.displayName.trim().length
229
182
  ? values.displayName.trim()
@@ -805,7 +758,6 @@ function CustomerGroupComponent({ values, setValue, t, customers, setCustomers,
805
758
 
806
759
  export function SalesDocumentForm({ onCreated, isSubmitting = false, initialKind, inboxPreFill }: SalesDocumentFormProps) {
807
760
  const t = useT()
808
- const { enabled: channelsEnabled } = useSalesChannelsEnabled()
809
761
  const [customers, setCustomers] = React.useState<CustomerOption[]>([])
810
762
  const [customerLoading, setCustomerLoading] = React.useState(false)
811
763
  const [channels, setChannels] = React.useState<ChannelOption[]>([])
@@ -1176,7 +1128,7 @@ export function SalesDocumentForm({ onCreated, isSubmitting = false, initialKind
1176
1128
  />
1177
1129
  ),
1178
1130
  },
1179
- ...(channelsEnabled ? [{
1131
+ {
1180
1132
  id: 'channelId',
1181
1133
  label: t('sales.documents.form.channel', 'Sales channel'),
1182
1134
  type: 'custom',
@@ -1198,7 +1150,7 @@ export function SalesDocumentForm({ onCreated, isSubmitting = false, initialKind
1198
1150
  selectedHintLabel={(id) => t('sales.documents.form.channel.selected', 'Selected channel: {{id}}', { id })}
1199
1151
  />
1200
1152
  ),
1201
- } satisfies CrudField] : []),
1153
+ },
1202
1154
  {
1203
1155
  id: 'shippingAddressSection',
1204
1156
  label: '',
@@ -1319,7 +1271,6 @@ export function SalesDocumentForm({ onCreated, isSubmitting = false, initialKind
1319
1271
  addressOptions,
1320
1272
  addressesError,
1321
1273
  addressesLoading,
1322
- channelsEnabled,
1323
1274
  currencyLabels,
1324
1275
  fetchCurrencyOptions,
1325
1276
  loadAddresses,
@@ -1338,13 +1289,12 @@ export function SalesDocumentForm({ onCreated, isSubmitting = false, initialKind
1338
1289
  fields: [],
1339
1290
  component: (ctx) => <CustomerGroupComponent {...ctx} t={t} customers={customers} setCustomers={setCustomers} customerQuerySetter={customerQuerySetter} loadAddresses={loadAddresses} loadCustomers={loadCustomers} fetchCustomerEmail={fetchCustomerEmail} resetAddressFormState={resetAddressFormState} />,
1340
1291
  },
1341
- { id: 'channels-comments', title: '', column: 1, fields: channelsEnabled ? ['channelId', 'comments'] : ['comments'] },
1292
+ { id: 'channels-comments', title: '', column: 1, fields: ['channelId', 'comments'] },
1342
1293
  { id: 'currency', title: '', column: 2, fields: ['currencyCode'] },
1343
1294
  { id: 'shipping', title: '', column: 2, fields: ['shippingAddressSection'] },
1344
1295
  { id: 'billing', title: '', column: 2, fields: ['billingAddressSection'] },
1345
1296
  { id: 'custom', title: t('sales.documents.form.customFields', 'Custom fields'), column: 2, kind: 'customFields' },
1346
1297
  ], [
1347
- channelsEnabled,
1348
1298
  customers,
1349
1299
  fetchCustomerEmail,
1350
1300
  loadAddresses,
@@ -24,7 +24,6 @@ import {
24
24
  normalizeDictionaryEntries,
25
25
  } from '@open-mercato/core/modules/dictionaries/components/dictionaryAppearance'
26
26
  import { SALES_DOCUMENT_NUMBER_COLUMN_META } from './salesDocumentsColumns'
27
- import { useSalesChannelsEnabled } from '../useSalesChannelsEnabled'
28
27
  import { createLogger } from '@open-mercato/shared/lib/logger'
29
28
 
30
29
  const logger = createLogger('sales')
@@ -147,7 +146,6 @@ function normalizeNumberInput(value: unknown): number | null {
147
146
 
148
147
  export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
149
148
  const t = useT()
150
- const { enabled: channelsEnabled } = useSalesChannelsEnabled()
151
149
  const router = useRouter()
152
150
  const scopeVersion = useOrganizationScopeVersion()
153
151
  const { confirm, ConfirmDialogElement } = useConfirmDialog()
@@ -295,20 +293,20 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
295
293
  )
296
294
 
297
295
  React.useEffect(() => {
298
- if (channelsEnabled) loadChannelOptions().catch(() => {})
296
+ loadChannelOptions().catch(() => {})
299
297
  loadTagOptions().catch(() => {})
300
298
  loadCustomerOptions().catch(() => {})
301
299
  loadStatusMap().catch(() => setStatusMap({}))
302
- }, [channelsEnabled, loadChannelOptions, loadCustomerOptions, loadStatusMap, loadTagOptions, scopeVersion])
300
+ }, [loadChannelOptions, loadCustomerOptions, loadStatusMap, loadTagOptions, scopeVersion])
303
301
 
304
302
  const filters = React.useMemo<FilterDef[]>(() => [
305
- ...(channelsEnabled ? [{
303
+ {
306
304
  id: 'channelId',
307
305
  label: t('sales.documents.list.filters.channel', 'Channel'),
308
306
  type: 'select',
309
307
  options: channelOptions,
310
308
  loadOptions: loadChannelOptions,
311
- } satisfies FilterDef] : []),
309
+ },
312
310
  {
313
311
  id: 'date',
314
312
  label: t('sales.documents.list.filters.date', 'Date'),
@@ -365,7 +363,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
365
363
  formatValue: (val: string) => tagOptions.find((o) => o.value === val)?.label ?? val,
366
364
  formatDescription: (val: string) => tagOptions.find((o) => o.value === val)?.description ?? null,
367
365
  },
368
- ], [channelsEnabled, channelOptions, loadChannelOptions, customerOptions, loadCustomerOptions, loadTagOptions, tagOptions, t])
366
+ ], [channelOptions, loadChannelOptions, customerOptions, loadCustomerOptions, loadTagOptions, tagOptions, t])
369
367
 
370
368
  const queryParams = React.useMemo(() => {
371
369
  const params = new URLSearchParams()
@@ -617,7 +615,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
617
615
  ),
618
616
  enableSorting: false,
619
617
  },
620
- ...(channelsEnabled ? [{
618
+ {
621
619
  accessorKey: 'channelId',
622
620
  header: t('sales.documents.list.table.channel', 'Channel'),
623
621
  cell: ({ row }) => {
@@ -629,7 +627,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
629
627
  )
630
628
  },
631
629
  enableSorting: false,
632
- } satisfies ColumnDef<SalesDocumentRow>] : []),
630
+ },
633
631
  {
634
632
  id: 'lineItemCount',
635
633
  accessorKey: 'lineItemCount',
@@ -663,7 +661,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
663
661
  ? <span className="text-xs text-muted-foreground">{new Date(row.original.date).toLocaleString()}</span>
664
662
  : <span className="text-xs text-muted-foreground">—</span>,
665
663
  },
666
- ], [channelsEnabled, channelOptions, kind, statusMap, t])
664
+ ], [channelOptions, kind, statusMap, t])
667
665
 
668
666
  const emptyLabel = kind === 'order'
669
667
  ? t('sales.documents.list.table.emptyOrders', 'No orders yet.')