@open-mercato/core 0.4.2-canary-968c919ed2 → 0.4.2-canary-f821f89ef6

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 (632) hide show
  1. package/dist/generated/entities/workflow_event_trigger/index.js +33 -0
  2. package/dist/generated/entities/workflow_event_trigger/index.js.map +7 -0
  3. package/dist/generated/entities.ids.generated.js +2 -5
  4. package/dist/generated/entities.ids.generated.js.map +2 -2
  5. package/dist/generated/entity-fields-registry.js +2 -2
  6. package/dist/generated/entity-fields-registry.js.map +2 -2
  7. package/dist/modules/api_docs/frontend/docs/api/page.js +2 -3
  8. package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
  9. package/dist/modules/api_keys/backend/api-keys/page.js +1 -1
  10. package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
  11. package/dist/modules/attachments/components/AttachmentLibrary.js +0 -4
  12. package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
  13. package/dist/modules/attachments/components/AttachmentPartitionSettings.js +0 -2
  14. package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
  15. package/dist/modules/auth/api/admin/nav.js +3 -4
  16. package/dist/modules/auth/api/admin/nav.js.map +2 -2
  17. package/dist/modules/auth/api/login.js +6 -25
  18. package/dist/modules/auth/api/login.js.map +2 -2
  19. package/dist/modules/auth/api/reset/confirm.js +2 -25
  20. package/dist/modules/auth/api/reset/confirm.js.map +2 -2
  21. package/dist/modules/auth/api/reset.js +0 -23
  22. package/dist/modules/auth/api/reset.js.map +2 -2
  23. package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
  24. package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
  25. package/dist/modules/auth/api/users/route.js +2 -4
  26. package/dist/modules/auth/api/users/route.js.map +2 -2
  27. package/dist/modules/auth/backend/roles/[id]/edit/page.js +1 -4
  28. package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
  29. package/dist/modules/auth/backend/roles/page.js +3 -3
  30. package/dist/modules/auth/backend/roles/page.js.map +2 -2
  31. package/dist/modules/auth/backend/users/[id]/edit/page.js +3 -18
  32. package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
  33. package/dist/modules/auth/backend/users/create/page.js +2 -15
  34. package/dist/modules/auth/backend/users/create/page.js.map +2 -2
  35. package/dist/modules/auth/backend/users/page.js +3 -3
  36. package/dist/modules/auth/backend/users/page.js.map +2 -2
  37. package/dist/modules/auth/cli.js +11 -25
  38. package/dist/modules/auth/cli.js.map +2 -2
  39. package/dist/modules/auth/commands/users.js +2 -59
  40. package/dist/modules/auth/commands/users.js.map +2 -2
  41. package/dist/modules/auth/data/validators.js +3 -6
  42. package/dist/modules/auth/data/validators.js.map +2 -2
  43. package/dist/modules/auth/events.js +30 -0
  44. package/dist/modules/auth/events.js.map +7 -0
  45. package/dist/modules/auth/frontend/login.js +3 -105
  46. package/dist/modules/auth/frontend/login.js.map +2 -2
  47. package/dist/modules/auth/frontend/reset/[token]/page.js +10 -20
  48. package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
  49. package/dist/modules/auth/lib/setup-app.js +8 -42
  50. package/dist/modules/auth/lib/setup-app.js.map +2 -2
  51. package/dist/modules/auth/services/authService.js +3 -24
  52. package/dist/modules/auth/services/authService.js.map +2 -2
  53. package/dist/modules/business_rules/api/execute/[ruleId]/route.js +145 -0
  54. package/dist/modules/business_rules/api/execute/[ruleId]/route.js.map +7 -0
  55. package/dist/modules/business_rules/api/execute/route.js +1 -7
  56. package/dist/modules/business_rules/api/execute/route.js.map +2 -2
  57. package/dist/modules/business_rules/backend/rules/page.js +0 -4
  58. package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
  59. package/dist/modules/business_rules/backend/sets/page.js +0 -3
  60. package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
  61. package/dist/modules/business_rules/cli.js +1 -2
  62. package/dist/modules/business_rules/cli.js.map +2 -2
  63. package/dist/modules/business_rules/data/validators.js +34 -0
  64. package/dist/modules/business_rules/data/validators.js.map +2 -2
  65. package/dist/modules/business_rules/index.js +21 -1
  66. package/dist/modules/business_rules/index.js.map +2 -2
  67. package/dist/modules/business_rules/lib/rule-engine.js +185 -34
  68. package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
  69. package/dist/modules/catalog/components/PriceKindSettings.js +0 -2
  70. package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
  71. package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -2
  72. package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
  73. package/dist/modules/catalog/components/products/ProductsDataTable.js +0 -2
  74. package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
  75. package/dist/modules/catalog/events.js +34 -0
  76. package/dist/modules/catalog/events.js.map +7 -0
  77. package/dist/modules/configs/cli.js +0 -6
  78. package/dist/modules/configs/cli.js.map +2 -2
  79. package/dist/modules/configs/components/CachePanel.js +4 -4
  80. package/dist/modules/configs/components/CachePanel.js.map +2 -2
  81. package/dist/modules/configs/lib/system-status.js +1 -48
  82. package/dist/modules/configs/lib/system-status.js.map +2 -2
  83. package/dist/modules/configs/lib/upgrade-actions.js +0 -18
  84. package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
  85. package/dist/modules/currencies/backend/currencies/page.js +0 -3
  86. package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
  87. package/dist/modules/currencies/backend/exchange-rates/page.js +0 -2
  88. package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
  89. package/dist/modules/customers/backend/customers/companies/page.js +0 -3
  90. package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
  91. package/dist/modules/customers/backend/customers/deals/page.js +0 -3
  92. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  93. package/dist/modules/customers/backend/customers/people/page.js +0 -3
  94. package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
  95. package/dist/modules/customers/commands/deals.js +0 -31
  96. package/dist/modules/customers/commands/deals.js.map +2 -2
  97. package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
  98. package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
  99. package/dist/modules/customers/events.js +49 -0
  100. package/dist/modules/customers/events.js.map +7 -0
  101. package/dist/modules/customers/widgets/dashboard/customer-todos/widget.js +1 -2
  102. package/dist/modules/customers/widgets/dashboard/customer-todos/widget.js.map +2 -2
  103. package/dist/modules/customers/widgets/dashboard/new-customers/widget.js +1 -2
  104. package/dist/modules/customers/widgets/dashboard/new-customers/widget.js.map +2 -2
  105. package/dist/modules/customers/widgets/dashboard/new-deals/widget.js +1 -2
  106. package/dist/modules/customers/widgets/dashboard/new-deals/widget.js.map +2 -2
  107. package/dist/modules/customers/widgets/dashboard/next-interactions/widget.js +1 -2
  108. package/dist/modules/customers/widgets/dashboard/next-interactions/widget.js.map +2 -2
  109. package/dist/modules/dashboards/cli.js +5 -44
  110. package/dist/modules/dashboards/cli.js.map +2 -2
  111. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +11 -16
  112. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +3 -3
  113. package/dist/modules/dashboards/services/widgetDataService.js +3 -139
  114. package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
  115. package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.js +1 -2
  116. package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.js.map +2 -2
  117. package/dist/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.js +1 -2
  118. package/dist/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.js.map +2 -2
  119. package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.js +1 -2
  120. package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.js.map +2 -2
  121. package/dist/modules/dashboards/widgets/dashboard/orders-kpi/widget.js +1 -2
  122. package/dist/modules/dashboards/widgets/dashboard/orders-kpi/widget.js.map +2 -2
  123. package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.js +1 -2
  124. package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.js.map +2 -2
  125. package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.js +1 -2
  126. package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.js.map +2 -2
  127. package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.js +1 -2
  128. package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.js.map +2 -2
  129. package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.js +1 -2
  130. package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.js.map +2 -2
  131. package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.js +1 -2
  132. package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.js.map +2 -2
  133. package/dist/modules/dashboards/widgets/dashboard/top-products/widget.js +1 -2
  134. package/dist/modules/dashboards/widgets/dashboard/top-products/widget.js.map +2 -2
  135. package/dist/modules/dictionaries/components/DictionaryTable.js +0 -2
  136. package/dist/modules/dictionaries/components/DictionaryTable.js.map +2 -2
  137. package/dist/modules/directory/backend/directory/organizations/page.js +2 -2
  138. package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
  139. package/dist/modules/directory/backend/directory/tenants/page.js +2 -2
  140. package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
  141. package/dist/modules/directory/events.js +23 -0
  142. package/dist/modules/directory/events.js.map +7 -0
  143. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +2 -2
  144. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
  145. package/dist/modules/entities/components/SystemEntitiesTable.js +1 -1
  146. package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
  147. package/dist/modules/entities/components/UserEntitiesTable.js +2 -2
  148. package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
  149. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +3 -3
  150. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
  151. package/dist/modules/feature_toggles/components/OverridesTable.js +1 -1
  152. package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
  153. package/dist/modules/planner/backend/planner/availability-rulesets/page.js +2 -2
  154. package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
  155. package/dist/modules/query_index/cli.js +7 -63
  156. package/dist/modules/query_index/cli.js.map +2 -2
  157. package/dist/modules/query_index/components/QueryIndexesTable.js +1 -7
  158. package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
  159. package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
  160. package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
  161. package/dist/modules/resources/backend/resources/resources/page.js +2 -2
  162. package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
  163. package/dist/modules/sales/acl.js +1 -0
  164. package/dist/modules/sales/acl.js.map +2 -2
  165. package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -2
  166. package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
  167. package/dist/modules/sales/backend/sales/channels/page.js +0 -2
  168. package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
  169. package/dist/modules/sales/backend/sales/documents/[id]/page.js +12 -0
  170. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  171. package/dist/modules/sales/commands/documents.js +62 -53
  172. package/dist/modules/sales/commands/documents.js.map +2 -2
  173. package/dist/modules/sales/commands/payments.js +0 -26
  174. package/dist/modules/sales/commands/payments.js.map +2 -2
  175. package/dist/modules/sales/components/AdjustmentKindSettings.js +2 -2
  176. package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
  177. package/dist/modules/sales/components/PaymentMethodsSettings.js +2 -2
  178. package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
  179. package/dist/modules/sales/components/ShippingMethodsSettings.js +2 -2
  180. package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
  181. package/dist/modules/sales/components/TaxRatesSettings.js +2 -2
  182. package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
  183. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -2
  184. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
  185. package/dist/modules/sales/components/documents/AdjustmentsSection.js +0 -2
  186. package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
  187. package/dist/modules/sales/components/documents/PaymentsSection.js +1 -2
  188. package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
  189. package/dist/modules/sales/components/documents/SalesDocumentsTable.js +0 -2
  190. package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
  191. package/dist/modules/sales/events.js +63 -0
  192. package/dist/modules/sales/events.js.map +7 -0
  193. package/dist/modules/sales/lib/dictionaries.js +3 -0
  194. package/dist/modules/sales/lib/dictionaries.js.map +2 -2
  195. package/dist/modules/sales/lib/frontend/documentDataEvents.js +25 -0
  196. package/dist/modules/sales/lib/frontend/documentDataEvents.js.map +7 -0
  197. package/dist/modules/staff/backend/staff/team-members/page.js +1 -1
  198. package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
  199. package/dist/modules/staff/backend/staff/team-roles/page.js +2 -2
  200. package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
  201. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +2 -2
  202. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  203. package/dist/modules/staff/backend/staff/teams/page.js +2 -2
  204. package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
  205. package/dist/modules/staff/commands/leave-requests.js +0 -79
  206. package/dist/modules/staff/commands/leave-requests.js.map +2 -2
  207. package/dist/modules/workflows/acl.js +2 -0
  208. package/dist/modules/workflows/acl.js.map +2 -2
  209. package/dist/modules/workflows/api/instances/route.js +18 -6
  210. package/dist/modules/workflows/api/instances/route.js.map +2 -2
  211. package/dist/modules/workflows/api/tasks/route.js +6 -1
  212. package/dist/modules/workflows/api/tasks/route.js.map +2 -2
  213. package/dist/modules/workflows/backend/definitions/[id]/page.js +9 -1
  214. package/dist/modules/workflows/backend/definitions/[id]/page.js.map +2 -2
  215. package/dist/modules/workflows/backend/definitions/[id]/page.meta.js +1 -1
  216. package/dist/modules/workflows/backend/definitions/[id]/page.meta.js.map +2 -2
  217. package/dist/modules/workflows/backend/definitions/create/page.js +24 -15
  218. package/dist/modules/workflows/backend/definitions/create/page.js.map +2 -2
  219. package/dist/modules/workflows/backend/definitions/create/page.meta.js +1 -1
  220. package/dist/modules/workflows/backend/definitions/create/page.meta.js.map +2 -2
  221. package/dist/modules/workflows/backend/definitions/page.js +0 -5
  222. package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
  223. package/dist/modules/workflows/backend/definitions/visual-editor/page.js +150 -132
  224. package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
  225. package/dist/modules/workflows/backend/definitions/visual-editor/page.meta.js +1 -1
  226. package/dist/modules/workflows/backend/definitions/visual-editor/page.meta.js.map +2 -2
  227. package/dist/modules/workflows/backend/events/[id]/page.js +1 -1
  228. package/dist/modules/workflows/backend/events/[id]/page.js.map +2 -2
  229. package/dist/modules/workflows/backend/events/[id]/page.meta.js +2 -2
  230. package/dist/modules/workflows/backend/events/[id]/page.meta.js.map +2 -2
  231. package/dist/modules/workflows/backend/instances/[id]/page.meta.js +2 -2
  232. package/dist/modules/workflows/backend/instances/[id]/page.meta.js.map +2 -2
  233. package/dist/modules/workflows/backend/instances/page.js +0 -3
  234. package/dist/modules/workflows/backend/instances/page.js.map +2 -2
  235. package/dist/modules/workflows/backend/tasks/[id]/page.js +1 -1
  236. package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
  237. package/dist/modules/workflows/backend/tasks/[id]/page.meta.js +2 -2
  238. package/dist/modules/workflows/backend/tasks/[id]/page.meta.js.map +2 -2
  239. package/dist/modules/workflows/backend/tasks/page.js +5 -9
  240. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  241. package/dist/modules/workflows/cli.js +93 -15
  242. package/dist/modules/workflows/cli.js.map +3 -3
  243. package/dist/modules/workflows/components/DefinitionTriggersEditor.js +481 -0
  244. package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +7 -0
  245. package/dist/modules/workflows/components/EventTriggersEditor.js +553 -0
  246. package/dist/modules/workflows/components/EventTriggersEditor.js.map +7 -0
  247. package/dist/modules/workflows/data/entities.js +64 -1
  248. package/dist/modules/workflows/data/entities.js.map +2 -2
  249. package/dist/modules/workflows/data/validators.js +115 -0
  250. package/dist/modules/workflows/data/validators.js.map +2 -2
  251. package/dist/modules/workflows/events.js +38 -0
  252. package/dist/modules/workflows/events.js.map +7 -0
  253. package/dist/modules/workflows/examples/checkout-demo-definition.json +1 -5
  254. package/dist/modules/workflows/examples/order-approval-definition.json +257 -0
  255. package/dist/modules/workflows/examples/order-approval-guard-rules.json +32 -0
  256. package/dist/modules/workflows/lib/activity-executor.js +75 -13
  257. package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
  258. package/dist/modules/workflows/lib/event-trigger-service.js +308 -0
  259. package/dist/modules/workflows/lib/event-trigger-service.js.map +7 -0
  260. package/dist/modules/workflows/lib/graph-utils.js +71 -2
  261. package/dist/modules/workflows/lib/graph-utils.js.map +2 -2
  262. package/dist/modules/workflows/lib/seeds.js +22 -5
  263. package/dist/modules/workflows/lib/seeds.js.map +2 -2
  264. package/dist/modules/workflows/lib/start-validator.js +33 -23
  265. package/dist/modules/workflows/lib/start-validator.js.map +2 -2
  266. package/dist/modules/workflows/lib/transition-handler.js +161 -57
  267. package/dist/modules/workflows/lib/transition-handler.js.map +3 -3
  268. package/dist/modules/workflows/migrations/Migration20260123143500.js +36 -0
  269. package/dist/modules/workflows/migrations/Migration20260123143500.js.map +7 -0
  270. package/dist/modules/workflows/subscribers/event-trigger.js +78 -0
  271. package/dist/modules/workflows/subscribers/event-trigger.js.map +7 -0
  272. package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js +323 -0
  273. package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js.map +7 -0
  274. package/dist/modules/workflows/widgets/injection/order-approval/widget.js +17 -0
  275. package/dist/modules/workflows/widgets/injection/order-approval/widget.js.map +7 -0
  276. package/dist/modules/workflows/widgets/injection-table.js +19 -0
  277. package/dist/modules/workflows/widgets/injection-table.js.map +7 -0
  278. package/generated/entities/workflow_event_trigger/index.ts +15 -0
  279. package/generated/entities.ids.generated.ts +2 -5
  280. package/generated/entity-fields-registry.ts +2 -2
  281. package/package.json +2 -2
  282. package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
  283. package/src/modules/api_keys/backend/api-keys/page.tsx +1 -1
  284. package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -4
  285. package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +0 -2
  286. package/src/modules/auth/README.md +1 -1
  287. package/src/modules/auth/__tests__/cli-setup-acl.test.ts +1 -1
  288. package/src/modules/auth/api/__tests__/login.test.ts +0 -2
  289. package/src/modules/auth/api/admin/nav.ts +6 -10
  290. package/src/modules/auth/api/login.ts +7 -26
  291. package/src/modules/auth/api/reset/confirm.ts +2 -25
  292. package/src/modules/auth/api/reset.ts +0 -23
  293. package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
  294. package/src/modules/auth/api/users/route.ts +2 -5
  295. package/src/modules/auth/backend/roles/[id]/edit/page.tsx +1 -4
  296. package/src/modules/auth/backend/roles/page.tsx +3 -3
  297. package/src/modules/auth/backend/users/[id]/edit/page.tsx +3 -22
  298. package/src/modules/auth/backend/users/create/page.tsx +2 -19
  299. package/src/modules/auth/backend/users/page.tsx +3 -3
  300. package/src/modules/auth/cli.ts +11 -38
  301. package/src/modules/auth/commands/users.ts +2 -73
  302. package/src/modules/auth/data/validators.ts +2 -6
  303. package/src/modules/auth/events.ts +39 -0
  304. package/src/modules/auth/frontend/login.tsx +5 -131
  305. package/src/modules/auth/frontend/reset/[token]/page.tsx +11 -24
  306. package/src/modules/auth/i18n/de.json +1 -48
  307. package/src/modules/auth/i18n/en.json +1 -48
  308. package/src/modules/auth/i18n/es.json +1 -48
  309. package/src/modules/auth/i18n/pl.json +1 -48
  310. package/src/modules/auth/lib/setup-app.ts +9 -58
  311. package/src/modules/auth/services/authService.ts +4 -27
  312. package/src/modules/business_rules/api/execute/[ruleId]/route.ts +163 -0
  313. package/src/modules/business_rules/api/execute/route.ts +1 -8
  314. package/src/modules/business_rules/backend/rules/page.tsx +0 -4
  315. package/src/modules/business_rules/backend/sets/page.tsx +0 -3
  316. package/src/modules/business_rules/cli.ts +1 -2
  317. package/src/modules/business_rules/data/validators.ts +40 -0
  318. package/src/modules/business_rules/i18n/en.json +1 -3
  319. package/src/modules/business_rules/index.ts +25 -0
  320. package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -51
  321. package/src/modules/business_rules/lib/rule-engine.ts +277 -51
  322. package/src/modules/catalog/components/PriceKindSettings.tsx +0 -2
  323. package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +2 -2
  324. package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -2
  325. package/src/modules/catalog/events.ts +45 -0
  326. package/src/modules/catalog/i18n/en.json +1 -3
  327. package/src/modules/configs/cli.ts +0 -6
  328. package/src/modules/configs/components/CachePanel.tsx +4 -4
  329. package/src/modules/configs/i18n/en.json +2 -12
  330. package/src/modules/configs/i18n/pl.json +2 -12
  331. package/src/modules/configs/lib/system-status.ts +1 -48
  332. package/src/modules/configs/lib/system-status.types.ts +0 -1
  333. package/src/modules/configs/lib/upgrade-actions.ts +0 -18
  334. package/src/modules/currencies/backend/currencies/page.tsx +0 -3
  335. package/src/modules/currencies/backend/exchange-rates/page.tsx +0 -2
  336. package/src/modules/customers/backend/customers/companies/page.tsx +0 -3
  337. package/src/modules/customers/backend/customers/deals/page.tsx +0 -3
  338. package/src/modules/customers/backend/customers/people/page.tsx +0 -3
  339. package/src/modules/customers/commands/deals.ts +0 -39
  340. package/src/modules/customers/components/CustomerTodosTable.tsx +0 -1
  341. package/src/modules/customers/events.ts +63 -0
  342. package/src/modules/customers/i18n/en.json +1 -5
  343. package/src/modules/customers/widgets/dashboard/customer-todos/widget.ts +2 -2
  344. package/src/modules/customers/widgets/dashboard/new-customers/widget.ts +2 -2
  345. package/src/modules/customers/widgets/dashboard/new-deals/widget.ts +2 -2
  346. package/src/modules/customers/widgets/dashboard/next-interactions/widget.ts +2 -2
  347. package/src/modules/dashboards/cli.ts +5 -55
  348. package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +11 -22
  349. package/src/modules/dashboards/services/widgetDataService.ts +4 -164
  350. package/src/modules/dashboards/widgets/dashboard/aov-kpi/widget.ts +2 -2
  351. package/src/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.ts +2 -2
  352. package/src/modules/dashboards/widgets/dashboard/orders-by-status/widget.ts +2 -2
  353. package/src/modules/dashboards/widgets/dashboard/orders-kpi/widget.ts +2 -2
  354. package/src/modules/dashboards/widgets/dashboard/pipeline-summary/widget.ts +2 -2
  355. package/src/modules/dashboards/widgets/dashboard/revenue-kpi/widget.ts +2 -2
  356. package/src/modules/dashboards/widgets/dashboard/revenue-trend/widget.ts +2 -2
  357. package/src/modules/dashboards/widgets/dashboard/sales-by-region/widget.ts +2 -2
  358. package/src/modules/dashboards/widgets/dashboard/top-customers/widget.ts +2 -2
  359. package/src/modules/dashboards/widgets/dashboard/top-products/widget.ts +2 -2
  360. package/src/modules/dictionaries/components/DictionaryTable.tsx +0 -2
  361. package/src/modules/directory/backend/directory/organizations/page.tsx +2 -2
  362. package/src/modules/directory/backend/directory/tenants/page.tsx +2 -2
  363. package/src/modules/directory/events.ts +31 -0
  364. package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +2 -2
  365. package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -1
  366. package/src/modules/entities/components/UserEntitiesTable.tsx +2 -2
  367. package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +4 -3
  368. package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -1
  369. package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +2 -2
  370. package/src/modules/query_index/cli.ts +13 -82
  371. package/src/modules/query_index/components/QueryIndexesTable.tsx +2 -8
  372. package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -2
  373. package/src/modules/resources/backend/resources/resources/page.tsx +2 -2
  374. package/src/modules/sales/acl.ts +1 -0
  375. package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -2
  376. package/src/modules/sales/backend/sales/channels/page.tsx +0 -2
  377. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +16 -0
  378. package/src/modules/sales/commands/documents.ts +70 -62
  379. package/src/modules/sales/commands/payments.ts +0 -33
  380. package/src/modules/sales/components/AdjustmentKindSettings.tsx +2 -2
  381. package/src/modules/sales/components/PaymentMethodsSettings.tsx +2 -2
  382. package/src/modules/sales/components/ShippingMethodsSettings.tsx +2 -2
  383. package/src/modules/sales/components/TaxRatesSettings.tsx +2 -2
  384. package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -2
  385. package/src/modules/sales/components/documents/AdjustmentsSection.tsx +0 -2
  386. package/src/modules/sales/components/documents/PaymentsSection.tsx +1 -2
  387. package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +0 -2
  388. package/src/modules/sales/events.ts +82 -0
  389. package/src/modules/sales/i18n/de.json +0 -20
  390. package/src/modules/sales/i18n/en.json +1 -25
  391. package/src/modules/sales/i18n/es.json +0 -20
  392. package/src/modules/sales/i18n/pl.json +0 -20
  393. package/src/modules/sales/lib/dictionaries.ts +3 -0
  394. package/src/modules/sales/lib/frontend/documentDataEvents.ts +28 -0
  395. package/src/modules/staff/backend/staff/team-members/page.tsx +1 -1
  396. package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
  397. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +2 -2
  398. package/src/modules/staff/backend/staff/teams/page.tsx +2 -2
  399. package/src/modules/staff/commands/leave-requests.ts +0 -94
  400. package/src/modules/staff/i18n/de.json +0 -4
  401. package/src/modules/staff/i18n/en.json +1 -9
  402. package/src/modules/staff/i18n/es.json +0 -4
  403. package/src/modules/staff/i18n/pl.json +0 -4
  404. package/src/modules/workflows/acl.ts +2 -0
  405. package/src/modules/workflows/api/__tests__/instances.route.test.ts +5 -2
  406. package/src/modules/workflows/api/instances/route.ts +21 -7
  407. package/src/modules/workflows/api/tasks/route.ts +7 -1
  408. package/src/modules/workflows/backend/definitions/[id]/page.meta.ts +1 -1
  409. package/src/modules/workflows/backend/definitions/[id]/page.tsx +9 -0
  410. package/src/modules/workflows/backend/definitions/create/page.meta.ts +1 -1
  411. package/src/modules/workflows/backend/definitions/create/page.tsx +9 -0
  412. package/src/modules/workflows/backend/definitions/page.tsx +0 -5
  413. package/src/modules/workflows/backend/definitions/visual-editor/page.meta.ts +1 -1
  414. package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +21 -3
  415. package/src/modules/workflows/backend/events/[id]/page.meta.ts +2 -2
  416. package/src/modules/workflows/backend/events/[id]/page.tsx +1 -1
  417. package/src/modules/workflows/backend/instances/[id]/page.meta.ts +2 -2
  418. package/src/modules/workflows/backend/instances/page.tsx +1 -4
  419. package/src/modules/workflows/backend/tasks/[id]/page.meta.ts +2 -2
  420. package/src/modules/workflows/backend/tasks/[id]/page.tsx +1 -1
  421. package/src/modules/workflows/backend/tasks/page.tsx +6 -10
  422. package/src/modules/workflows/cli.ts +123 -12
  423. package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +581 -0
  424. package/src/modules/workflows/components/EventTriggersEditor.tsx +664 -0
  425. package/src/modules/workflows/data/entities.ts +124 -0
  426. package/src/modules/workflows/data/validators.ts +138 -0
  427. package/src/modules/workflows/events.ts +49 -0
  428. package/src/modules/workflows/examples/checkout-demo-definition.json +1 -5
  429. package/src/modules/workflows/examples/order-approval-definition.json +257 -0
  430. package/src/modules/workflows/examples/order-approval-guard-rules.json +32 -0
  431. package/src/modules/workflows/i18n/en.json +72 -3
  432. package/src/modules/workflows/lib/__tests__/activity-executor.test.ts +43 -36
  433. package/src/modules/workflows/lib/__tests__/transition-handler.test.ts +170 -90
  434. package/src/modules/workflows/lib/activity-executor.ts +129 -16
  435. package/src/modules/workflows/lib/event-trigger-service.ts +557 -0
  436. package/src/modules/workflows/lib/graph-utils.ts +117 -2
  437. package/src/modules/workflows/lib/seeds.ts +34 -8
  438. package/src/modules/workflows/lib/start-validator.ts +38 -28
  439. package/src/modules/workflows/lib/transition-handler.ts +212 -71
  440. package/src/modules/workflows/migrations/Migration20260123143500.ts +38 -0
  441. package/src/modules/workflows/subscribers/event-trigger.ts +109 -0
  442. package/src/modules/workflows/widgets/injection/order-approval/widget.client.tsx +446 -0
  443. package/src/modules/workflows/widgets/injection/order-approval/widget.ts +16 -0
  444. package/src/modules/workflows/widgets/injection-table.ts +21 -0
  445. package/dist/generated/entities/notification/index.js +0 -57
  446. package/dist/generated/entities/notification/index.js.map +0 -7
  447. package/dist/modules/auth/api/profile/route.js +0 -157
  448. package/dist/modules/auth/api/profile/route.js.map +0 -7
  449. package/dist/modules/auth/backend/auth/profile/page.js +0 -141
  450. package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
  451. package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -13
  452. package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
  453. package/dist/modules/auth/notifications.js +0 -112
  454. package/dist/modules/auth/notifications.js.map +0 -7
  455. package/dist/modules/business_rules/notifications.js +0 -28
  456. package/dist/modules/business_rules/notifications.js.map +0 -7
  457. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
  458. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
  459. package/dist/modules/catalog/notifications.js +0 -28
  460. package/dist/modules/catalog/notifications.js.map +0 -7
  461. package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
  462. package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
  463. package/dist/modules/customers/notifications.js +0 -48
  464. package/dist/modules/customers/notifications.js.map +0 -7
  465. package/dist/modules/dashboards/lib/role-widgets.js +0 -58
  466. package/dist/modules/dashboards/lib/role-widgets.js.map +0 -7
  467. package/dist/modules/directory/api/get/tenants/lookup.js +0 -70
  468. package/dist/modules/directory/api/get/tenants/lookup.js.map +0 -7
  469. package/dist/modules/notifications/acl.js +0 -11
  470. package/dist/modules/notifications/acl.js.map +0 -7
  471. package/dist/modules/notifications/api/[id]/action/route.js +0 -74
  472. package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
  473. package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
  474. package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
  475. package/dist/modules/notifications/api/[id]/read/route.js +0 -15
  476. package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
  477. package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
  478. package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
  479. package/dist/modules/notifications/api/batch/route.js +0 -17
  480. package/dist/modules/notifications/api/batch/route.js.map +0 -7
  481. package/dist/modules/notifications/api/feature/route.js +0 -17
  482. package/dist/modules/notifications/api/feature/route.js.map +0 -7
  483. package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
  484. package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
  485. package/dist/modules/notifications/api/openapi.js +0 -76
  486. package/dist/modules/notifications/api/openapi.js.map +0 -7
  487. package/dist/modules/notifications/api/role/route.js +0 -17
  488. package/dist/modules/notifications/api/role/route.js.map +0 -7
  489. package/dist/modules/notifications/api/route.js +0 -85
  490. package/dist/modules/notifications/api/route.js.map +0 -7
  491. package/dist/modules/notifications/api/settings/route.js +0 -155
  492. package/dist/modules/notifications/api/settings/route.js.map +0 -7
  493. package/dist/modules/notifications/api/unread-count/route.js +0 -38
  494. package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
  495. package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
  496. package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
  497. package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
  498. package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
  499. package/dist/modules/notifications/cli.js +0 -16
  500. package/dist/modules/notifications/cli.js.map +0 -7
  501. package/dist/modules/notifications/data/entities.js +0 -112
  502. package/dist/modules/notifications/data/entities.js.map +0 -7
  503. package/dist/modules/notifications/data/validators.js +0 -98
  504. package/dist/modules/notifications/data/validators.js.map +0 -7
  505. package/dist/modules/notifications/di.js +0 -13
  506. package/dist/modules/notifications/di.js.map +0 -7
  507. package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
  508. package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
  509. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
  510. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
  511. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -220
  512. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
  513. package/dist/modules/notifications/index.js +0 -14
  514. package/dist/modules/notifications/index.js.map +0 -7
  515. package/dist/modules/notifications/lib/deliveryConfig.js +0 -107
  516. package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
  517. package/dist/modules/notifications/lib/deliveryStrategies.js +0 -14
  518. package/dist/modules/notifications/lib/deliveryStrategies.js.map +0 -7
  519. package/dist/modules/notifications/lib/events.js +0 -12
  520. package/dist/modules/notifications/lib/events.js.map +0 -7
  521. package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
  522. package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
  523. package/dist/modules/notifications/lib/notificationFactory.js +0 -54
  524. package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
  525. package/dist/modules/notifications/lib/notificationMapper.js +0 -34
  526. package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
  527. package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
  528. package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
  529. package/dist/modules/notifications/lib/notificationService.js +0 -279
  530. package/dist/modules/notifications/lib/notificationService.js.map +0 -7
  531. package/dist/modules/notifications/lib/routeHelpers.js +0 -101
  532. package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
  533. package/dist/modules/notifications/lib/safeHref.js +0 -24
  534. package/dist/modules/notifications/lib/safeHref.js.map +0 -7
  535. package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
  536. package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
  537. package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
  538. package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
  539. package/dist/modules/notifications/migrations/Migration20260129082610.js +0 -13
  540. package/dist/modules/notifications/migrations/Migration20260129082610.js.map +0 -7
  541. package/dist/modules/notifications/subscribers/deliver-notification.js +0 -165
  542. package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
  543. package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
  544. package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
  545. package/dist/modules/sales/notifications.client.js +0 -51
  546. package/dist/modules/sales/notifications.client.js.map +0 -7
  547. package/dist/modules/sales/notifications.js +0 -88
  548. package/dist/modules/sales/notifications.js.map +0 -7
  549. package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
  550. package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
  551. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
  552. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
  553. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
  554. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
  555. package/dist/modules/sales/widgets/notifications/index.js +0 -7
  556. package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
  557. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
  558. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
  559. package/dist/modules/staff/notifications.js +0 -75
  560. package/dist/modules/staff/notifications.js.map +0 -7
  561. package/dist/modules/workflows/notifications.js +0 -28
  562. package/dist/modules/workflows/notifications.js.map +0 -7
  563. package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
  564. package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
  565. package/generated/entities/notification/index.ts +0 -27
  566. package/src/modules/auth/api/profile/route.ts +0 -163
  567. package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -9
  568. package/src/modules/auth/backend/auth/profile/page.tsx +0 -174
  569. package/src/modules/auth/notifications.ts +0 -109
  570. package/src/modules/business_rules/notifications.ts +0 -25
  571. package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
  572. package/src/modules/catalog/notifications.ts +0 -25
  573. package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
  574. package/src/modules/customers/notifications.ts +0 -44
  575. package/src/modules/dashboards/lib/role-widgets.ts +0 -80
  576. package/src/modules/directory/api/get/tenants/lookup.ts +0 -75
  577. package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -195
  578. package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
  579. package/src/modules/notifications/__tests__/notificationService.test.ts +0 -208
  580. package/src/modules/notifications/acl.ts +0 -7
  581. package/src/modules/notifications/api/[id]/action/route.ts +0 -75
  582. package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
  583. package/src/modules/notifications/api/[id]/read/route.ts +0 -12
  584. package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
  585. package/src/modules/notifications/api/batch/route.ts +0 -14
  586. package/src/modules/notifications/api/feature/route.ts +0 -14
  587. package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
  588. package/src/modules/notifications/api/openapi.ts +0 -76
  589. package/src/modules/notifications/api/role/route.ts +0 -14
  590. package/src/modules/notifications/api/route.ts +0 -92
  591. package/src/modules/notifications/api/settings/route.ts +0 -157
  592. package/src/modules/notifications/api/unread-count/route.ts +0 -38
  593. package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
  594. package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
  595. package/src/modules/notifications/cli.ts +0 -18
  596. package/src/modules/notifications/data/entities.ts +0 -99
  597. package/src/modules/notifications/data/validators.ts +0 -115
  598. package/src/modules/notifications/di.ts +0 -11
  599. package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
  600. package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
  601. package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -233
  602. package/src/modules/notifications/i18n/de.json +0 -50
  603. package/src/modules/notifications/i18n/en.json +0 -50
  604. package/src/modules/notifications/i18n/es.json +0 -50
  605. package/src/modules/notifications/i18n/pl.json +0 -50
  606. package/src/modules/notifications/index.ts +0 -12
  607. package/src/modules/notifications/lib/deliveryConfig.ts +0 -153
  608. package/src/modules/notifications/lib/deliveryStrategies.ts +0 -50
  609. package/src/modules/notifications/lib/events.ts +0 -48
  610. package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
  611. package/src/modules/notifications/lib/notificationFactory.ts +0 -76
  612. package/src/modules/notifications/lib/notificationMapper.ts +0 -33
  613. package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
  614. package/src/modules/notifications/lib/notificationService.ts +0 -414
  615. package/src/modules/notifications/lib/routeHelpers.ts +0 -151
  616. package/src/modules/notifications/lib/safeHref.ts +0 -29
  617. package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -336
  618. package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
  619. package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
  620. package/src/modules/notifications/migrations/Migration20260129082610.ts +0 -13
  621. package/src/modules/notifications/subscribers/deliver-notification.ts +0 -204
  622. package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
  623. package/src/modules/sales/notifications.client.ts +0 -65
  624. package/src/modules/sales/notifications.ts +0 -82
  625. package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
  626. package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
  627. package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
  628. package/src/modules/sales/widgets/notifications/index.ts +0 -2
  629. package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
  630. package/src/modules/staff/notifications.ts +0 -71
  631. package/src/modules/workflows/notifications.ts +0 -25
  632. package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/catalog/components/PriceKindSettings.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { DictionaryEntrySelect } from '@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect'\nimport { useCurrencyDictionary } from '@open-mercato/core/modules/customers/components/detail/hooks/useCurrencyDictionary'\nimport type { DictionaryOption } from '@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect'\nimport type { CatalogPriceDisplayMode } from '../data/types'\n\ntype PriceKind = {\n id: string\n code: string\n title: string\n displayMode: CatalogPriceDisplayMode\n currencyCode: string | null\n isPromotion: boolean\n isActive: boolean\n createdAt: string\n updatedAt: string\n}\n\ntype DialogState =\n | { mode: 'create' }\n | { mode: 'edit'; entry: PriceKind }\n\ntype PriceKindApiPayload = Partial<PriceKind> & {\n display_mode?: PriceKind['displayMode']\n currency_code?: string | null\n is_promotion?: boolean\n is_active?: boolean\n created_at?: string\n updated_at?: string\n}\n\nconst DISPLAY_MODES: Array<{ value: 'including-tax' | 'excluding-tax'; label: string }> = [\n { value: 'excluding-tax', label: 'Excluding tax' },\n { value: 'including-tax', label: 'Including tax' },\n]\n\nconst PAGE_SIZE = 100\n\ntype PriceKindFormState = {\n code: string\n title: string\n displayMode: CatalogPriceDisplayMode\n currencyCode: string\n isPromotion: boolean\n isActive: boolean\n}\n\nconst DEFAULT_FORM: PriceKindFormState = {\n code: '',\n title: '',\n displayMode: 'excluding-tax' as const,\n currencyCode: '',\n isPromotion: false,\n isActive: true,\n}\n\nconst normalizePriceKind = (input: PriceKindApiPayload | null | undefined): PriceKind => {\n const raw = input ?? {}\n const toStringValue = (value: unknown): string | null => {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'bigint') return String(value)\n return null\n }\n const toBooleanValue = (value: unknown): boolean | null => (typeof value === 'boolean' ? value : null)\n const resolveDisplayMode = (value: string | null): PriceKind['displayMode'] =>\n value === 'including-tax' ? 'including-tax' : value === 'excluding-tax' ? 'excluding-tax' : 'excluding-tax'\n\n const displayMode = resolveDisplayMode(\n toStringValue(raw.displayMode) ?? toStringValue(raw.display_mode),\n )\n const currencyCode = toStringValue(raw.currencyCode) ?? toStringValue(raw.currency_code)\n const isPromotion = toBooleanValue(raw.isPromotion) ?? toBooleanValue(raw.is_promotion)\n const isActive = toBooleanValue(raw.isActive) ?? toBooleanValue(raw.is_active)\n\n return {\n id: toStringValue(raw.id) ?? '',\n code: toStringValue(raw.code) ?? '',\n title: toStringValue(raw.title) ?? '',\n displayMode,\n currencyCode: currencyCode ?? null,\n isPromotion: isPromotion ?? false,\n isActive: isActive ?? true,\n createdAt: toStringValue(raw.createdAt) ?? toStringValue(raw.created_at) ?? '',\n updatedAt: toStringValue(raw.updatedAt) ?? toStringValue(raw.updated_at) ?? '',\n }\n}\n\nexport function PriceKindSettings() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [items, setItems] = React.useState<PriceKind[]>([])\n const [loading, setLoading] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const [dialog, setDialog] = React.useState<DialogState | null>(null)\n const [form, setForm] = React.useState<PriceKindFormState>(DEFAULT_FORM)\n const [submitting, setSubmitting] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const { data: currencyDictionary, refetch: refetchCurrencyDictionary } = useCurrencyDictionary()\n\n const currencyOptionsLoader = React.useCallback(async (): Promise<DictionaryOption[]> => {\n if (currencyDictionary && Array.isArray(currencyDictionary.entries)) {\n return currencyDictionary.entries.map((entry) => ({\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }))\n }\n const payload = await refetchCurrencyDictionary()\n return payload.entries.map((entry) => ({\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }))\n }, [currencyDictionary, refetchCurrencyDictionary])\n\n const loadItems = React.useCallback(async () => {\n setLoading(true)\n const loadErrorMessage = t('catalog.priceKinds.errors.load', 'Failed to load price kinds.')\n try {\n const payload = await readApiResultOrThrow<{ items?: PriceKindApiPayload[] }>(\n `/api/catalog/price-kinds?pageSize=${PAGE_SIZE}`,\n undefined,\n { errorMessage: loadErrorMessage },\n )\n const normalized = Array.isArray(payload.items) ? payload.items.map((item) => normalizePriceKind(item)) : []\n setItems(normalized)\n } catch (err) {\n console.error('catalog.price-kinds.list failed', err)\n flash(loadErrorMessage, 'error')\n } finally {\n setLoading(false)\n }\n }, [t])\n\n React.useEffect(() => {\n loadItems().catch(() => {})\n }, [loadItems, scopeVersion])\n\n const openDialog = React.useCallback((state: DialogState) => {\n if (state.mode === 'edit') {\n setForm({\n code: state.entry.code,\n title: state.entry.title,\n displayMode: state.entry.displayMode,\n currencyCode: state.entry.currencyCode ?? '',\n isPromotion: state.entry.isPromotion,\n isActive: state.entry.isActive,\n })\n } else {\n setForm(DEFAULT_FORM)\n }\n setError(null)\n setDialog(state)\n }, [])\n\n const closeDialog = React.useCallback(() => {\n setDialog(null)\n setError(null)\n setSubmitting(false)\n setForm(DEFAULT_FORM)\n }, [])\n\n const handleSubmit = React.useCallback(async () => {\n if (!dialog) return\n const trimmedCode = form.code.trim().toLowerCase()\n const trimmedTitle = form.title.trim()\n if (!trimmedCode || !trimmedTitle) {\n setError(t('catalog.priceKinds.errors.required', 'Code and title are required.'))\n return\n }\n setSubmitting(true)\n setError(null)\n try {\n const payload = {\n code: trimmedCode,\n title: trimmedTitle,\n displayMode: form.displayMode,\n currencyCode: form.currencyCode.trim() || undefined,\n isPromotion: form.isPromotion,\n isActive: form.isActive,\n }\n const path = '/api/catalog/price-kinds'\n const method = dialog.mode === 'create' ? 'POST' : 'PUT'\n const body =\n dialog.mode === 'edit'\n ? JSON.stringify({ id: dialog.entry.id, ...payload })\n : JSON.stringify(payload)\n const call = await apiCall(path, {\n method,\n headers: { 'content-type': 'application/json' },\n body,\n })\n if (!call.ok) {\n await raiseCrudError(call.response, t('catalog.priceKinds.errors.save', 'Failed to save price kind.'))\n }\n flash(\n dialog.mode === 'create'\n ? t('catalog.priceKinds.messages.created', 'Price kind created.')\n : t('catalog.priceKinds.messages.updated', 'Price kind updated.'),\n 'success',\n )\n closeDialog()\n await loadItems()\n } catch (err) {\n console.error('catalog.price-kinds.save failed', err)\n const message =\n err instanceof Error ? err.message : t('catalog.priceKinds.errors.save', 'Failed to save price kind.')\n setError(message)\n } finally {\n setSubmitting(false)\n }\n }, [dialog, form, t, closeDialog, loadItems])\n\n const handleDelete = React.useCallback(\n async (entry: PriceKind) => {\n const confirmMessage = t('catalog.priceKinds.confirm.delete', 'Delete price kind \"{{code}}\"?').replace('{{code}}', entry.code)\n if (!window.confirm(confirmMessage)) return\n try {\n const call = await apiCall('/api/catalog/price-kinds', {\n method: 'DELETE',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ id: entry.id }),\n })\n if (!call.ok) {\n await raiseCrudError(call.response, t('catalog.priceKinds.errors.delete', 'Failed to delete price kind.'))\n }\n flash(t('catalog.priceKinds.messages.deleted', 'Price kind deleted.'), 'success')\n await loadItems()\n } catch (err) {\n console.error('catalog.price-kinds.delete failed', err)\n const message =\n err instanceof Error ? err.message : t('catalog.priceKinds.errors.delete', 'Failed to delete price kind.')\n flash(message, 'error')\n }\n },\n [loadItems, t],\n )\n\n const formKeyHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLFormElement>) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n void handleSubmit()\n }\n },\n [handleSubmit],\n )\n\n const displayModeLabels = React.useMemo(() => ({\n 'including-tax': t('catalog.priceKinds.form.displayMode.include', 'Including tax'),\n 'excluding-tax': t('catalog.priceKinds.form.displayMode.exclude', 'Excluding tax'),\n }), [t])\n\n const displayModeOptions = React.useMemo(\n () =>\n DISPLAY_MODES.map((mode) => ({\n ...mode,\n label: displayModeLabels[mode.value],\n })),\n [displayModeLabels],\n )\n\n const currencyLabels = React.useMemo(() => ({\n placeholder: t('catalog.priceKinds.form.currency.placeholder', 'Select currency\u2026'),\n addLabel: t('catalog.priceKinds.form.currency.add', 'Add currency'),\n addPrompt: t('catalog.priceKinds.form.currency.addPrompt', 'Provide a currency code.'),\n dialogTitle: t('catalog.priceKinds.form.currency.dialogTitle', 'Add currency'),\n valueLabel: t('catalog.priceKinds.form.currency.valueLabel', 'Currency code'),\n valuePlaceholder: t('catalog.priceKinds.form.currency.valuePlaceholder', 'e.g. USD'),\n labelLabel: t('catalog.priceKinds.form.currency.labelLabel', 'Display label (optional)'),\n labelPlaceholder: t('catalog.priceKinds.form.currency.labelPlaceholder', 'e.g. US Dollar'),\n emptyError: t('catalog.priceKinds.form.currency.required', 'Currency code is required.'),\n cancelLabel: t('catalog.priceKinds.form.currency.cancel', 'Cancel'),\n saveLabel: t('catalog.priceKinds.form.currency.save', 'Save'),\n saveShortcutHint: t('catalog.priceKinds.form.currency.saveShortcut', 'Press Enter to save'),\n successCreateLabel: t('catalog.priceKinds.form.currency.success', 'Currency added.'),\n errorLoad: t('catalog.priceKinds.form.currency.loadError', 'Unable to load currencies.'),\n errorSave: t('catalog.priceKinds.form.currency.createError', 'Unable to add currency.'),\n loadingLabel: t('catalog.priceKinds.form.currency.loading', 'Loading currencies\u2026'),\n manageTitle: t('catalog.priceKinds.form.currency.manage', 'Manage currencies'),\n }), [t])\n\n const tableLabels = React.useMemo(() => ({\n code: t('catalog.priceKinds.table.code', 'Code'),\n title: t('catalog.priceKinds.table.title', 'Title'),\n displayMode: t('catalog.priceKinds.table.displayMode', 'Display mode'),\n currency: t('catalog.priceKinds.table.currency', 'Currency'),\n promotion: t('catalog.priceKinds.table.promotion', 'Promotion'),\n promotionYes: t('catalog.priceKinds.table.promotionYes', 'Yes'),\n promotionNo: t('catalog.priceKinds.table.promotionNo', 'No'),\n active: t('catalog.priceKinds.table.active', 'Active'),\n activeYes: t('catalog.priceKinds.table.activeYes', 'Active'),\n activeNo: t('catalog.priceKinds.table.activeNo', 'Inactive'),\n search: t('catalog.priceKinds.search.placeholder', 'Search by code or title\u2026'),\n empty: t('catalog.priceKinds.table.empty', 'No price kinds yet.'),\n }), [t])\n\n const columns = React.useMemo<ColumnDef<PriceKind>[]>(() => [\n {\n accessorKey: 'code',\n header: tableLabels.code,\n cell: ({ row }) => <span className=\"font-mono uppercase\">{row.original.code}</span>,\n },\n {\n accessorKey: 'title',\n header: tableLabels.title,\n cell: ({ row }) => <span className=\"font-medium\">{row.original.title}</span>,\n },\n {\n accessorKey: 'displayMode',\n header: tableLabels.displayMode,\n cell: ({ row }) => displayModeLabels[row.original.displayMode] ?? row.original.displayMode,\n },\n {\n accessorKey: 'currencyCode',\n header: tableLabels.currency,\n cell: ({ row }) => (row.original.currencyCode ? row.original.currencyCode.toUpperCase() : '\u2014'),\n },\n {\n id: 'promotion',\n header: tableLabels.promotion,\n cell: ({ row }) =>\n row.original.isPromotion ? (\n <span className=\"inline-flex items-center rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-900 dark:border-amber-500/50 dark:bg-amber-500/10 dark:text-amber-100\">\n {tableLabels.promotionYes}\n </span>\n ) : (\n <span className=\"inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium\">\n {tableLabels.promotionNo}\n </span>\n ),\n },\n {\n id: 'active',\n header: tableLabels.active,\n cell: ({ row }) =>\n row.original.isActive ? (\n <span className=\"inline-flex items-center rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-900 dark:border-emerald-500/50 dark:bg-emerald-500/10 dark:text-emerald-100\">\n {tableLabels.activeYes}\n </span>\n ) : (\n <span className=\"inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium\">\n {tableLabels.activeNo}\n </span>\n ),\n },\n ], [displayModeLabels, tableLabels])\n\n const filteredItems = React.useMemo(() => {\n const term = search.trim().toLowerCase()\n if (!term) return items\n return items.filter((item) => {\n const currency = (item.currencyCode ?? '').toLowerCase()\n const modeLabel = (displayModeLabels[item.displayMode] ?? item.displayMode).toLowerCase()\n return (\n item.code.toLowerCase().includes(term) ||\n item.title.toLowerCase().includes(term) ||\n currency.includes(term) ||\n modeLabel.includes(term)\n )\n })\n }, [displayModeLabels, items, search])\n\n const handleRowClick = React.useCallback((entry: PriceKind) => {\n openDialog({ mode: 'edit', entry })\n }, [openDialog])\n\n return (\n <section className=\"border bg-card text-card-foreground shadow-sm\">\n <div className=\"border-b px-6 py-4 space-y-1\">\n <h2 className=\"text-lg font-semibold\">{t('catalog.priceKinds.title', 'Price kinds')}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('catalog.priceKinds.description', 'Configure reusable price kinds that control pricing columns and tax display.')}\n </p>\n </div>\n <div className=\"px-2 py-4 sm:px-4\">\n <DataTable<PriceKind>\n data={filteredItems}\n columns={columns}\n embedded\n isLoading={loading}\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={tableLabels.search}\n emptyState={<p className=\"py-8 text-center text-sm text-muted-foreground\">{tableLabels.empty}</p>}\n actions={(\n <Button size=\"sm\" onClick={() => openDialog({ mode: 'create' })}>\n {t('catalog.priceKinds.actions.add', 'Add price kind')}\n </Button>\n )}\n refreshButton={{\n label: t('catalog.priceKinds.actions.refresh', 'Refresh'),\n onRefresh: () => { void loadItems() },\n isRefreshing: loading,\n }}\n rowActions={(entry) => (\n <RowActions\n items={[\n {\n id: 'edit',\n label: t('catalog.priceKinds.actions.edit', 'Edit'),\n onSelect: () => openDialog({ mode: 'edit', entry }),\n },\n {\n id: 'delete',\n label: t('catalog.priceKinds.actions.delete', 'Delete'),\n destructive: true,\n onSelect: () => { void handleDelete(entry) },\n },\n ]}\n />\n )}\n onRowClick={handleRowClick}\n />\n </div>\n <Dialog open={dialog !== null} onOpenChange={(open) => { if (!open) closeDialog(); }}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.dialog.editTitle', 'Edit price kind')\n : t('catalog.priceKinds.dialog.createTitle', 'Create price kind')}\n </DialogTitle>\n <DialogDescription>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.dialog.editDescription', 'Update labels or tax behavior for this price kind.')\n : t('catalog.priceKinds.dialog.createDescription', 'Define a reusable price kind for product pricing.')}\n </DialogDescription>\n </DialogHeader>\n <form className=\"space-y-4\" onKeyDown={formKeyHandler} onSubmit={(event) => { event.preventDefault(); void handleSubmit() }}>\n <div className=\"space-y-2\">\n <Label htmlFor=\"price-kind-code\">{t('catalog.priceKinds.form.codeLabel', 'Code')}</Label>\n <Input\n id=\"price-kind-code\"\n value={form.code}\n onChange={(event) => setForm((prev) => ({ ...prev, code: event.target.value }))}\n placeholder={t('catalog.priceKinds.form.codePlaceholder', 'e.g. regular')}\n className=\"font-mono uppercase\"\n disabled={dialog?.mode === 'edit'}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"price-kind-title\">{t('catalog.priceKinds.form.titleLabel', 'Title')}</Label>\n <Input\n id=\"price-kind-title\"\n value={form.title}\n onChange={(event) => setForm((prev) => ({ ...prev, title: event.target.value }))}\n placeholder={t('catalog.priceKinds.form.titlePlaceholder', 'e.g. Regular price')}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>{t('catalog.priceKinds.form.displayModeLabel', 'Display mode')}</Label>\n <div className=\"grid gap-2 md:grid-cols-2\">\n {displayModeOptions.map((mode) => (\n <label\n key={mode.value}\n className={`flex cursor-pointer items-center gap-2 rounded-md border p-3 text-sm ${\n form.displayMode === mode.value ? 'border-primary bg-primary/5' : 'border-border'\n }`}\n >\n <input\n type=\"radio\"\n name=\"displayMode\"\n value={mode.value}\n checked={form.displayMode === mode.value}\n onChange={() => setForm((prev) => ({ ...prev, displayMode: mode.value }))}\n />\n <span>{mode.label}</span>\n </label>\n ))}\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label>{t('catalog.priceKinds.form.currencyLabel', 'Currency (optional)')}</Label>\n <DictionaryEntrySelect\n value={form.currencyCode || undefined}\n onChange={(value) => setForm((prev) => ({ ...prev, currencyCode: value ?? '' }))}\n fetchOptions={currencyOptionsLoader}\n labels={currencyLabels}\n allowInlineCreate={false}\n />\n </div>\n <div className=\"flex flex-col gap-2\">\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n className=\"h-4 w-4 rounded border\"\n checked={form.isPromotion}\n onChange={(event) => setForm((prev) => ({ ...prev, isPromotion: event.target.checked }))}\n />\n {t('catalog.priceKinds.form.promotionLabel', 'Mark as promotion')}\n </label>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n className=\"h-4 w-4 rounded border\"\n checked={form.isActive}\n onChange={(event) => setForm((prev) => ({ ...prev, isActive: event.target.checked }))}\n />\n {t('catalog.priceKinds.form.activeLabel', 'Active')}\n </label>\n </div>\n {error ? <p className=\"text-sm text-red-600\">{error}</p> : null}\n </form>\n <DialogFooter>\n <Button variant=\"ghost\" onClick={closeDialog}>\n {t('catalog.priceKinds.actions.cancel', 'Cancel')}\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={submitting}>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.actions.saveChanges', 'Save changes')\n : t('catalog.priceKinds.actions.create', 'Create')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </section>\n )\n}\n"],
5
- "mappings": ";AAoUyB,cAoEnB,YApEmB;AAlUzB,YAAY,WAAW;AAEvB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,SAAS,4BAA4B;AAC9C,SAAS,sBAAsB;AAC/B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AA6BtC,MAAM,gBAAoF;AAAA,EACxF,EAAE,OAAO,iBAAiB,OAAO,gBAAgB;AAAA,EACjD,EAAE,OAAO,iBAAiB,OAAO,gBAAgB;AACnD;AAEA,MAAM,YAAY;AAWlB,MAAM,eAAmC;AAAA,EACvC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,UAAU;AACZ;AAEA,MAAM,qBAAqB,CAAC,UAA6D;AACvF,QAAM,MAAM,SAAS,CAAC;AACtB,QAAM,gB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,gBACC,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,SAAS,KAAK;AAAA,gBACd,UAAU,CAAC,UAAU,QAAQ,CAAC,UAAU,EAAE,GAAG,MAAM,UAAU,MAAM,OAAO,QAAQ,EAAE;AAAA;AAAA,YACtF;AAAA,YACC,EAAE,uCAAuC,QAAQ;AAAA,aACpD;AAAA,WACF;AAAA,QACC,QAAQ,oBAAC,OAAE,WAAU,wBAAwB,iBAAM,IAAO;AAAA,SAC7D;AAAA,MACA,qBAAC,gBACC;AAAA,4BAAC,UAAO,SAAQ,SAAQ,SAAS,aAC9B,YAAE,qCAAqC,QAAQ,GAClD;AAAA,QACA,oBAAC,UAAO,SAAS,MAAM,KAAK,aAAa,GAAG,UAAU,YACnD,kBAAQ,SAAS,SACd,EAAE,0CAA0C,cAAc,IAC1D,EAAE,qCAAqC,QAAQ,GACrD;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { DictionaryEntrySelect } from '@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect'\nimport { useCurrencyDictionary } from '@open-mercato/core/modules/customers/components/detail/hooks/useCurrencyDictionary'\nimport type { DictionaryOption } from '@open-mercato/core/modules/dictionaries/components/DictionaryEntrySelect'\nimport type { CatalogPriceDisplayMode } from '../data/types'\n\ntype PriceKind = {\n id: string\n code: string\n title: string\n displayMode: CatalogPriceDisplayMode\n currencyCode: string | null\n isPromotion: boolean\n isActive: boolean\n createdAt: string\n updatedAt: string\n}\n\ntype DialogState =\n | { mode: 'create' }\n | { mode: 'edit'; entry: PriceKind }\n\ntype PriceKindApiPayload = Partial<PriceKind> & {\n display_mode?: PriceKind['displayMode']\n currency_code?: string | null\n is_promotion?: boolean\n is_active?: boolean\n created_at?: string\n updated_at?: string\n}\n\nconst DISPLAY_MODES: Array<{ value: 'including-tax' | 'excluding-tax'; label: string }> = [\n { value: 'excluding-tax', label: 'Excluding tax' },\n { value: 'including-tax', label: 'Including tax' },\n]\n\nconst PAGE_SIZE = 100\n\ntype PriceKindFormState = {\n code: string\n title: string\n displayMode: CatalogPriceDisplayMode\n currencyCode: string\n isPromotion: boolean\n isActive: boolean\n}\n\nconst DEFAULT_FORM: PriceKindFormState = {\n code: '',\n title: '',\n displayMode: 'excluding-tax' as const,\n currencyCode: '',\n isPromotion: false,\n isActive: true,\n}\n\nconst normalizePriceKind = (input: PriceKindApiPayload | null | undefined): PriceKind => {\n const raw = input ?? {}\n const toStringValue = (value: unknown): string | null => {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'bigint') return String(value)\n return null\n }\n const toBooleanValue = (value: unknown): boolean | null => (typeof value === 'boolean' ? value : null)\n const resolveDisplayMode = (value: string | null): PriceKind['displayMode'] =>\n value === 'including-tax' ? 'including-tax' : value === 'excluding-tax' ? 'excluding-tax' : 'excluding-tax'\n\n const displayMode = resolveDisplayMode(\n toStringValue(raw.displayMode) ?? toStringValue(raw.display_mode),\n )\n const currencyCode = toStringValue(raw.currencyCode) ?? toStringValue(raw.currency_code)\n const isPromotion = toBooleanValue(raw.isPromotion) ?? toBooleanValue(raw.is_promotion)\n const isActive = toBooleanValue(raw.isActive) ?? toBooleanValue(raw.is_active)\n\n return {\n id: toStringValue(raw.id) ?? '',\n code: toStringValue(raw.code) ?? '',\n title: toStringValue(raw.title) ?? '',\n displayMode,\n currencyCode: currencyCode ?? null,\n isPromotion: isPromotion ?? false,\n isActive: isActive ?? true,\n createdAt: toStringValue(raw.createdAt) ?? toStringValue(raw.created_at) ?? '',\n updatedAt: toStringValue(raw.updatedAt) ?? toStringValue(raw.updated_at) ?? '',\n }\n}\n\nexport function PriceKindSettings() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [items, setItems] = React.useState<PriceKind[]>([])\n const [loading, setLoading] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const [dialog, setDialog] = React.useState<DialogState | null>(null)\n const [form, setForm] = React.useState<PriceKindFormState>(DEFAULT_FORM)\n const [submitting, setSubmitting] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const { data: currencyDictionary, refetch: refetchCurrencyDictionary } = useCurrencyDictionary()\n\n const currencyOptionsLoader = React.useCallback(async (): Promise<DictionaryOption[]> => {\n if (currencyDictionary && Array.isArray(currencyDictionary.entries)) {\n return currencyDictionary.entries.map((entry) => ({\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }))\n }\n const payload = await refetchCurrencyDictionary()\n return payload.entries.map((entry) => ({\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }))\n }, [currencyDictionary, refetchCurrencyDictionary])\n\n const loadItems = React.useCallback(async () => {\n setLoading(true)\n const loadErrorMessage = t('catalog.priceKinds.errors.load', 'Failed to load price kinds.')\n try {\n const payload = await readApiResultOrThrow<{ items?: PriceKindApiPayload[] }>(\n `/api/catalog/price-kinds?pageSize=${PAGE_SIZE}`,\n undefined,\n { errorMessage: loadErrorMessage },\n )\n const normalized = Array.isArray(payload.items) ? payload.items.map((item) => normalizePriceKind(item)) : []\n setItems(normalized)\n } catch (err) {\n console.error('catalog.price-kinds.list failed', err)\n flash(loadErrorMessage, 'error')\n } finally {\n setLoading(false)\n }\n }, [t])\n\n React.useEffect(() => {\n loadItems().catch(() => {})\n }, [loadItems, scopeVersion])\n\n const openDialog = React.useCallback((state: DialogState) => {\n if (state.mode === 'edit') {\n setForm({\n code: state.entry.code,\n title: state.entry.title,\n displayMode: state.entry.displayMode,\n currencyCode: state.entry.currencyCode ?? '',\n isPromotion: state.entry.isPromotion,\n isActive: state.entry.isActive,\n })\n } else {\n setForm(DEFAULT_FORM)\n }\n setError(null)\n setDialog(state)\n }, [])\n\n const closeDialog = React.useCallback(() => {\n setDialog(null)\n setError(null)\n setSubmitting(false)\n setForm(DEFAULT_FORM)\n }, [])\n\n const handleSubmit = React.useCallback(async () => {\n if (!dialog) return\n const trimmedCode = form.code.trim().toLowerCase()\n const trimmedTitle = form.title.trim()\n if (!trimmedCode || !trimmedTitle) {\n setError(t('catalog.priceKinds.errors.required', 'Code and title are required.'))\n return\n }\n setSubmitting(true)\n setError(null)\n try {\n const payload = {\n code: trimmedCode,\n title: trimmedTitle,\n displayMode: form.displayMode,\n currencyCode: form.currencyCode.trim() || undefined,\n isPromotion: form.isPromotion,\n isActive: form.isActive,\n }\n const path = '/api/catalog/price-kinds'\n const method = dialog.mode === 'create' ? 'POST' : 'PUT'\n const body =\n dialog.mode === 'edit'\n ? JSON.stringify({ id: dialog.entry.id, ...payload })\n : JSON.stringify(payload)\n const call = await apiCall(path, {\n method,\n headers: { 'content-type': 'application/json' },\n body,\n })\n if (!call.ok) {\n await raiseCrudError(call.response, t('catalog.priceKinds.errors.save', 'Failed to save price kind.'))\n }\n flash(\n dialog.mode === 'create'\n ? t('catalog.priceKinds.messages.created', 'Price kind created.')\n : t('catalog.priceKinds.messages.updated', 'Price kind updated.'),\n 'success',\n )\n closeDialog()\n await loadItems()\n } catch (err) {\n console.error('catalog.price-kinds.save failed', err)\n const message =\n err instanceof Error ? err.message : t('catalog.priceKinds.errors.save', 'Failed to save price kind.')\n setError(message)\n } finally {\n setSubmitting(false)\n }\n }, [dialog, form, t, closeDialog, loadItems])\n\n const handleDelete = React.useCallback(\n async (entry: PriceKind) => {\n const confirmMessage = t('catalog.priceKinds.confirm.delete', 'Delete price kind \"{{code}}\"?').replace('{{code}}', entry.code)\n if (!window.confirm(confirmMessage)) return\n try {\n const call = await apiCall('/api/catalog/price-kinds', {\n method: 'DELETE',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ id: entry.id }),\n })\n if (!call.ok) {\n await raiseCrudError(call.response, t('catalog.priceKinds.errors.delete', 'Failed to delete price kind.'))\n }\n flash(t('catalog.priceKinds.messages.deleted', 'Price kind deleted.'), 'success')\n await loadItems()\n } catch (err) {\n console.error('catalog.price-kinds.delete failed', err)\n const message =\n err instanceof Error ? err.message : t('catalog.priceKinds.errors.delete', 'Failed to delete price kind.')\n flash(message, 'error')\n }\n },\n [loadItems, t],\n )\n\n const formKeyHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLFormElement>) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n void handleSubmit()\n }\n },\n [handleSubmit],\n )\n\n const displayModeLabels = React.useMemo(() => ({\n 'including-tax': t('catalog.priceKinds.form.displayMode.include', 'Including tax'),\n 'excluding-tax': t('catalog.priceKinds.form.displayMode.exclude', 'Excluding tax'),\n }), [t])\n\n const displayModeOptions = React.useMemo(\n () =>\n DISPLAY_MODES.map((mode) => ({\n ...mode,\n label: displayModeLabels[mode.value],\n })),\n [displayModeLabels],\n )\n\n const currencyLabels = React.useMemo(() => ({\n placeholder: t('catalog.priceKinds.form.currency.placeholder', 'Select currency\u2026'),\n addLabel: t('catalog.priceKinds.form.currency.add', 'Add currency'),\n addPrompt: t('catalog.priceKinds.form.currency.addPrompt', 'Provide a currency code.'),\n dialogTitle: t('catalog.priceKinds.form.currency.dialogTitle', 'Add currency'),\n valueLabel: t('catalog.priceKinds.form.currency.valueLabel', 'Currency code'),\n valuePlaceholder: t('catalog.priceKinds.form.currency.valuePlaceholder', 'e.g. USD'),\n labelLabel: t('catalog.priceKinds.form.currency.labelLabel', 'Display label (optional)'),\n labelPlaceholder: t('catalog.priceKinds.form.currency.labelPlaceholder', 'e.g. US Dollar'),\n emptyError: t('catalog.priceKinds.form.currency.required', 'Currency code is required.'),\n cancelLabel: t('catalog.priceKinds.form.currency.cancel', 'Cancel'),\n saveLabel: t('catalog.priceKinds.form.currency.save', 'Save'),\n saveShortcutHint: t('catalog.priceKinds.form.currency.saveShortcut', 'Press Enter to save'),\n successCreateLabel: t('catalog.priceKinds.form.currency.success', 'Currency added.'),\n errorLoad: t('catalog.priceKinds.form.currency.loadError', 'Unable to load currencies.'),\n errorSave: t('catalog.priceKinds.form.currency.createError', 'Unable to add currency.'),\n loadingLabel: t('catalog.priceKinds.form.currency.loading', 'Loading currencies\u2026'),\n manageTitle: t('catalog.priceKinds.form.currency.manage', 'Manage currencies'),\n }), [t])\n\n const tableLabels = React.useMemo(() => ({\n code: t('catalog.priceKinds.table.code', 'Code'),\n title: t('catalog.priceKinds.table.title', 'Title'),\n displayMode: t('catalog.priceKinds.table.displayMode', 'Display mode'),\n currency: t('catalog.priceKinds.table.currency', 'Currency'),\n promotion: t('catalog.priceKinds.table.promotion', 'Promotion'),\n promotionYes: t('catalog.priceKinds.table.promotionYes', 'Yes'),\n promotionNo: t('catalog.priceKinds.table.promotionNo', 'No'),\n active: t('catalog.priceKinds.table.active', 'Active'),\n activeYes: t('catalog.priceKinds.table.activeYes', 'Active'),\n activeNo: t('catalog.priceKinds.table.activeNo', 'Inactive'),\n search: t('catalog.priceKinds.search.placeholder', 'Search by code or title\u2026'),\n empty: t('catalog.priceKinds.table.empty', 'No price kinds yet.'),\n }), [t])\n\n const columns = React.useMemo<ColumnDef<PriceKind>[]>(() => [\n {\n accessorKey: 'code',\n header: tableLabels.code,\n cell: ({ row }) => <span className=\"font-mono uppercase\">{row.original.code}</span>,\n },\n {\n accessorKey: 'title',\n header: tableLabels.title,\n cell: ({ row }) => <span className=\"font-medium\">{row.original.title}</span>,\n },\n {\n accessorKey: 'displayMode',\n header: tableLabels.displayMode,\n cell: ({ row }) => displayModeLabels[row.original.displayMode] ?? row.original.displayMode,\n },\n {\n accessorKey: 'currencyCode',\n header: tableLabels.currency,\n cell: ({ row }) => (row.original.currencyCode ? row.original.currencyCode.toUpperCase() : '\u2014'),\n },\n {\n id: 'promotion',\n header: tableLabels.promotion,\n cell: ({ row }) =>\n row.original.isPromotion ? (\n <span className=\"inline-flex items-center rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-900 dark:border-amber-500/50 dark:bg-amber-500/10 dark:text-amber-100\">\n {tableLabels.promotionYes}\n </span>\n ) : (\n <span className=\"inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium\">\n {tableLabels.promotionNo}\n </span>\n ),\n },\n {\n id: 'active',\n header: tableLabels.active,\n cell: ({ row }) =>\n row.original.isActive ? (\n <span className=\"inline-flex items-center rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-900 dark:border-emerald-500/50 dark:bg-emerald-500/10 dark:text-emerald-100\">\n {tableLabels.activeYes}\n </span>\n ) : (\n <span className=\"inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium\">\n {tableLabels.activeNo}\n </span>\n ),\n },\n ], [displayModeLabels, tableLabels])\n\n const filteredItems = React.useMemo(() => {\n const term = search.trim().toLowerCase()\n if (!term) return items\n return items.filter((item) => {\n const currency = (item.currencyCode ?? '').toLowerCase()\n const modeLabel = (displayModeLabels[item.displayMode] ?? item.displayMode).toLowerCase()\n return (\n item.code.toLowerCase().includes(term) ||\n item.title.toLowerCase().includes(term) ||\n currency.includes(term) ||\n modeLabel.includes(term)\n )\n })\n }, [displayModeLabels, items, search])\n\n const handleRowClick = React.useCallback((entry: PriceKind) => {\n openDialog({ mode: 'edit', entry })\n }, [openDialog])\n\n return (\n <section className=\"border bg-card text-card-foreground shadow-sm\">\n <div className=\"border-b px-6 py-4 space-y-1\">\n <h2 className=\"text-lg font-semibold\">{t('catalog.priceKinds.title', 'Price kinds')}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('catalog.priceKinds.description', 'Configure reusable price kinds that control pricing columns and tax display.')}\n </p>\n </div>\n <div className=\"px-2 py-4 sm:px-4\">\n <DataTable<PriceKind>\n data={filteredItems}\n columns={columns}\n embedded\n isLoading={loading}\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={tableLabels.search}\n emptyState={<p className=\"py-8 text-center text-sm text-muted-foreground\">{tableLabels.empty}</p>}\n actions={(\n <Button size=\"sm\" onClick={() => openDialog({ mode: 'create' })}>\n {t('catalog.priceKinds.actions.add', 'Add price kind')}\n </Button>\n )}\n refreshButton={{\n label: t('catalog.priceKinds.actions.refresh', 'Refresh'),\n onRefresh: () => { void loadItems() },\n isRefreshing: loading,\n }}\n rowActions={(entry) => (\n <RowActions\n items={[\n {\n label: t('catalog.priceKinds.actions.edit', 'Edit'),\n onSelect: () => openDialog({ mode: 'edit', entry }),\n },\n {\n label: t('catalog.priceKinds.actions.delete', 'Delete'),\n destructive: true,\n onSelect: () => { void handleDelete(entry) },\n },\n ]}\n />\n )}\n onRowClick={handleRowClick}\n />\n </div>\n <Dialog open={dialog !== null} onOpenChange={(open) => { if (!open) closeDialog(); }}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.dialog.editTitle', 'Edit price kind')\n : t('catalog.priceKinds.dialog.createTitle', 'Create price kind')}\n </DialogTitle>\n <DialogDescription>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.dialog.editDescription', 'Update labels or tax behavior for this price kind.')\n : t('catalog.priceKinds.dialog.createDescription', 'Define a reusable price kind for product pricing.')}\n </DialogDescription>\n </DialogHeader>\n <form className=\"space-y-4\" onKeyDown={formKeyHandler} onSubmit={(event) => { event.preventDefault(); void handleSubmit() }}>\n <div className=\"space-y-2\">\n <Label htmlFor=\"price-kind-code\">{t('catalog.priceKinds.form.codeLabel', 'Code')}</Label>\n <Input\n id=\"price-kind-code\"\n value={form.code}\n onChange={(event) => setForm((prev) => ({ ...prev, code: event.target.value }))}\n placeholder={t('catalog.priceKinds.form.codePlaceholder', 'e.g. regular')}\n className=\"font-mono uppercase\"\n disabled={dialog?.mode === 'edit'}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"price-kind-title\">{t('catalog.priceKinds.form.titleLabel', 'Title')}</Label>\n <Input\n id=\"price-kind-title\"\n value={form.title}\n onChange={(event) => setForm((prev) => ({ ...prev, title: event.target.value }))}\n placeholder={t('catalog.priceKinds.form.titlePlaceholder', 'e.g. Regular price')}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>{t('catalog.priceKinds.form.displayModeLabel', 'Display mode')}</Label>\n <div className=\"grid gap-2 md:grid-cols-2\">\n {displayModeOptions.map((mode) => (\n <label\n key={mode.value}\n className={`flex cursor-pointer items-center gap-2 rounded-md border p-3 text-sm ${\n form.displayMode === mode.value ? 'border-primary bg-primary/5' : 'border-border'\n }`}\n >\n <input\n type=\"radio\"\n name=\"displayMode\"\n value={mode.value}\n checked={form.displayMode === mode.value}\n onChange={() => setForm((prev) => ({ ...prev, displayMode: mode.value }))}\n />\n <span>{mode.label}</span>\n </label>\n ))}\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label>{t('catalog.priceKinds.form.currencyLabel', 'Currency (optional)')}</Label>\n <DictionaryEntrySelect\n value={form.currencyCode || undefined}\n onChange={(value) => setForm((prev) => ({ ...prev, currencyCode: value ?? '' }))}\n fetchOptions={currencyOptionsLoader}\n labels={currencyLabels}\n allowInlineCreate={false}\n />\n </div>\n <div className=\"flex flex-col gap-2\">\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n className=\"h-4 w-4 rounded border\"\n checked={form.isPromotion}\n onChange={(event) => setForm((prev) => ({ ...prev, isPromotion: event.target.checked }))}\n />\n {t('catalog.priceKinds.form.promotionLabel', 'Mark as promotion')}\n </label>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n className=\"h-4 w-4 rounded border\"\n checked={form.isActive}\n onChange={(event) => setForm((prev) => ({ ...prev, isActive: event.target.checked }))}\n />\n {t('catalog.priceKinds.form.activeLabel', 'Active')}\n </label>\n </div>\n {error ? <p className=\"text-sm text-red-600\">{error}</p> : null}\n </form>\n <DialogFooter>\n <Button variant=\"ghost\" onClick={closeDialog}>\n {t('catalog.priceKinds.actions.cancel', 'Cancel')}\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={submitting}>\n {dialog?.mode === 'edit'\n ? t('catalog.priceKinds.actions.saveChanges', 'Save changes')\n : t('catalog.priceKinds.actions.create', 'Create')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </section>\n )\n}\n"],
5
+ "mappings": ";AAoUyB,cAoEnB,YApEmB;AAlUzB,YAAY,WAAW;AAEvB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,SAAS,4BAA4B;AAC9C,SAAS,sBAAsB;AAC/B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AA6BtC,MAAM,gBAAoF;AAAA,EACxF,EAAE,OAAO,iBAAiB,OAAO,gBAAgB;AAAA,EACjD,EAAE,OAAO,iBAAiB,OAAO,gBAAgB;AACnD;AAEA,MAAM,YAAY;AAWlB,MAAM,eAAmC;AAAA,EACvC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AAAA,EACb,UAAU;AACZ;AAEA,MAAM,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AAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,SAAS,KAAK;AAAA,gBACd,UAAU,CAAC,UAAU,QAAQ,CAAC,UAAU,EAAE,GAAG,MAAM,UAAU,MAAM,OAAO,QAAQ,EAAE;AAAA;AAAA,YACtF;AAAA,YACC,EAAE,uCAAuC,QAAQ;AAAA,aACpD;AAAA,WACF;AAAA,QACC,QAAQ,oBAAC,OAAE,WAAU,wBAAwB,iBAAM,IAAO;AAAA,SAC7D;AAAA,MACA,qBAAC,gBACC;AAAA,4BAAC,UAAO,SAAQ,SAAQ,SAAS,aAC9B,YAAE,qCAAqC,QAAQ,GAClD;AAAA,QACA,oBAAC,UAAO,SAAS,MAAM,KAAK,aAAa,GAAG,UAAU,YACnD,kBAAQ,SAAS,SACd,EAAE,0CAA0C,cAAc,IAC1D,EAAE,qCAAqC,QAAQ,GACrD;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -178,8 +178,8 @@ function CategoriesDataTable() {
178
178
  RowActions,
179
179
  {
180
180
  items: [
181
- { id: "edit", label: t("catalog.categories.list.actions.edit", "Edit"), href: `/backend/catalog/categories/${row.id}/edit` },
182
- { id: "delete", label: t("catalog.categories.list.actions.delete", "Delete"), destructive: true, onSelect: () => handleDelete(row) }
181
+ { label: t("catalog.categories.list.actions.edit", "Edit"), href: `/backend/catalog/categories/${row.id}/edit` },
182
+ { label: t("catalog.categories.list.actions.delete", "Delete"), destructive: true, onSelect: () => handleDelete(row) }
183
183
  ]
184
184
  }
185
185
  ) : null,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/catalog/components/categories/CategoriesDataTable.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { apiCall, apiCallOrThrow, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { formatCategoryTreeLabel } from '../../lib/categoryTree'\n\ntype CategoryRow = {\n id: string\n name: string\n slug: string | null\n description: string | null\n parentId: string | null\n parentName: string | null\n depth: number\n treePath: string\n pathLabel: string\n childCount: number\n descendantCount: number\n isActive: boolean\n}\n\ntype CategoriesResponse = {\n items: CategoryRow[]\n total: number\n page: number\n pageSize: number\n totalPages: number\n}\n\nconst PAGE_SIZE = 50\nconst TREE_BASE_INDENT = 18\nconst TREE_STEP_INDENT = 14\n\nfunction computeIndent(depth: number): number {\n if (depth <= 0) return 0\n return TREE_BASE_INDENT + (depth - 1) * TREE_STEP_INDENT\n}\n\nexport default function CategoriesDataTable() {\n const t = useT()\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n const [page, setPage] = React.useState(1)\n const [status, setStatus] = React.useState<'all' | 'active' | 'inactive'>('all')\n const [search, setSearch] = React.useState('')\n const [canManage, setCanManage] = React.useState(false)\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n try {\n const call = await apiCall<{ granted?: string[]; ok?: boolean }>('/api/auth/feature-check', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ features: ['catalog.categories.manage'] }),\n })\n if (!cancelled) {\n const granted = Array.isArray(call.result?.granted) ? call.result.granted : []\n setCanManage(call.result?.ok === true || granted.includes('catalog.categories.manage'))\n }\n } catch {\n if (!cancelled) setCanManage(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [])\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n params.set('view', 'manage')\n params.set('page', String(page))\n params.set('pageSize', String(PAGE_SIZE))\n params.set('status', status)\n if (search) params.set('search', search)\n return params.toString()\n }, [page, status, search])\n\n const { data, isLoading } = useQuery<CategoriesResponse>({\n queryKey: ['catalog-categories', queryParams, scopeVersion],\n queryFn: async () => {\n const payload = await readApiResultOrThrow<CategoriesResponse>(\n `/api/catalog/categories?${queryParams}`,\n undefined,\n { errorMessage: t('catalog.categories.list.error.load', 'Failed to load categories') },\n )\n return {\n items: Array.isArray(payload.items) ? payload.items : [],\n total: typeof payload.total === 'number' ? payload.total : 0,\n page: typeof payload.page === 'number' ? payload.page : 1,\n pageSize: typeof payload.pageSize === 'number' ? payload.pageSize : PAGE_SIZE,\n totalPages: typeof payload.totalPages === 'number' ? payload.totalPages : 1,\n }\n },\n })\n\n const rows = data?.items ?? []\n const total = data?.total ?? 0\n const totalPages = data?.totalPages ?? 1\n\n const columns = React.useMemo<ColumnDef<CategoryRow>[]>(() => [\n {\n accessorKey: 'name',\n header: t('catalog.categories.list.columns.category', 'Category'),\n meta: { priority: 1 },\n cell: ({ row }) => {\n const depth = row.original.depth ?? 0\n return (\n <div className=\"flex items-center text-sm font-medium leading-none text-foreground\">\n <span style={{ marginLeft: computeIndent(depth), whiteSpace: 'pre' }}>\n {formatCategoryTreeLabel(row.original.name, depth)}\n </span>\n </div>\n )\n },\n },\n {\n accessorKey: 'pathLabel',\n header: t('catalog.categories.list.columns.path', 'Path'),\n meta: { priority: 3 },\n cell: ({ getValue }) => {\n const value = getValue<string>()\n return <span className=\"text-xs text-muted-foreground\">{value || '\u2014'}</span>\n },\n },\n {\n accessorKey: 'parentName',\n header: t('catalog.categories.list.columns.parent', 'Parent'),\n meta: { priority: 4 },\n cell: ({ getValue }) => getValue<string>() || t('catalog.categories.list.none', '\u2014'),\n },\n {\n accessorKey: 'childCount',\n header: t('catalog.categories.list.columns.children', 'Children'),\n meta: { priority: 5 },\n },\n {\n accessorKey: 'isActive',\n header: t('catalog.categories.list.columns.active', 'Active'),\n enableSorting: false,\n meta: { priority: 2 },\n cell: ({ getValue }) => <BooleanIcon value={Boolean(getValue())} />,\n },\n ], [t])\n\n const handleDelete = React.useCallback(async (category: CategoryRow) => {\n const confirmLabel = t(\n 'catalog.categories.list.confirmDelete',\n 'Archive category \"{{name}}\"?',\n { name: category.name },\n )\n if (!window.confirm(confirmLabel)) return\n try {\n await apiCallOrThrow(\n `/api/catalog/categories?id=${encodeURIComponent(category.id)}`,\n { method: 'DELETE' },\n { errorMessage: t('catalog.categories.list.error.delete', 'Failed to delete category') },\n )\n await queryClient.invalidateQueries({ queryKey: ['catalog-categories'] })\n flash(t('catalog.categories.flash.deleted', 'Category archived'), 'success')\n } catch (err: unknown) {\n const fallback = t('catalog.categories.list.error.delete', 'Failed to delete category')\n const message = err instanceof Error ? err.message : fallback\n flash(message, 'error')\n }\n }, [queryClient, t])\n\n return (\n <DataTable\n title={t('catalog.categories.list.title', 'Categories')}\n actions={canManage ? (\n <Button asChild>\n <Link href=\"/backend/catalog/categories/create\">\n {t('catalog.categories.list.actions.create', 'Create')}\n </Link>\n </Button>\n ) : undefined}\n columns={columns}\n data={rows}\n searchValue={search}\n searchPlaceholder={t('catalog.categories.list.searchPlaceholder', 'Search categories')}\n onSearchChange={(value) => { setSearch(value); setPage(1) }}\n filters={[\n {\n id: 'status',\n label: t('catalog.categories.list.filters.status', 'Status'),\n type: 'select',\n options: [\n { value: 'all', label: t('catalog.categories.list.filters.all', 'All') },\n { value: 'active', label: t('catalog.categories.list.filters.active', 'Active') },\n { value: 'inactive', label: t('catalog.categories.list.filters.inactive', 'Inactive') },\n ],\n },\n ]}\n filterValues={status === 'all' ? {} : { status }}\n onFiltersApply={(values: FilterValues) => {\n const nextStatus = (values.status as 'all' | 'active' | 'inactive' | undefined) ?? 'all'\n setStatus(nextStatus)\n setPage(1)\n }}\n onFiltersClear={() => {\n setStatus('all')\n setPage(1)\n }}\n sortable={false}\n perspective={{ tableId: 'catalog.categories.list' }}\n rowActions={(row) => (\n canManage ? (\n <RowActions\n items={[\n { id: 'edit', label: t('catalog.categories.list.actions.edit', 'Edit'), href: `/backend/catalog/categories/${row.id}/edit` },\n { id: 'delete', label: t('catalog.categories.list.actions.delete', 'Delete'), destructive: true, onSelect: () => handleDelete(row) },\n ]}\n />\n ) : null\n )}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n isLoading={isLoading}\n />\n )\n}\n"],
5
- "mappings": ";AA0HY;AAxHZ,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,UAAU,sBAAsB;AAEzC,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,SAAS,gBAAgB,4BAA4B;AAC9D,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,+BAA+B;AAyBxC,MAAM,YAAY;AAClB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;AAEzB,SAAS,cAAc,OAAuB;AAC5C,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO,oBAAoB,QAAQ,KAAK;AAC1C;AAEe,SAAR,sBAAuC;AAC5C,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,eAAe;AACnC,QAAM,eAAe,4BAA4B;AACjD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,CAAC;AACxC,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAwC,KAAK;AAC/E,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAS,EAAE;AAC7C,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AAEtD,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAChB,mBAAe,OAAO;AACpB,UAAI;AACF,cA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,KAAK;AAAG,gBAAQ,CAAC;AAAA,MAAE;AAAA,MAC1D,SAAS;AAAA,QACP;AAAA,UACE,IAAI;AAAA,UACJ,OAAO,EAAE,0CAA0C,QAAQ;AAAA,UAC3D,MAAM;AAAA,UACN,SAAS;AAAA,YACP,EAAE,OAAO,OAAO,OAAO,EAAE,uCAAuC,KAAK,EAAE;AAAA,YACvE,EAAE,OAAO,UAAU,OAAO,EAAE,0CAA0C,QAAQ,EAAE;AAAA,YAChF,EAAE,OAAO,YAAY,OAAO,EAAE,4CAA4C,UAAU,EAAE;AAAA,UACxF;AAAA,QACF;AAAA,MACF;AAAA,MACA,cAAc,WAAW,QAAQ,CAAC,IAAI,EAAE,OAAO;AAAA,MAC/C,gBAAgB,CAAC,WAAyB;AACxC,cAAM,aAAc,OAAO,UAAwD;AACnF,kBAAU,UAAU;AACpB,gBAAQ,CAAC;AAAA,MACX;AAAA,MACA,gBAAgB,MAAM;AACpB,kBAAU,KAAK;AACf,gBAAQ,CAAC;AAAA,MACX;AAAA,MACA,UAAU;AAAA,MACV,aAAa,EAAE,SAAS,0BAA0B;AAAA,MAClD,YAAY,CAAC,QACX,YACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,EAAE,IAAI,QAAQ,OAAO,EAAE,wCAAwC,MAAM,GAAG,MAAM,+BAA+B,IAAI,EAAE,QAAQ;AAAA,YAC3H,EAAE,IAAI,UAAU,OAAO,EAAE,0CAA0C,QAAQ,GAAG,aAAa,MAAM,UAAU,MAAM,aAAa,GAAG,EAAE;AAAA,UACrI;AAAA;AAAA,MACF,IACE;AAAA,MAEN,YAAY;AAAA,QACV;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc;AAAA,MAChB;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { apiCall, apiCallOrThrow, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { formatCategoryTreeLabel } from '../../lib/categoryTree'\n\ntype CategoryRow = {\n id: string\n name: string\n slug: string | null\n description: string | null\n parentId: string | null\n parentName: string | null\n depth: number\n treePath: string\n pathLabel: string\n childCount: number\n descendantCount: number\n isActive: boolean\n}\n\ntype CategoriesResponse = {\n items: CategoryRow[]\n total: number\n page: number\n pageSize: number\n totalPages: number\n}\n\nconst PAGE_SIZE = 50\nconst TREE_BASE_INDENT = 18\nconst TREE_STEP_INDENT = 14\n\nfunction computeIndent(depth: number): number {\n if (depth <= 0) return 0\n return TREE_BASE_INDENT + (depth - 1) * TREE_STEP_INDENT\n}\n\nexport default function CategoriesDataTable() {\n const t = useT()\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n const [page, setPage] = React.useState(1)\n const [status, setStatus] = React.useState<'all' | 'active' | 'inactive'>('all')\n const [search, setSearch] = React.useState('')\n const [canManage, setCanManage] = React.useState(false)\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n try {\n const call = await apiCall<{ granted?: string[]; ok?: boolean }>('/api/auth/feature-check', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ features: ['catalog.categories.manage'] }),\n })\n if (!cancelled) {\n const granted = Array.isArray(call.result?.granted) ? call.result.granted : []\n setCanManage(call.result?.ok === true || granted.includes('catalog.categories.manage'))\n }\n } catch {\n if (!cancelled) setCanManage(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [])\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n params.set('view', 'manage')\n params.set('page', String(page))\n params.set('pageSize', String(PAGE_SIZE))\n params.set('status', status)\n if (search) params.set('search', search)\n return params.toString()\n }, [page, status, search])\n\n const { data, isLoading } = useQuery<CategoriesResponse>({\n queryKey: ['catalog-categories', queryParams, scopeVersion],\n queryFn: async () => {\n const payload = await readApiResultOrThrow<CategoriesResponse>(\n `/api/catalog/categories?${queryParams}`,\n undefined,\n { errorMessage: t('catalog.categories.list.error.load', 'Failed to load categories') },\n )\n return {\n items: Array.isArray(payload.items) ? payload.items : [],\n total: typeof payload.total === 'number' ? payload.total : 0,\n page: typeof payload.page === 'number' ? payload.page : 1,\n pageSize: typeof payload.pageSize === 'number' ? payload.pageSize : PAGE_SIZE,\n totalPages: typeof payload.totalPages === 'number' ? payload.totalPages : 1,\n }\n },\n })\n\n const rows = data?.items ?? []\n const total = data?.total ?? 0\n const totalPages = data?.totalPages ?? 1\n\n const columns = React.useMemo<ColumnDef<CategoryRow>[]>(() => [\n {\n accessorKey: 'name',\n header: t('catalog.categories.list.columns.category', 'Category'),\n meta: { priority: 1 },\n cell: ({ row }) => {\n const depth = row.original.depth ?? 0\n return (\n <div className=\"flex items-center text-sm font-medium leading-none text-foreground\">\n <span style={{ marginLeft: computeIndent(depth), whiteSpace: 'pre' }}>\n {formatCategoryTreeLabel(row.original.name, depth)}\n </span>\n </div>\n )\n },\n },\n {\n accessorKey: 'pathLabel',\n header: t('catalog.categories.list.columns.path', 'Path'),\n meta: { priority: 3 },\n cell: ({ getValue }) => {\n const value = getValue<string>()\n return <span className=\"text-xs text-muted-foreground\">{value || '\u2014'}</span>\n },\n },\n {\n accessorKey: 'parentName',\n header: t('catalog.categories.list.columns.parent', 'Parent'),\n meta: { priority: 4 },\n cell: ({ getValue }) => getValue<string>() || t('catalog.categories.list.none', '\u2014'),\n },\n {\n accessorKey: 'childCount',\n header: t('catalog.categories.list.columns.children', 'Children'),\n meta: { priority: 5 },\n },\n {\n accessorKey: 'isActive',\n header: t('catalog.categories.list.columns.active', 'Active'),\n enableSorting: false,\n meta: { priority: 2 },\n cell: ({ getValue }) => <BooleanIcon value={Boolean(getValue())} />,\n },\n ], [t])\n\n const handleDelete = React.useCallback(async (category: CategoryRow) => {\n const confirmLabel = t(\n 'catalog.categories.list.confirmDelete',\n 'Archive category \"{{name}}\"?',\n { name: category.name },\n )\n if (!window.confirm(confirmLabel)) return\n try {\n await apiCallOrThrow(\n `/api/catalog/categories?id=${encodeURIComponent(category.id)}`,\n { method: 'DELETE' },\n { errorMessage: t('catalog.categories.list.error.delete', 'Failed to delete category') },\n )\n await queryClient.invalidateQueries({ queryKey: ['catalog-categories'] })\n flash(t('catalog.categories.flash.deleted', 'Category archived'), 'success')\n } catch (err: unknown) {\n const fallback = t('catalog.categories.list.error.delete', 'Failed to delete category')\n const message = err instanceof Error ? err.message : fallback\n flash(message, 'error')\n }\n }, [queryClient, t])\n\n return (\n <DataTable\n title={t('catalog.categories.list.title', 'Categories')}\n actions={canManage ? (\n <Button asChild>\n <Link href=\"/backend/catalog/categories/create\">\n {t('catalog.categories.list.actions.create', 'Create')}\n </Link>\n </Button>\n ) : undefined}\n columns={columns}\n data={rows}\n searchValue={search}\n searchPlaceholder={t('catalog.categories.list.searchPlaceholder', 'Search categories')}\n onSearchChange={(value) => { setSearch(value); setPage(1) }}\n filters={[\n {\n id: 'status',\n label: t('catalog.categories.list.filters.status', 'Status'),\n type: 'select',\n options: [\n { value: 'all', label: t('catalog.categories.list.filters.all', 'All') },\n { value: 'active', label: t('catalog.categories.list.filters.active', 'Active') },\n { value: 'inactive', label: t('catalog.categories.list.filters.inactive', 'Inactive') },\n ],\n },\n ]}\n filterValues={status === 'all' ? {} : { status }}\n onFiltersApply={(values: FilterValues) => {\n const nextStatus = (values.status as 'all' | 'active' | 'inactive' | undefined) ?? 'all'\n setStatus(nextStatus)\n setPage(1)\n }}\n onFiltersClear={() => {\n setStatus('all')\n setPage(1)\n }}\n sortable={false}\n perspective={{ tableId: 'catalog.categories.list' }}\n rowActions={(row) => (\n canManage ? (\n <RowActions\n items={[\n { label: t('catalog.categories.list.actions.edit', 'Edit'), href: `/backend/catalog/categories/${row.id}/edit` },\n { label: t('catalog.categories.list.actions.delete', 'Delete'), destructive: true, onSelect: () => handleDelete(row) },\n ]}\n />\n ) : null\n )}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n isLoading={isLoading}\n />\n )\n}\n"],
5
+ "mappings": ";AA0HY;AAxHZ,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,UAAU,sBAAsB;AAEzC,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,SAAS,gBAAgB,4BAA4B;AAC9D,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,+BAA+B;AAyBxC,MAAM,YAAY;AAClB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;AAEzB,SAAS,cAAc,OAAuB;AAC5C,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO,oBAAoB,QAAQ,KAAK;AAC1C;AAEe,SAAR,sBAAuC;AAC5C,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,eAAe;AACnC,QAAM,eAAe,4BAA4B;AACjD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,CAAC;AACxC,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAwC,KAAK;AAC/E,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAS,EAAE;AAC7C,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AAEtD,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAChB,mBAAe,OAAO;AACpB,UAAI;A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kBAAU,KAAK;AAAG,gBAAQ,CAAC;AAAA,MAAE;AAAA,MAC1D,SAAS;AAAA,QACP;AAAA,UACE,IAAI;AAAA,UACJ,OAAO,EAAE,0CAA0C,QAAQ;AAAA,UAC3D,MAAM;AAAA,UACN,SAAS;AAAA,YACP,EAAE,OAAO,OAAO,OAAO,EAAE,uCAAuC,KAAK,EAAE;AAAA,YACvE,EAAE,OAAO,UAAU,OAAO,EAAE,0CAA0C,QAAQ,EAAE;AAAA,YAChF,EAAE,OAAO,YAAY,OAAO,EAAE,4CAA4C,UAAU,EAAE;AAAA,UACxF;AAAA,QACF;AAAA,MACF;AAAA,MACA,cAAc,WAAW,QAAQ,CAAC,IAAI,EAAE,OAAO;AAAA,MAC/C,gBAAgB,CAAC,WAAyB;AACxC,cAAM,aAAc,OAAO,UAAwD;AACnF,kBAAU,UAAU;AACpB,gBAAQ,CAAC;AAAA,MACX;AAAA,MACA,gBAAgB,MAAM;AACpB,kBAAU,KAAK;AACf,gBAAQ,CAAC;AAAA,MACX;AAAA,MACA,UAAU;AAAA,MACV,aAAa,EAAE,SAAS,0BAA0B;AAAA,MAClD,YAAY,CAAC,QACX,YACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,EAAE,OAAO,EAAE,wCAAwC,MAAM,GAAG,MAAM,+BAA+B,IAAI,EAAE,QAAQ;AAAA,YAC/G,EAAE,OAAO,EAAE,0CAA0C,QAAQ,GAAG,aAAa,MAAM,UAAU,MAAM,aAAa,GAAG,EAAE;AAAA,UACvH;AAAA;AAAA,MACF,IACE;AAAA,MAEN,YAAY;AAAA,QACV;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc;AAAA,MAChB;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -509,12 +509,10 @@ function ProductsDataTable() {
509
509
  {
510
510
  items: [
511
511
  {
512
- id: "edit",
513
512
  label: t("catalog.products.table.actions.edit", "Edit"),
514
513
  href: `/backend/catalog/products/${row.id}`
515
514
  },
516
515
  {
517
- id: "delete",
518
516
  label: t("catalog.products.table.actions.delete", "Delete"),
519
517
  destructive: true,
520
518
  onSelect: () => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/catalog/components/products/ProductsDataTable.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport type { ColumnDef, SortingState } from '@tanstack/react-table'\nimport { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { deleteCrud, buildCrudExportUrl } from '@open-mercato/ui/backend/utils/crud'\nimport { useCustomFieldDefs } from '@open-mercato/ui/backend/utils/customFieldDefs'\nimport { applyCustomFieldVisibility } from '@open-mercato/ui/backend/utils/customFieldColumns'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport type { FilterOption } from '@open-mercato/ui/backend/FilterOverlay'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { E } from '#generated/entities.ids.generated'\nimport { ProductImageCell } from './ProductImageCell'\n\ntype PricingScope = {\n variant_id?: string | null\n offer_id?: string | null\n channel_id?: string | null\n user_id?: string | null\n user_group_id?: string | null\n customer_id?: string | null\n customer_group_id?: string | null\n}\n\ntype PricingInfo = {\n kind?: string | null\n price_kind_id?: string | null\n price_kind_code?: string | null\n currency_code?: string | null\n unit_price_net?: string | null\n unit_price_gross?: string | null\n min_quantity?: number | null\n max_quantity?: number | null\n tax_rate?: string | null\n scope?: PricingScope | null\n} | null\n\ntype OfferInfo = {\n id: string\n channelId: string\n channelName?: string | null\n channelCode?: string | null\n title: string\n description?: string | null\n isActive: boolean\n}\n\nexport type ProductRow = {\n id: string\n title: string\n subtitle?: string | null\n description?: string | null\n sku?: string | null\n handle?: string | null\n product_type?: string | null\n status_entry_id?: string | null\n primary_currency_code?: string | null\n default_unit?: string | null\n default_media_id?: string | null\n default_media_url?: string | null\n is_configurable?: boolean\n is_active?: boolean\n metadata?: Record<string, unknown> | null\n custom_fieldset_code?: string | null\n created_at?: string\n updated_at?: string\n offers?: OfferInfo[]\n pricing?: PricingInfo\n} & Record<string, unknown>\n\ntype ProductsResponse = {\n items?: ProductRow[]\n total?: number\n totalPages?: number\n}\n\nconst PAGE_SIZE = 25\nconst ENTITY_ID = E.catalog.catalog_product\n\nfunction formatDate(value?: string): string {\n if (!value) return '\u2014'\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return '\u2014'\n return date.toLocaleDateString()\n}\n\nfunction renderOffers(offers: OfferInfo[] | undefined): React.ReactNode {\n if (!offers || offers.length === 0) return <span className=\"text-xs text-muted-foreground\">\u2014</span>\n const visible = offers.slice(0, 3)\n return (\n <div className=\"flex flex-wrap gap-1\">\n {visible.map((offer) => {\n const label =\n typeof offer.channelName === 'string' && offer.channelName.trim().length\n ? offer.channelName.trim()\n : typeof offer.title === 'string' && offer.title.trim().length\n ? offer.title.trim()\n : offer.channelId\n const badgeTitle =\n typeof offer.channelCode === 'string' && offer.channelCode.trim().length ? offer.channelCode : undefined\n return (\n <span\n key={offer.id}\n className={`inline-flex items-center rounded-full border px-2 py-0.5 text-xs ${\n offer.isActive ? 'bg-secondary/80 text-secondary-foreground' : 'bg-muted text-muted-foreground'\n }`}\n title={badgeTitle}\n >\n {label}\n </span>\n )\n })}\n {offers.length > visible.length ? (\n <span className=\"text-xs text-muted-foreground\">+{offers.length - visible.length}</span>\n ) : null}\n </div>\n )\n}\n\nfunction renderPrice(pricing: PricingInfo | undefined, currency?: string | null, fallback = '\u2014'): React.ReactNode {\n if (!pricing) return <span className=\"text-xs text-muted-foreground\">{fallback}</span>\n const unit = pricing.unit_price_net ?? pricing.unit_price_gross\n if (unit == null) return <span className=\"text-xs text-muted-foreground\">{fallback}</span>\n const formatted = `${currency ?? pricing.currency_code ?? ''} ${unit}`\n const kind = pricing.kind ?? 'list'\n return (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{formatted.trim()}</span>\n <span className=\"text-xs text-muted-foreground\">{kind}</span>\n </div>\n )\n}\n\nexport default function ProductsDataTable() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [rows, setRows] = React.useState<ProductRow[]>([])\n const [page, setPage] = React.useState(1)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [sorting, setSorting] = React.useState<SortingState>([{ id: 'title', desc: false }])\n const [search, setSearch] = React.useState('')\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [isLoading, setIsLoading] = React.useState(false)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [customFieldsetFilter, setCustomFieldsetFilter] = React.useState<string | null>(null)\n const { data: customFieldDefs = [] } = useCustomFieldDefs(ENTITY_ID, {\n keyExtras: [scopeVersion, reloadToken],\n })\n const [channelOptionsCache, setChannelOptionsCache] = React.useState<Record<string, FilterOption>>({})\n const [categoryOptionsCache, setCategoryOptionsCache] = React.useState<Record<string, FilterOption>>({})\n const [tagOptionsCache, setTagOptionsCache] = React.useState<Record<string, FilterOption>>({})\n\n const registerOptions = React.useCallback(\n (\n setter: React.Dispatch<React.SetStateAction<Record<string, FilterOption>>>,\n options: FilterOption[]\n ) => {\n setter((prev) => {\n const next = { ...prev }\n options.forEach((opt) => {\n if (opt.value) next[opt.value] = opt\n })\n return next\n })\n },\n []\n )\n\n const registerChannelOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setChannelOptionsCache, options),\n [registerOptions]\n )\n const registerCategoryOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setCategoryOptionsCache, options),\n [registerOptions]\n )\n const registerTagOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setTagOptionsCache, options),\n [registerOptions]\n )\n\n const channelOptions = React.useMemo(() => Object.values(channelOptionsCache), [channelOptionsCache])\n const categoryOptions = React.useMemo(() => Object.values(categoryOptionsCache), [categoryOptionsCache])\n const tagOptions = React.useMemo(() => Object.values(tagOptionsCache), [tagOptionsCache])\n\n const loadChannelOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '100', isActive: 'true' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; name?: string; code?: string }> }>(\n `/api/sales/channels?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.channelsLoadError', 'Failed to load channels') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label =\n typeof entry.name === 'string'\n ? entry.name\n : typeof entry.code === 'string'\n ? entry.code\n : value\n return { value, label, description: typeof entry.code === 'string' ? entry.code : undefined }\n })\n .filter((option) => !!option) as FilterOption[]\n registerChannelOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerChannelOptions, t],\n )\n\n const loadCategoryOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '200', view: 'manage' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; name?: string; parentName?: string | null }> }>(\n `/api/catalog/categories?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.categoriesLoadError', 'Failed to load categories') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label = typeof entry.name === 'string' && entry.name.trim().length ? entry.name : value\n const description =\n typeof entry.parentName === 'string' && entry.parentName.trim().length ? entry.parentName : null\n return { value, label, description }\n })\n .filter((option) => !!option) as FilterOption[]\n registerCategoryOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerCategoryOptions, t],\n )\n\n const loadTagOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '100' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; label?: string }> }>(\n `/api/catalog/tags?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.tagsLoadError', 'Failed to load tags') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label = typeof entry.label === 'string' && entry.label.trim().length ? entry.label : value\n return { value, label }\n })\n .filter((option) => !!option) as FilterOption[]\n registerTagOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerTagOptions, t],\n )\n\n const productTypeOptions = React.useMemo<FilterOption[]>(() => [\n { value: 'simple', label: t('catalog.products.types.simple', 'Simple') },\n { value: 'configurable', label: t('catalog.products.types.configurable', 'Configurable') },\n { value: 'virtual', label: t('catalog.products.types.virtual', 'Virtual') },\n { value: 'downloadable', label: t('catalog.products.types.downloadable', 'Downloadable') },\n {\n value: 'bundle',\n label: `${t('catalog.products.types.bundle', 'Bundle')} (${t('common.comingSoon', 'Coming soon')})`,\n },\n {\n value: 'grouped',\n label: `${t('catalog.products.types.grouped', 'Grouped')} (${t('common.comingSoon', 'Coming soon')})`,\n },\n ], [t])\n\n const productTypeLabelMap = React.useMemo(() => {\n const map = new Map<string, string>()\n productTypeOptions.forEach((opt) => map.set(opt.value, opt.label))\n return map\n }, [productTypeOptions])\n\n const filters = React.useMemo<FilterDef[]>(() => [\n { id: 'status', label: t('catalog.products.filters.status'), type: 'text' },\n { id: 'isActive', label: t('catalog.products.filters.active'), type: 'checkbox' },\n { id: 'configurable', label: t('catalog.products.filters.configurable'), type: 'checkbox' },\n { id: 'productType', label: t('catalog.products.filters.productType', 'Type'), type: 'select', options: productTypeOptions },\n {\n id: 'channelIds',\n label: t('catalog.products.filters.channels'),\n type: 'tags',\n loadOptions: loadChannelOptions,\n options: channelOptions,\n formatValue: (val) => channelOptionsCache[val]?.label ?? val,\n formatDescription: (val) => channelOptionsCache[val]?.description ?? null,\n },\n {\n id: 'categoryIds',\n label: t('catalog.products.filters.categories', 'Categories'),\n type: 'tags',\n loadOptions: loadCategoryOptions,\n options: categoryOptions,\n formatValue: (val) => categoryOptionsCache[val]?.label ?? val,\n formatDescription: (val) => categoryOptionsCache[val]?.description ?? null,\n },\n {\n id: 'tagIds',\n label: t('catalog.products.filters.tags', 'Tags'),\n type: 'tags',\n loadOptions: loadTagOptions,\n options: tagOptions,\n formatValue: (val) => tagOptionsCache[val]?.label ?? val,\n },\n ], [\n categoryOptions,\n categoryOptionsCache,\n channelOptions,\n channelOptionsCache,\n loadCategoryOptions,\n loadChannelOptions,\n loadTagOptions,\n productTypeOptions,\n tagOptions,\n tagOptionsCache,\n t,\n ])\n\n const columns = React.useMemo<ColumnDef<ProductRow>[]>(() => {\n const base: ColumnDef<ProductRow>[] = [\n {\n id: 'media',\n header: '',\n size: 80,\n cell: ({ row }) => (\n <ProductImageCell\n mediaId={row.original.default_media_id}\n mediaUrl={row.original.default_media_url}\n title={row.original.title}\n cropType=\"contain\"\n />\n ),\n meta: { sticky: true },\n },\n {\n accessorKey: 'title',\n header: t('catalog.products.table.title', 'Title'),\n cell: ({ row }) => (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{row.original.title || '\u2014'}</span>\n {row.original.subtitle ? (\n <span className=\"text-xs text-muted-foreground\">{row.original.subtitle}</span>\n ) : null}\n {row.original.handle ? (\n <span className=\"text-xs text-muted-foreground\">/{row.original.handle}</span>\n ) : null}\n {row.original.description ? (\n <span className=\"text-xs text-muted-foreground\">{row.original.description}</span>\n ) : null}\n </div>\n ),\n meta: { sticky: true },\n },\n {\n accessorKey: 'sku',\n header: t('catalog.products.table.sku', 'SKU'),\n cell: ({ getValue }) => {\n const value = getValue()\n return value ? <span className=\"font-mono text-xs\">{String(value)}</span> : <span className=\"text-xs text-muted-foreground\">\u2014</span>\n },\n },\n {\n accessorKey: 'product_type',\n header: t('catalog.products.table.type'),\n cell: ({ row }) => {\n const type = typeof row.original.product_type === 'string' ? row.original.product_type : 'simple'\n const label = productTypeLabelMap.get(type) ?? type\n return <span className=\"text-xs text-muted-foreground\">{label}</span>\n },\n },\n {\n accessorKey: 'is_configurable',\n header: t('catalog.products.table.configurable'),\n cell: ({ row }) => <BooleanIcon value={!!row.original.is_configurable} />,\n },\n {\n accessorKey: 'is_active',\n header: t('catalog.products.table.active'),\n cell: ({ row }) => <BooleanIcon value={!!row.original.is_active} />,\n },\n {\n accessorKey: 'pricing',\n header: t('catalog.products.table.price'),\n cell: ({ row }) => renderPrice(row.original.pricing, row.original.primary_currency_code),\n },\n {\n accessorKey: 'offers',\n header: t('catalog.products.table.channels'),\n cell: ({ row }) => renderOffers(row.original.offers),\n },\n {\n accessorKey: 'updated_at',\n header: t('catalog.products.table.updatedAt'),\n cell: ({ row }) => <span className=\"text-xs text-muted-foreground\">{formatDate(row.original.updated_at)}</span>,\n },\n ]\n return applyCustomFieldVisibility(base, customFieldDefs)\n }, [customFieldDefs, productTypeLabelMap, t])\n\n const handleSearchChange = React.useCallback((value: string) => {\n setSearch(value)\n setPage(1)\n }, [])\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n setFilterValues(values)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const handleCustomFieldsetFilterChange = React.useCallback(\n (value: string | null) => {\n if (value === customFieldsetFilter) return\n setCustomFieldsetFilter(value)\n setFilterValues((prev) => {\n const entries = Object.entries(prev)\n if (!entries.some(([key]) => key.startsWith('cf_'))) return prev\n const next: FilterValues = {}\n entries.forEach(([key, val]) => {\n if (!key.startsWith('cf_')) next[key] = val\n })\n return next\n })\n setPage(1)\n },\n [customFieldsetFilter],\n )\n\n const handleRefresh = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n params.set('page', String(page))\n params.set('pageSize', String(PAGE_SIZE))\n if (search.trim()) params.set('search', search.trim())\n const sort = sorting[0]\n if (sort?.id) {\n params.set('sortField', sort.id)\n params.set('sortDir', sort.desc ? 'desc' : 'asc')\n }\n const status = filterValues.status\n if (typeof status === 'string' && status.trim()) {\n params.set('status', status.trim())\n }\n if (filterValues.isActive === true) params.set('isActive', 'true')\n if (filterValues.isActive === false) params.set('isActive', 'false')\n if (filterValues.configurable === true) params.set('configurable', 'true')\n if (filterValues.configurable === false) params.set('configurable', 'false')\n if (typeof filterValues.productType === 'string' && filterValues.productType.trim()) {\n params.set('productType', filterValues.productType.trim())\n }\n if (Array.isArray(filterValues.channelIds) && filterValues.channelIds.length) {\n const values = filterValues.channelIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('channelIds', values.join(','))\n }\n if (Array.isArray(filterValues.categoryIds) && filterValues.categoryIds.length) {\n const values = filterValues.categoryIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('categoryIds', values.join(','))\n }\n if (Array.isArray(filterValues.tagIds) && filterValues.tagIds.length) {\n const values = filterValues.tagIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('tagIds', values.join(','))\n }\n Object.entries(filterValues).forEach(([key, value]) => {\n if (!key.startsWith('cf_') || value == null) return\n if (Array.isArray(value)) {\n const entries = value\n .map((entry) => (typeof entry === 'string' ? entry.trim() : String(entry || '').trim()))\n .filter((entry) => entry.length > 0)\n if (entries.length) params.set(key, entries.join(','))\n } else if (typeof value === 'object' && value !== null && ('from' in (value as Record<string, unknown>) || 'to' in (value as Record<string, unknown>))) {\n const range = value as { from?: string; to?: string }\n if (typeof range.from === 'string' && range.from.trim().length) {\n params.set(`${key}:from`, range.from.trim())\n }\n if (typeof range.to === 'string' && range.to.trim().length) {\n params.set(`${key}:to`, range.to.trim())\n }\n } else if (typeof value === 'string' && value.trim()) {\n params.set(key, value.trim())\n }\n })\n if (typeof customFieldsetFilter === 'string' && customFieldsetFilter.trim().length > 0) {\n params.set('customFieldset', customFieldsetFilter.trim())\n }\n return params.toString()\n }, [customFieldsetFilter, filterValues, page, search, sorting])\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setIsLoading(true)\n try {\n const fallback: ProductsResponse = { items: [], total: 0, totalPages: 1 }\n const call = await apiCall<ProductsResponse>(\n `/api/catalog/products?${queryParams}`,\n undefined,\n { fallback },\n )\n if (!call.ok) {\n const message = t('catalog.products.list.error.load', 'Failed to load products')\n flash(message, 'error')\n return\n }\n const payload = call.result ?? fallback\n if (cancelled) return\n const items = Array.isArray(payload.items) ? payload.items : []\n const normalized = items.filter((item): item is ProductRow => typeof item?.id === 'string')\n setRows(normalized)\n setTotal(typeof payload.total === 'number' ? payload.total : normalized.length)\n setTotalPages(typeof payload.totalPages === 'number' ? payload.totalPages : 1)\n } catch (error) {\n if (!cancelled) {\n const message =\n error instanceof Error\n ? error.message\n : t('catalog.products.list.error.load', 'Failed to load products')\n flash(message, 'error')\n }\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [queryParams, reloadToken, scopeVersion, t])\n\n const handleDelete = React.useCallback(async (row: ProductRow) => {\n if (!window.confirm(t('catalog.products.list.deleteConfirm', 'Delete this product?'))) return\n try {\n await deleteCrud('catalog/products', row.id, {\n errorMessage: t('catalog.products.list.error.delete', 'Failed to delete product'),\n })\n flash(t('catalog.products.flash.deleted', 'Product deleted'), 'success')\n setReloadToken((token) => token + 1)\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : t('catalog.products.list.error.delete', 'Failed to delete product')\n flash(message, 'error')\n }\n }, [t])\n\n const currentParams = React.useMemo(() => Object.fromEntries(new URLSearchParams(queryParams)), [queryParams])\n\n const exportConfig = React.useMemo(() => ({\n view: {\n getUrl: (format: DataTableExportFormat) =>\n buildCrudExportUrl('catalog/products', { ...currentParams, exportScope: 'view' }, format),\n },\n full: {\n getUrl: (format: DataTableExportFormat) =>\n buildCrudExportUrl('catalog/products', { ...currentParams, exportScope: 'full', all: 'true' }, format),\n },\n }), [currentParams])\n\n return (\n <DataTable<ProductRow>\n title={t('catalog.products.page.title', 'Products & services')}\n entityId={ENTITY_ID}\n customFieldFilterKeyExtras={[scopeVersion, reloadToken]}\n refreshButton={{\n label: t('catalog.products.actions.refresh', 'Refresh'),\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n actions={(\n <Button asChild>\n <Link href=\"/backend/catalog/products/create\">\n {t('catalog.products.actions.create', 'Create')}\n </Link>\n </Button>\n )}\n columns={columns}\n data={rows}\n searchValue={search}\n onSearchChange={handleSearchChange}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onCustomFieldFilterFieldsetChange={handleCustomFieldsetFilterChange}\n sorting={sorting}\n onSortingChange={setSorting}\n injectionSpotId=\"data-table:catalog.products\"\n injectionContext={{\n search,\n filters: filterValues,\n page,\n scopeVersion,\n }}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n exporter={exportConfig}\n isLoading={isLoading}\n perspective={{ tableId: 'catalog.products.list' }}\n rowActions={(row) => (\n <RowActions\n items={[\n {\n id: 'edit',\n label: t('catalog.products.table.actions.edit', 'Edit'),\n href: `/backend/catalog/products/${row.id}`,\n },\n {\n id: 'delete',\n label: t('catalog.products.table.actions.delete', 'Delete'),\n destructive: true,\n onSelect: () => {\n void handleDelete(row)\n },\n },\n ]}\n />\n )}\n />\n )\n}\n"],
5
- "mappings": ";AA8F6C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IAAI,EAAE;AAAA,YAC3C;AAAA,YACA;AAAA,cACE,IAAI;AAAA,cACJ,OAAO,EAAE,yCAAyC,QAAQ;AAAA,cAC1D,aAAa;AAAA,cACb,UAAU,MAAM;AACd,qBAAK,aAAa,GAAG;AAAA,cACvB;AAAA,YACF;AAAA,UACF;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport type { ColumnDef, SortingState } from '@tanstack/react-table'\nimport { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { deleteCrud, buildCrudExportUrl } from '@open-mercato/ui/backend/utils/crud'\nimport { useCustomFieldDefs } from '@open-mercato/ui/backend/utils/customFieldDefs'\nimport { applyCustomFieldVisibility } from '@open-mercato/ui/backend/utils/customFieldColumns'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport type { FilterOption } from '@open-mercato/ui/backend/FilterOverlay'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { E } from '#generated/entities.ids.generated'\nimport { ProductImageCell } from './ProductImageCell'\n\ntype PricingScope = {\n variant_id?: string | null\n offer_id?: string | null\n channel_id?: string | null\n user_id?: string | null\n user_group_id?: string | null\n customer_id?: string | null\n customer_group_id?: string | null\n}\n\ntype PricingInfo = {\n kind?: string | null\n price_kind_id?: string | null\n price_kind_code?: string | null\n currency_code?: string | null\n unit_price_net?: string | null\n unit_price_gross?: string | null\n min_quantity?: number | null\n max_quantity?: number | null\n tax_rate?: string | null\n scope?: PricingScope | null\n} | null\n\ntype OfferInfo = {\n id: string\n channelId: string\n channelName?: string | null\n channelCode?: string | null\n title: string\n description?: string | null\n isActive: boolean\n}\n\nexport type ProductRow = {\n id: string\n title: string\n subtitle?: string | null\n description?: string | null\n sku?: string | null\n handle?: string | null\n product_type?: string | null\n status_entry_id?: string | null\n primary_currency_code?: string | null\n default_unit?: string | null\n default_media_id?: string | null\n default_media_url?: string | null\n is_configurable?: boolean\n is_active?: boolean\n metadata?: Record<string, unknown> | null\n custom_fieldset_code?: string | null\n created_at?: string\n updated_at?: string\n offers?: OfferInfo[]\n pricing?: PricingInfo\n} & Record<string, unknown>\n\ntype ProductsResponse = {\n items?: ProductRow[]\n total?: number\n totalPages?: number\n}\n\nconst PAGE_SIZE = 25\nconst ENTITY_ID = E.catalog.catalog_product\n\nfunction formatDate(value?: string): string {\n if (!value) return '\u2014'\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return '\u2014'\n return date.toLocaleDateString()\n}\n\nfunction renderOffers(offers: OfferInfo[] | undefined): React.ReactNode {\n if (!offers || offers.length === 0) return <span className=\"text-xs text-muted-foreground\">\u2014</span>\n const visible = offers.slice(0, 3)\n return (\n <div className=\"flex flex-wrap gap-1\">\n {visible.map((offer) => {\n const label =\n typeof offer.channelName === 'string' && offer.channelName.trim().length\n ? offer.channelName.trim()\n : typeof offer.title === 'string' && offer.title.trim().length\n ? offer.title.trim()\n : offer.channelId\n const badgeTitle =\n typeof offer.channelCode === 'string' && offer.channelCode.trim().length ? offer.channelCode : undefined\n return (\n <span\n key={offer.id}\n className={`inline-flex items-center rounded-full border px-2 py-0.5 text-xs ${\n offer.isActive ? 'bg-secondary/80 text-secondary-foreground' : 'bg-muted text-muted-foreground'\n }`}\n title={badgeTitle}\n >\n {label}\n </span>\n )\n })}\n {offers.length > visible.length ? (\n <span className=\"text-xs text-muted-foreground\">+{offers.length - visible.length}</span>\n ) : null}\n </div>\n )\n}\n\nfunction renderPrice(pricing: PricingInfo | undefined, currency?: string | null, fallback = '\u2014'): React.ReactNode {\n if (!pricing) return <span className=\"text-xs text-muted-foreground\">{fallback}</span>\n const unit = pricing.unit_price_net ?? pricing.unit_price_gross\n if (unit == null) return <span className=\"text-xs text-muted-foreground\">{fallback}</span>\n const formatted = `${currency ?? pricing.currency_code ?? ''} ${unit}`\n const kind = pricing.kind ?? 'list'\n return (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{formatted.trim()}</span>\n <span className=\"text-xs text-muted-foreground\">{kind}</span>\n </div>\n )\n}\n\nexport default function ProductsDataTable() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [rows, setRows] = React.useState<ProductRow[]>([])\n const [page, setPage] = React.useState(1)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [sorting, setSorting] = React.useState<SortingState>([{ id: 'title', desc: false }])\n const [search, setSearch] = React.useState('')\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [isLoading, setIsLoading] = React.useState(false)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [customFieldsetFilter, setCustomFieldsetFilter] = React.useState<string | null>(null)\n const { data: customFieldDefs = [] } = useCustomFieldDefs(ENTITY_ID, {\n keyExtras: [scopeVersion, reloadToken],\n })\n const [channelOptionsCache, setChannelOptionsCache] = React.useState<Record<string, FilterOption>>({})\n const [categoryOptionsCache, setCategoryOptionsCache] = React.useState<Record<string, FilterOption>>({})\n const [tagOptionsCache, setTagOptionsCache] = React.useState<Record<string, FilterOption>>({})\n\n const registerOptions = React.useCallback(\n (\n setter: React.Dispatch<React.SetStateAction<Record<string, FilterOption>>>,\n options: FilterOption[]\n ) => {\n setter((prev) => {\n const next = { ...prev }\n options.forEach((opt) => {\n if (opt.value) next[opt.value] = opt\n })\n return next\n })\n },\n []\n )\n\n const registerChannelOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setChannelOptionsCache, options),\n [registerOptions]\n )\n const registerCategoryOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setCategoryOptionsCache, options),\n [registerOptions]\n )\n const registerTagOptions = React.useCallback(\n (options: FilterOption[]) => registerOptions(setTagOptionsCache, options),\n [registerOptions]\n )\n\n const channelOptions = React.useMemo(() => Object.values(channelOptionsCache), [channelOptionsCache])\n const categoryOptions = React.useMemo(() => Object.values(categoryOptionsCache), [categoryOptionsCache])\n const tagOptions = React.useMemo(() => Object.values(tagOptionsCache), [tagOptionsCache])\n\n const loadChannelOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '100', isActive: 'true' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; name?: string; code?: string }> }>(\n `/api/sales/channels?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.channelsLoadError', 'Failed to load channels') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label =\n typeof entry.name === 'string'\n ? entry.name\n : typeof entry.code === 'string'\n ? entry.code\n : value\n return { value, label, description: typeof entry.code === 'string' ? entry.code : undefined }\n })\n .filter((option) => !!option) as FilterOption[]\n registerChannelOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerChannelOptions, t],\n )\n\n const loadCategoryOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '200', view: 'manage' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; name?: string; parentName?: string | null }> }>(\n `/api/catalog/categories?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.categoriesLoadError', 'Failed to load categories') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label = typeof entry.name === 'string' && entry.name.trim().length ? entry.name : value\n const description =\n typeof entry.parentName === 'string' && entry.parentName.trim().length ? entry.parentName : null\n return { value, label, description }\n })\n .filter((option) => !!option) as FilterOption[]\n registerCategoryOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerCategoryOptions, t],\n )\n\n const loadTagOptions = React.useCallback(\n async (term?: string): Promise<FilterOption[]> => {\n try {\n const params = new URLSearchParams({ pageSize: '100' })\n if (term && term.trim().length) params.set('search', term.trim())\n const payload = await readApiResultOrThrow<{ items?: Array<{ id?: string; label?: string }> }>(\n `/api/catalog/tags?${params.toString()}`,\n undefined,\n { errorMessage: t('catalog.products.filters.tagsLoadError', 'Failed to load tags') },\n )\n const items = Array.isArray(payload?.items) ? payload.items : []\n const options = items\n .map((entry) => {\n const value = typeof entry.id === 'string' ? entry.id : null\n if (!value) return null\n const label = typeof entry.label === 'string' && entry.label.trim().length ? entry.label : value\n return { value, label }\n })\n .filter((option) => !!option) as FilterOption[]\n registerTagOptions(options)\n return options\n } catch {\n return []\n }\n },\n [registerTagOptions, t],\n )\n\n const productTypeOptions = React.useMemo<FilterOption[]>(() => [\n { value: 'simple', label: t('catalog.products.types.simple', 'Simple') },\n { value: 'configurable', label: t('catalog.products.types.configurable', 'Configurable') },\n { value: 'virtual', label: t('catalog.products.types.virtual', 'Virtual') },\n { value: 'downloadable', label: t('catalog.products.types.downloadable', 'Downloadable') },\n {\n value: 'bundle',\n label: `${t('catalog.products.types.bundle', 'Bundle')} (${t('common.comingSoon', 'Coming soon')})`,\n },\n {\n value: 'grouped',\n label: `${t('catalog.products.types.grouped', 'Grouped')} (${t('common.comingSoon', 'Coming soon')})`,\n },\n ], [t])\n\n const productTypeLabelMap = React.useMemo(() => {\n const map = new Map<string, string>()\n productTypeOptions.forEach((opt) => map.set(opt.value, opt.label))\n return map\n }, [productTypeOptions])\n\n const filters = React.useMemo<FilterDef[]>(() => [\n { id: 'status', label: t('catalog.products.filters.status'), type: 'text' },\n { id: 'isActive', label: t('catalog.products.filters.active'), type: 'checkbox' },\n { id: 'configurable', label: t('catalog.products.filters.configurable'), type: 'checkbox' },\n { id: 'productType', label: t('catalog.products.filters.productType', 'Type'), type: 'select', options: productTypeOptions },\n {\n id: 'channelIds',\n label: t('catalog.products.filters.channels'),\n type: 'tags',\n loadOptions: loadChannelOptions,\n options: channelOptions,\n formatValue: (val) => channelOptionsCache[val]?.label ?? val,\n formatDescription: (val) => channelOptionsCache[val]?.description ?? null,\n },\n {\n id: 'categoryIds',\n label: t('catalog.products.filters.categories', 'Categories'),\n type: 'tags',\n loadOptions: loadCategoryOptions,\n options: categoryOptions,\n formatValue: (val) => categoryOptionsCache[val]?.label ?? val,\n formatDescription: (val) => categoryOptionsCache[val]?.description ?? null,\n },\n {\n id: 'tagIds',\n label: t('catalog.products.filters.tags', 'Tags'),\n type: 'tags',\n loadOptions: loadTagOptions,\n options: tagOptions,\n formatValue: (val) => tagOptionsCache[val]?.label ?? val,\n },\n ], [\n categoryOptions,\n categoryOptionsCache,\n channelOptions,\n channelOptionsCache,\n loadCategoryOptions,\n loadChannelOptions,\n loadTagOptions,\n productTypeOptions,\n tagOptions,\n tagOptionsCache,\n t,\n ])\n\n const columns = React.useMemo<ColumnDef<ProductRow>[]>(() => {\n const base: ColumnDef<ProductRow>[] = [\n {\n id: 'media',\n header: '',\n size: 80,\n cell: ({ row }) => (\n <ProductImageCell\n mediaId={row.original.default_media_id}\n mediaUrl={row.original.default_media_url}\n title={row.original.title}\n cropType=\"contain\"\n />\n ),\n meta: { sticky: true },\n },\n {\n accessorKey: 'title',\n header: t('catalog.products.table.title', 'Title'),\n cell: ({ row }) => (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{row.original.title || '\u2014'}</span>\n {row.original.subtitle ? (\n <span className=\"text-xs text-muted-foreground\">{row.original.subtitle}</span>\n ) : null}\n {row.original.handle ? (\n <span className=\"text-xs text-muted-foreground\">/{row.original.handle}</span>\n ) : null}\n {row.original.description ? (\n <span className=\"text-xs text-muted-foreground\">{row.original.description}</span>\n ) : null}\n </div>\n ),\n meta: { sticky: true },\n },\n {\n accessorKey: 'sku',\n header: t('catalog.products.table.sku', 'SKU'),\n cell: ({ getValue }) => {\n const value = getValue()\n return value ? <span className=\"font-mono text-xs\">{String(value)}</span> : <span className=\"text-xs text-muted-foreground\">\u2014</span>\n },\n },\n {\n accessorKey: 'product_type',\n header: t('catalog.products.table.type'),\n cell: ({ row }) => {\n const type = typeof row.original.product_type === 'string' ? row.original.product_type : 'simple'\n const label = productTypeLabelMap.get(type) ?? type\n return <span className=\"text-xs text-muted-foreground\">{label}</span>\n },\n },\n {\n accessorKey: 'is_configurable',\n header: t('catalog.products.table.configurable'),\n cell: ({ row }) => <BooleanIcon value={!!row.original.is_configurable} />,\n },\n {\n accessorKey: 'is_active',\n header: t('catalog.products.table.active'),\n cell: ({ row }) => <BooleanIcon value={!!row.original.is_active} />,\n },\n {\n accessorKey: 'pricing',\n header: t('catalog.products.table.price'),\n cell: ({ row }) => renderPrice(row.original.pricing, row.original.primary_currency_code),\n },\n {\n accessorKey: 'offers',\n header: t('catalog.products.table.channels'),\n cell: ({ row }) => renderOffers(row.original.offers),\n },\n {\n accessorKey: 'updated_at',\n header: t('catalog.products.table.updatedAt'),\n cell: ({ row }) => <span className=\"text-xs text-muted-foreground\">{formatDate(row.original.updated_at)}</span>,\n },\n ]\n return applyCustomFieldVisibility(base, customFieldDefs)\n }, [customFieldDefs, productTypeLabelMap, t])\n\n const handleSearchChange = React.useCallback((value: string) => {\n setSearch(value)\n setPage(1)\n }, [])\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n setFilterValues(values)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const handleCustomFieldsetFilterChange = React.useCallback(\n (value: string | null) => {\n if (value === customFieldsetFilter) return\n setCustomFieldsetFilter(value)\n setFilterValues((prev) => {\n const entries = Object.entries(prev)\n if (!entries.some(([key]) => key.startsWith('cf_'))) return prev\n const next: FilterValues = {}\n entries.forEach(([key, val]) => {\n if (!key.startsWith('cf_')) next[key] = val\n })\n return next\n })\n setPage(1)\n },\n [customFieldsetFilter],\n )\n\n const handleRefresh = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n params.set('page', String(page))\n params.set('pageSize', String(PAGE_SIZE))\n if (search.trim()) params.set('search', search.trim())\n const sort = sorting[0]\n if (sort?.id) {\n params.set('sortField', sort.id)\n params.set('sortDir', sort.desc ? 'desc' : 'asc')\n }\n const status = filterValues.status\n if (typeof status === 'string' && status.trim()) {\n params.set('status', status.trim())\n }\n if (filterValues.isActive === true) params.set('isActive', 'true')\n if (filterValues.isActive === false) params.set('isActive', 'false')\n if (filterValues.configurable === true) params.set('configurable', 'true')\n if (filterValues.configurable === false) params.set('configurable', 'false')\n if (typeof filterValues.productType === 'string' && filterValues.productType.trim()) {\n params.set('productType', filterValues.productType.trim())\n }\n if (Array.isArray(filterValues.channelIds) && filterValues.channelIds.length) {\n const values = filterValues.channelIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('channelIds', values.join(','))\n }\n if (Array.isArray(filterValues.categoryIds) && filterValues.categoryIds.length) {\n const values = filterValues.categoryIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('categoryIds', values.join(','))\n }\n if (Array.isArray(filterValues.tagIds) && filterValues.tagIds.length) {\n const values = filterValues.tagIds\n .map((value) => (typeof value === 'string' ? value : null))\n .filter((value): value is string => !!value)\n if (values.length) params.set('tagIds', values.join(','))\n }\n Object.entries(filterValues).forEach(([key, value]) => {\n if (!key.startsWith('cf_') || value == null) return\n if (Array.isArray(value)) {\n const entries = value\n .map((entry) => (typeof entry === 'string' ? entry.trim() : String(entry || '').trim()))\n .filter((entry) => entry.length > 0)\n if (entries.length) params.set(key, entries.join(','))\n } else if (typeof value === 'object' && value !== null && ('from' in (value as Record<string, unknown>) || 'to' in (value as Record<string, unknown>))) {\n const range = value as { from?: string; to?: string }\n if (typeof range.from === 'string' && range.from.trim().length) {\n params.set(`${key}:from`, range.from.trim())\n }\n if (typeof range.to === 'string' && range.to.trim().length) {\n params.set(`${key}:to`, range.to.trim())\n }\n } else if (typeof value === 'string' && value.trim()) {\n params.set(key, value.trim())\n }\n })\n if (typeof customFieldsetFilter === 'string' && customFieldsetFilter.trim().length > 0) {\n params.set('customFieldset', customFieldsetFilter.trim())\n }\n return params.toString()\n }, [customFieldsetFilter, filterValues, page, search, sorting])\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setIsLoading(true)\n try {\n const fallback: ProductsResponse = { items: [], total: 0, totalPages: 1 }\n const call = await apiCall<ProductsResponse>(\n `/api/catalog/products?${queryParams}`,\n undefined,\n { fallback },\n )\n if (!call.ok) {\n const message = t('catalog.products.list.error.load', 'Failed to load products')\n flash(message, 'error')\n return\n }\n const payload = call.result ?? fallback\n if (cancelled) return\n const items = Array.isArray(payload.items) ? payload.items : []\n const normalized = items.filter((item): item is ProductRow => typeof item?.id === 'string')\n setRows(normalized)\n setTotal(typeof payload.total === 'number' ? payload.total : normalized.length)\n setTotalPages(typeof payload.totalPages === 'number' ? payload.totalPages : 1)\n } catch (error) {\n if (!cancelled) {\n const message =\n error instanceof Error\n ? error.message\n : t('catalog.products.list.error.load', 'Failed to load products')\n flash(message, 'error')\n }\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [queryParams, reloadToken, scopeVersion, t])\n\n const handleDelete = React.useCallback(async (row: ProductRow) => {\n if (!window.confirm(t('catalog.products.list.deleteConfirm', 'Delete this product?'))) return\n try {\n await deleteCrud('catalog/products', row.id, {\n errorMessage: t('catalog.products.list.error.delete', 'Failed to delete product'),\n })\n flash(t('catalog.products.flash.deleted', 'Product deleted'), 'success')\n setReloadToken((token) => token + 1)\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : t('catalog.products.list.error.delete', 'Failed to delete product')\n flash(message, 'error')\n }\n }, [t])\n\n const currentParams = React.useMemo(() => Object.fromEntries(new URLSearchParams(queryParams)), [queryParams])\n\n const exportConfig = React.useMemo(() => ({\n view: {\n getUrl: (format: DataTableExportFormat) =>\n buildCrudExportUrl('catalog/products', { ...currentParams, exportScope: 'view' }, format),\n },\n full: {\n getUrl: (format: DataTableExportFormat) =>\n buildCrudExportUrl('catalog/products', { ...currentParams, exportScope: 'full', all: 'true' }, format),\n },\n }), [currentParams])\n\n return (\n <DataTable<ProductRow>\n title={t('catalog.products.page.title', 'Products & services')}\n entityId={ENTITY_ID}\n customFieldFilterKeyExtras={[scopeVersion, reloadToken]}\n refreshButton={{\n label: t('catalog.products.actions.refresh', 'Refresh'),\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n actions={(\n <Button asChild>\n <Link href=\"/backend/catalog/products/create\">\n {t('catalog.products.actions.create', 'Create')}\n </Link>\n </Button>\n )}\n columns={columns}\n data={rows}\n searchValue={search}\n onSearchChange={handleSearchChange}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onCustomFieldFilterFieldsetChange={handleCustomFieldsetFilterChange}\n sorting={sorting}\n onSortingChange={setSorting}\n injectionSpotId=\"data-table:catalog.products\"\n injectionContext={{\n search,\n filters: filterValues,\n page,\n scopeVersion,\n }}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n exporter={exportConfig}\n isLoading={isLoading}\n perspective={{ tableId: 'catalog.products.list' }}\n rowActions={(row) => (\n <RowActions\n items={[\n {\n label: t('catalog.products.table.actions.edit', 'Edit'),\n href: `/backend/catalog/products/${row.id}`,\n },\n {\n label: t('catalog.products.table.actions.delete', 'Delete'),\n destructive: true,\n onSelect: () => {\n void handleDelete(row)\n },\n },\n ]}\n />\n )}\n />\n )\n}\n"],
5
+ "mappings": ";AA8F6C,cA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3C;AAAA,YACA;AAAA,cACE,OAAO,EAAE,yCAAyC,QAAQ;AAAA,cAC1D,aAAa;AAAA,cACb,UAAU,MAAM;AACd,qBAAK,aAAa,GAAG;AAAA,cACvB;AAAA,YACF;AAAA,UACF;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,34 @@
1
+ import { createModuleEvents } from "@open-mercato/shared/modules/events";
2
+ const events = [
3
+ // Products
4
+ { id: "catalog.product.created", label: "Product Created", entity: "product", category: "crud" },
5
+ { id: "catalog.product.updated", label: "Product Updated", entity: "product", category: "crud" },
6
+ { id: "catalog.product.deleted", label: "Product Deleted", entity: "product", category: "crud" },
7
+ // Categories
8
+ { id: "catalog.category.created", label: "Category Created", entity: "category", category: "crud" },
9
+ { id: "catalog.category.updated", label: "Category Updated", entity: "category", category: "crud" },
10
+ { id: "catalog.category.deleted", label: "Category Deleted", entity: "category", category: "crud" },
11
+ // Variants
12
+ { id: "catalog.variant.created", label: "Variant Created", entity: "variant", category: "crud" },
13
+ { id: "catalog.variant.updated", label: "Variant Updated", entity: "variant", category: "crud" },
14
+ { id: "catalog.variant.deleted", label: "Variant Deleted", entity: "variant", category: "crud" },
15
+ // Prices
16
+ { id: "catalog.price.created", label: "Price Created", entity: "price", category: "crud" },
17
+ { id: "catalog.price.updated", label: "Price Updated", entity: "price", category: "crud" },
18
+ { id: "catalog.price.deleted", label: "Price Deleted", entity: "price", category: "crud" },
19
+ // Lifecycle events - Pricing resolution
20
+ { id: "catalog.pricing.resolve.before", label: "Before Pricing Resolve", category: "lifecycle", excludeFromTriggers: true },
21
+ { id: "catalog.pricing.resolve.after", label: "After Pricing Resolve", category: "lifecycle", excludeFromTriggers: true }
22
+ ];
23
+ const eventsConfig = createModuleEvents({
24
+ moduleId: "catalog",
25
+ events
26
+ });
27
+ const emitCatalogEvent = eventsConfig.emit;
28
+ var events_default = eventsConfig;
29
+ export {
30
+ events_default as default,
31
+ emitCatalogEvent,
32
+ eventsConfig
33
+ };
34
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/catalog/events.ts"],
4
+ "sourcesContent": ["import { createModuleEvents } from '@open-mercato/shared/modules/events'\n\n/**\n * Catalog Module Events\n *\n * Declares all events that can be emitted by the catalog module.\n */\nconst events = [\n // Products\n { id: 'catalog.product.created', label: 'Product Created', entity: 'product', category: 'crud' },\n { id: 'catalog.product.updated', label: 'Product Updated', entity: 'product', category: 'crud' },\n { id: 'catalog.product.deleted', label: 'Product Deleted', entity: 'product', category: 'crud' },\n\n // Categories\n { id: 'catalog.category.created', label: 'Category Created', entity: 'category', category: 'crud' },\n { id: 'catalog.category.updated', label: 'Category Updated', entity: 'category', category: 'crud' },\n { id: 'catalog.category.deleted', label: 'Category Deleted', entity: 'category', category: 'crud' },\n\n // Variants\n { id: 'catalog.variant.created', label: 'Variant Created', entity: 'variant', category: 'crud' },\n { id: 'catalog.variant.updated', label: 'Variant Updated', entity: 'variant', category: 'crud' },\n { id: 'catalog.variant.deleted', label: 'Variant Deleted', entity: 'variant', category: 'crud' },\n\n // Prices\n { id: 'catalog.price.created', label: 'Price Created', entity: 'price', category: 'crud' },\n { id: 'catalog.price.updated', label: 'Price Updated', entity: 'price', category: 'crud' },\n { id: 'catalog.price.deleted', label: 'Price Deleted', entity: 'price', category: 'crud' },\n\n // Lifecycle events - Pricing resolution\n { id: 'catalog.pricing.resolve.before', label: 'Before Pricing Resolve', category: 'lifecycle', excludeFromTriggers: true },\n { id: 'catalog.pricing.resolve.after', label: 'After Pricing Resolve', category: 'lifecycle', excludeFromTriggers: true },\n] as const\n\nexport const eventsConfig = createModuleEvents({\n moduleId: 'catalog',\n events,\n})\n\n/** Type-safe event emitter for catalog module */\nexport const emitCatalogEvent = eventsConfig.emit\n\n/** Event IDs that can be emitted by the catalog module */\nexport type CatalogEventId = typeof events[number]['id']\n\nexport default eventsConfig\n"],
5
+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names": []
7
+ }
@@ -1,6 +1,5 @@
1
1
  import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
2
2
  import { parseBooleanToken } from "@open-mercato/shared/lib/boolean";
3
- import { DEFAULT_NOTIFICATION_DELIVERY_CONFIG, NOTIFICATIONS_DELIVERY_CONFIG_KEY } from "../notifications/lib/deliveryConfig.js";
4
3
  function envDisablesAutoIndexing() {
5
4
  const raw = process.env.DISABLE_VECTOR_SEARCH_AUTOINDEXING;
6
5
  if (!raw) return false;
@@ -26,11 +25,6 @@ const restoreDefaults = {
26
25
  moduleId: "vector",
27
26
  name: "auto_index_enabled",
28
27
  value: defaultEnabled
29
- },
30
- {
31
- moduleId: "notifications",
32
- name: NOTIFICATIONS_DELIVERY_CONFIG_KEY,
33
- value: DEFAULT_NOTIFICATION_DELIVERY_CONFIG
34
28
  }
35
29
  ],
36
30
  { force: true }