@open-mercato/core 0.7.1-develop.7123.1.25365e718d → 0.7.1-develop.7131.1.20abf9e885

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 (234) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js +5 -0
  3. package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +2 -2
  4. package/dist/modules/auth/api/profile/route.js +5 -0
  5. package/dist/modules/auth/api/profile/route.js.map +2 -2
  6. package/dist/modules/customers/api/activities/route.js +13 -0
  7. package/dist/modules/customers/api/activities/route.js.map +2 -2
  8. package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js +9 -0
  9. package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js.map +2 -2
  10. package/dist/modules/customers/api/dictionaries/[kind]/route.js +5 -0
  11. package/dist/modules/customers/api/dictionaries/[kind]/route.js.map +2 -2
  12. package/dist/modules/customers/api/dictionaries/kind-settings/route.js +5 -0
  13. package/dist/modules/customers/api/dictionaries/kind-settings/route.js.map +2 -2
  14. package/dist/modules/customers/api/interactions/cancel/route.js +5 -0
  15. package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
  16. package/dist/modules/customers/api/interactions/complete/route.js +5 -0
  17. package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
  18. package/dist/modules/customers/api/labels/assign/route.js +5 -0
  19. package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
  20. package/dist/modules/customers/api/labels/route.js +5 -0
  21. package/dist/modules/customers/api/labels/route.js.map +2 -2
  22. package/dist/modules/customers/api/labels/unassign/route.js +5 -0
  23. package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
  24. package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +9 -0
  25. package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
  26. package/dist/modules/customers/api/people/[id]/companies/route.js +5 -0
  27. package/dist/modules/customers/api/people/[id]/companies/route.js.map +2 -2
  28. package/dist/modules/customers/api/pipeline-stages/reorder/route.js +5 -0
  29. package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
  30. package/dist/modules/customers/api/pipeline-stages/route.js +13 -0
  31. package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
  32. package/dist/modules/customers/api/pipelines/route.js +13 -0
  33. package/dist/modules/customers/api/pipelines/route.js.map +2 -2
  34. package/dist/modules/customers/api/settings/address-format/route.js +5 -0
  35. package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
  36. package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js +5 -0
  37. package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js.map +2 -2
  38. package/dist/modules/customers/api/settings/stuck-threshold/route.js +5 -0
  39. package/dist/modules/customers/api/settings/stuck-threshold/route.js.map +2 -2
  40. package/dist/modules/customers/api/tags/assign/route.js +5 -0
  41. package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
  42. package/dist/modules/customers/api/tags/unassign/route.js +5 -0
  43. package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
  44. package/dist/modules/customers/api/todos/route.js +13 -0
  45. package/dist/modules/customers/api/todos/route.js.map +2 -2
  46. package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js +5 -117
  47. package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js.map +2 -2
  48. package/dist/modules/customers/backend/customers/deals/[id]/page.js +1 -3
  49. package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
  50. package/dist/modules/customers/commands/deals.js +33 -9
  51. package/dist/modules/customers/commands/deals.js.map +3 -3
  52. package/dist/modules/customers/components/AddressEditor.js +71 -1
  53. package/dist/modules/customers/components/AddressEditor.js.map +2 -2
  54. package/dist/modules/customers/utils/addressFormat.js +18 -2
  55. package/dist/modules/customers/utils/addressFormat.js.map +2 -2
  56. package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js +9 -0
  57. package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js.map +2 -2
  58. package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js +5 -0
  59. package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js.map +2 -2
  60. package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +5 -0
  61. package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
  62. package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js +5 -0
  63. package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js.map +2 -2
  64. package/dist/modules/directory/api/organization-branding/route.js +5 -0
  65. package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
  66. package/dist/modules/eudr/api/plots/import/route.js.map +2 -2
  67. package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js.map +2 -2
  68. package/dist/modules/feature_toggles/api/overrides/route.js +5 -0
  69. package/dist/modules/feature_toggles/api/overrides/route.js.map +2 -2
  70. package/dist/modules/messages/api/[id]/actions/[actionId]/route.js +5 -0
  71. package/dist/modules/messages/api/[id]/actions/[actionId]/route.js.map +2 -2
  72. package/dist/modules/messages/api/[id]/conversation/archive/route.js +5 -0
  73. package/dist/modules/messages/api/[id]/conversation/archive/route.js.map +2 -2
  74. package/dist/modules/messages/api/[id]/conversation/read/route.js +5 -0
  75. package/dist/modules/messages/api/[id]/conversation/read/route.js.map +2 -2
  76. package/dist/modules/messages/api/[id]/conversation/route.js +5 -0
  77. package/dist/modules/messages/api/[id]/conversation/route.js.map +2 -2
  78. package/dist/modules/messages/api/[id]/forward/route.js +5 -0
  79. package/dist/modules/messages/api/[id]/forward/route.js.map +2 -2
  80. package/dist/modules/messages/api/[id]/reply/route.js +5 -0
  81. package/dist/modules/messages/api/[id]/reply/route.js.map +2 -2
  82. package/dist/modules/messages/api/[id]/route.js +9 -0
  83. package/dist/modules/messages/api/[id]/route.js.map +2 -2
  84. package/dist/modules/messages/api/token/[token]/route.js +5 -0
  85. package/dist/modules/messages/api/token/[token]/route.js.map +2 -2
  86. package/dist/modules/resources/api/resources/tags/assign/route.js +5 -0
  87. package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
  88. package/dist/modules/resources/api/resources/tags/unassign/route.js +5 -0
  89. package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
  90. package/dist/modules/sales/api/quotes/accept/route.js +5 -0
  91. package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
  92. package/dist/modules/sales/api/quotes/convert/route.js +5 -0
  93. package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
  94. package/dist/modules/sales/api/settings/document-numbers/route.js +5 -0
  95. package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
  96. package/dist/modules/sales/api/settings/order-editing/route.js +5 -0
  97. package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
  98. package/dist/modules/sales/components/documents/AddressesSection.js +17 -2
  99. package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
  100. package/dist/modules/sales/components/documents/SalesDocumentForm.js +7 -24
  101. package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
  102. package/dist/modules/sales/components/documents/normalizeAddressDraft.js +29 -0
  103. package/dist/modules/sales/components/documents/normalizeAddressDraft.js.map +7 -0
  104. package/dist/modules/staff/api/leave-requests/accept/route.js +5 -0
  105. package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
  106. package/dist/modules/staff/api/leave-requests/reject/route.js +5 -0
  107. package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
  108. package/dist/modules/staff/api/team-members/self/route.js +5 -0
  109. package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
  110. package/dist/modules/staff/api/team-members/tags/assign/route.js +5 -0
  111. package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
  112. package/dist/modules/staff/api/team-members/tags/unassign/route.js +5 -0
  113. package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
  114. package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +5 -0
  115. package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
  116. package/dist/modules/translations/api/[entityType]/[entityId]/route.js +9 -0
  117. package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
  118. package/dist/modules/warranty_claims/api/ai/assess/route.js +5 -0
  119. package/dist/modules/warranty_claims/api/ai/assess/route.js.map +2 -2
  120. package/dist/modules/warranty_claims/api/assign/route.js +5 -0
  121. package/dist/modules/warranty_claims/api/assign/route.js.map +2 -2
  122. package/dist/modules/warranty_claims/api/credit-memo/route.js +5 -0
  123. package/dist/modules/warranty_claims/api/credit-memo/route.js.map +2 -2
  124. package/dist/modules/warranty_claims/api/events/route.js +5 -0
  125. package/dist/modules/warranty_claims/api/events/route.js.map +2 -2
  126. package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js +5 -0
  127. package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js.map +2 -2
  128. package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js +5 -0
  129. package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js.map +2 -2
  130. package/dist/modules/warranty_claims/api/portal/claims/route.js +5 -0
  131. package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
  132. package/dist/modules/warranty_claims/api/portal/events/route.js +5 -0
  133. package/dist/modules/warranty_claims/api/portal/events/route.js.map +2 -2
  134. package/dist/modules/warranty_claims/api/receiving/route.js +5 -0
  135. package/dist/modules/warranty_claims/api/receiving/route.js.map +2 -2
  136. package/dist/modules/warranty_claims/api/replacement-order/route.js +5 -0
  137. package/dist/modules/warranty_claims/api/replacement-order/route.js.map +2 -2
  138. package/dist/modules/warranty_claims/api/return-label/route.js +5 -0
  139. package/dist/modules/warranty_claims/api/return-label/route.js.map +2 -2
  140. package/dist/modules/warranty_claims/api/sales-return/route.js +5 -0
  141. package/dist/modules/warranty_claims/api/sales-return/route.js.map +2 -2
  142. package/dist/modules/warranty_claims/api/settings-general/route.js +5 -0
  143. package/dist/modules/warranty_claims/api/settings-general/route.js.map +2 -2
  144. package/dist/modules/warranty_claims/api/submit/route.js +5 -0
  145. package/dist/modules/warranty_claims/api/submit/route.js.map +2 -2
  146. package/dist/modules/warranty_claims/api/transition/route.js +5 -0
  147. package/dist/modules/warranty_claims/api/transition/route.js.map +2 -2
  148. package/dist/modules/warranty_claims/api/vendor-recovery/route.js +5 -0
  149. package/dist/modules/warranty_claims/api/vendor-recovery/route.js.map +2 -2
  150. package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +5 -0
  151. package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +2 -2
  152. package/package.json +7 -7
  153. package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +5 -0
  154. package/src/modules/auth/api/profile/route.ts +5 -0
  155. package/src/modules/customers/api/activities/route.ts +13 -0
  156. package/src/modules/customers/api/dictionaries/[kind]/[id]/route.ts +9 -0
  157. package/src/modules/customers/api/dictionaries/[kind]/route.ts +5 -0
  158. package/src/modules/customers/api/dictionaries/kind-settings/route.ts +5 -0
  159. package/src/modules/customers/api/interactions/cancel/route.ts +5 -0
  160. package/src/modules/customers/api/interactions/complete/route.ts +5 -0
  161. package/src/modules/customers/api/labels/assign/route.ts +5 -0
  162. package/src/modules/customers/api/labels/route.ts +5 -0
  163. package/src/modules/customers/api/labels/unassign/route.ts +5 -0
  164. package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +9 -0
  165. package/src/modules/customers/api/people/[id]/companies/route.ts +5 -0
  166. package/src/modules/customers/api/pipeline-stages/reorder/route.ts +5 -0
  167. package/src/modules/customers/api/pipeline-stages/route.ts +13 -0
  168. package/src/modules/customers/api/pipelines/route.ts +13 -0
  169. package/src/modules/customers/api/settings/address-format/route.ts +5 -0
  170. package/src/modules/customers/api/settings/dictionary-sort-modes/route.ts +5 -0
  171. package/src/modules/customers/api/settings/stuck-threshold/route.ts +5 -0
  172. package/src/modules/customers/api/tags/assign/route.ts +5 -0
  173. package/src/modules/customers/api/tags/unassign/route.ts +5 -0
  174. package/src/modules/customers/api/todos/route.ts +13 -0
  175. package/src/modules/customers/backend/customers/deals/[id]/hooks/types.ts +0 -23
  176. package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.ts +11 -172
  177. package/src/modules/customers/backend/customers/deals/[id]/page.tsx +1 -1
  178. package/src/modules/customers/commands/deals.ts +84 -9
  179. package/src/modules/customers/components/AddressEditor.tsx +116 -1
  180. package/src/modules/customers/i18n/de.json +6 -0
  181. package/src/modules/customers/i18n/en.json +6 -0
  182. package/src/modules/customers/i18n/es.json +6 -0
  183. package/src/modules/customers/i18n/ko.json +6 -0
  184. package/src/modules/customers/i18n/pl.json +6 -0
  185. package/src/modules/customers/utils/addressFormat.tsx +59 -1
  186. package/src/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.ts +9 -0
  187. package/src/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.ts +5 -0
  188. package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +5 -0
  189. package/src/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.ts +5 -0
  190. package/src/modules/directory/api/organization-branding/route.ts +5 -0
  191. package/src/modules/eudr/api/plots/import/route.ts +7 -0
  192. package/src/modules/eudr/api/product-mappings/suggestions/apply/route.ts +7 -0
  193. package/src/modules/feature_toggles/api/overrides/route.ts +5 -0
  194. package/src/modules/messages/api/[id]/actions/[actionId]/route.ts +5 -0
  195. package/src/modules/messages/api/[id]/conversation/archive/route.ts +5 -0
  196. package/src/modules/messages/api/[id]/conversation/read/route.ts +5 -0
  197. package/src/modules/messages/api/[id]/conversation/route.ts +5 -0
  198. package/src/modules/messages/api/[id]/forward/route.ts +5 -0
  199. package/src/modules/messages/api/[id]/reply/route.ts +5 -0
  200. package/src/modules/messages/api/[id]/route.ts +9 -0
  201. package/src/modules/messages/api/token/[token]/route.ts +5 -0
  202. package/src/modules/resources/api/resources/tags/assign/route.ts +5 -0
  203. package/src/modules/resources/api/resources/tags/unassign/route.ts +5 -0
  204. package/src/modules/sales/api/quotes/accept/route.ts +5 -0
  205. package/src/modules/sales/api/quotes/convert/route.ts +5 -0
  206. package/src/modules/sales/api/settings/document-numbers/route.ts +5 -0
  207. package/src/modules/sales/api/settings/order-editing/route.ts +5 -0
  208. package/src/modules/sales/components/documents/AddressesSection.tsx +48 -5
  209. package/src/modules/sales/components/documents/SalesDocumentForm.tsx +5 -23
  210. package/src/modules/sales/components/documents/normalizeAddressDraft.ts +29 -0
  211. package/src/modules/staff/api/leave-requests/accept/route.ts +5 -0
  212. package/src/modules/staff/api/leave-requests/reject/route.ts +5 -0
  213. package/src/modules/staff/api/team-members/self/route.ts +5 -0
  214. package/src/modules/staff/api/team-members/tags/assign/route.ts +5 -0
  215. package/src/modules/staff/api/team-members/tags/unassign/route.ts +5 -0
  216. package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +5 -0
  217. package/src/modules/translations/api/[entityType]/[entityId]/route.ts +9 -0
  218. package/src/modules/warranty_claims/api/ai/assess/route.ts +5 -0
  219. package/src/modules/warranty_claims/api/assign/route.ts +5 -0
  220. package/src/modules/warranty_claims/api/credit-memo/route.ts +5 -0
  221. package/src/modules/warranty_claims/api/events/route.ts +5 -0
  222. package/src/modules/warranty_claims/api/portal/claims/[id]/submit/route.ts +5 -0
  223. package/src/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.ts +5 -0
  224. package/src/modules/warranty_claims/api/portal/claims/route.ts +5 -0
  225. package/src/modules/warranty_claims/api/portal/events/route.ts +5 -0
  226. package/src/modules/warranty_claims/api/receiving/route.ts +5 -0
  227. package/src/modules/warranty_claims/api/replacement-order/route.ts +5 -0
  228. package/src/modules/warranty_claims/api/return-label/route.ts +5 -0
  229. package/src/modules/warranty_claims/api/sales-return/route.ts +5 -0
  230. package/src/modules/warranty_claims/api/settings-general/route.ts +5 -0
  231. package/src/modules/warranty_claims/api/submit/route.ts +5 -0
  232. package/src/modules/warranty_claims/api/transition/route.ts +5 -0
  233. package/src/modules/warranty_claims/api/vendor-recovery/route.ts +5 -0
  234. package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +5 -0
@@ -1867,11 +1867,17 @@
1867
1867
  "customers.people.detail.addresses.fields.line1": "Adres (linia 1)",
1868
1868
  "customers.people.detail.addresses.fields.line2": "Adres (linia 2)",
1869
1869
  "customers.people.detail.addresses.fields.longitude": "Długość geograficzna",
1870
+ "customers.people.detail.addresses.fields.phone": "Telefon",
1870
1871
  "customers.people.detail.addresses.fields.postalCode": "Kod pocztowy",
1871
1872
  "customers.people.detail.addresses.fields.primary": "Ustaw jako główny",
1872
1873
  "customers.people.detail.addresses.fields.region": "Region / województwo",
1873
1874
  "customers.people.detail.addresses.fields.street": "Ulica",
1874
1875
  "customers.people.detail.addresses.fields.streetExtra": "Dodatkowe informacje adresowe",
1876
+ "customers.people.detail.addresses.fields.taxId": "Nr podatkowy",
1877
+ "customers.people.detail.addresses.fields.taxId.euVat": "VAT UE",
1878
+ "customers.people.detail.addresses.fields.taxId.other": "Nr podatkowy",
1879
+ "customers.people.detail.addresses.fields.taxId.plNip": "NIP",
1880
+ "customers.people.detail.addresses.fields.taxIdType": "Typ numeru",
1875
1881
  "customers.people.detail.addresses.fields.type": "Typ adresu",
1876
1882
  "customers.people.detail.addresses.formatLoadError": "Nie udało się wczytać konfiguracji adresów",
1877
1883
  "customers.people.detail.addresses.formatLoading": "Ładowanie preferencji adresowych…",
@@ -13,6 +13,34 @@ export type AddressValue = {
13
13
  postalCode?: string | null
14
14
  country?: string | null
15
15
  companyName?: string | null
16
+ /**
17
+ * Contact details that belong to the ADDRESS rather than to the customer: who to call about this
18
+ * delivery, and the tax identifier this invoice address was billed under. They remain available to
19
+ * address editors and snapshot payloads, but are deliberately excluded from `formatAddressLines`
20
+ * and `AddressView`, whose existing contract remains postal-only.
21
+ *
22
+ * `taxIdType` interprets the value in Stripe's `{country}_{kind}` vocabulary (`pl_nip`, `eu_vat`,
23
+ * `other`, widened additively): `1234567890` and `PL1234567890` are the same business, and only the
24
+ * type tells a domestic identifier from an EU VAT number. It is metadata about `taxId`, never a
25
+ * displayed field of its own.
26
+ */
27
+ phone?: string | null
28
+ taxId?: string | null
29
+ taxIdType?: string | null
30
+ }
31
+
32
+ /**
33
+ * Tax-id labels keyed by `taxIdType`, for a caller that wants the identifier named correctly rather
34
+ * than generically.
35
+ *
36
+ * The stored scheme is chosen explicitly rather than inferred from the identifier. `other` also
37
+ * covers an address written before `taxIdType` existed. An unrecognised type takes the `other` route
38
+ * instead of guessing a domestic scheme.
39
+ */
40
+ export type TaxIdLabelByType = {
41
+ plNip: string
42
+ euVat: string
43
+ other: string
16
44
  }
17
45
 
18
46
  export type AddressJsonShape = {
@@ -100,6 +128,31 @@ export function formatAddressString(address: AddressValue, format: AddressFormat
100
128
  return formatAddressLines(address, format).filter(Boolean).join(separator)
101
129
  }
102
130
 
131
+ /**
132
+ * Which member of a label map names which scheme. Private, and deliberately not exhaustive: an
133
+ * unrecognised type resolves to `other`, so the vocabulary can widen without every caller being
134
+ * updated in the same release.
135
+ */
136
+ const TAX_ID_LABEL_KEY_BY_TYPE: Record<string, keyof TaxIdLabelByType> = {
137
+ pl_nip: 'plNip',
138
+ eu_vat: 'euVat',
139
+ }
140
+
141
+ /**
142
+ * The label a tax identifier should carry, given its type. Exported because the editor renders the
143
+ * same identifier as an input and must name it the same way this formatter does — two copies of the
144
+ * mapping is exactly how a foreign number ends up under a domestic scheme's name.
145
+ */
146
+ export function resolveTaxIdLabel(
147
+ label: string | TaxIdLabelByType | undefined,
148
+ taxIdType: string | null | undefined,
149
+ ): string | undefined {
150
+ if (!label) return undefined
151
+ if (typeof label === 'string') return label
152
+ const key = TAX_ID_LABEL_KEY_BY_TYPE[typeof taxIdType === 'string' ? taxIdType : ''] ?? 'other'
153
+ return label[key]
154
+ }
155
+
103
156
  type AddressViewProps = {
104
157
  address: AddressValue
105
158
  format: AddressFormatStrategy
@@ -107,7 +160,12 @@ type AddressViewProps = {
107
160
  lineClassName?: string
108
161
  }
109
162
 
110
- export function AddressView({ address, format, className, lineClassName }: AddressViewProps): React.ReactElement | null {
163
+ export function AddressView({
164
+ address,
165
+ format,
166
+ className,
167
+ lineClassName,
168
+ }: AddressViewProps): React.ReactElement | null {
111
169
  const lines = formatAddressLines(address, format)
112
170
  if (!lines.length) return null
113
171
  return (
@@ -22,6 +22,7 @@ import {
22
22
  updateDictionaryEntrySchema as updateEntryDocSchema,
23
23
  } from '../../../openapi'
24
24
  import { createLogger } from '@open-mercato/shared/lib/logger'
25
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
25
26
 
26
27
  const logger = createLogger('dictionaries').child({ component: 'entries-api' })
27
28
  const paramsSchema = z.object({
@@ -167,6 +168,10 @@ export async function PATCH(req: Request, ctx: { params?: { dictionaryId?: strin
167
168
  if (isCrudHttpError(err)) {
168
169
  return NextResponse.json(err.body, { status: err.status })
169
170
  }
171
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
172
+ if (interceptorRejection) {
173
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
174
+ }
170
175
  if (err instanceof z.ZodError) {
171
176
  return NextResponse.json({ error: 'Invalid input', details: err.issues }, { status: 400 })
172
177
  }
@@ -244,6 +249,10 @@ export async function DELETE(req: Request, ctx: { params?: { dictionaryId?: stri
244
249
  if (isCrudHttpError(err)) {
245
250
  return NextResponse.json(err.body, { status: err.status })
246
251
  }
252
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
253
+ if (interceptorRejection) {
254
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
255
+ }
247
256
  if (err instanceof z.ZodError) {
248
257
  return NextResponse.json({ error: 'Invalid input', details: err.issues }, { status: 400 })
249
258
  }
@@ -26,6 +26,7 @@ import {
26
26
  } from '../../../openapi'
27
27
  import { resolveDictionaryActorId } from '../../../context'
28
28
  import { createLogger } from '@open-mercato/shared/lib/logger'
29
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
29
30
 
30
31
  const logger = createLogger('dictionaries').child({ component: 'entries-api' })
31
32
 
@@ -130,6 +131,10 @@ export async function POST(req: Request, ctx: { params?: { dictionaryId?: string
130
131
  if (isCrudHttpError(err)) {
131
132
  return NextResponse.json(err.body, { status: err.status })
132
133
  }
134
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
135
+ if (interceptorRejection) {
136
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
137
+ }
133
138
  if (err instanceof z.ZodError) {
134
139
  return NextResponse.json({ error: 'Invalid input', details: err.issues }, { status: 400 })
135
140
  }
@@ -37,6 +37,7 @@ import {
37
37
  sortDictionaryEntries,
38
38
  } from '@open-mercato/core/modules/dictionaries/lib/entrySort'
39
39
  import { createLogger } from '@open-mercato/shared/lib/logger'
40
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
40
41
 
41
42
  const logger = createLogger('dictionaries').child({ component: 'entries-api' })
42
43
 
@@ -282,6 +283,10 @@ export async function POST(req: Request, ctx: { params?: { dictionaryId?: string
282
283
  if (isCrudHttpError(err)) {
283
284
  return NextResponse.json(err.body, { status: err.status })
284
285
  }
286
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
287
+ if (interceptorRejection) {
288
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
289
+ }
285
290
  if (err instanceof z.ZodError) {
286
291
  return NextResponse.json({ error: 'Invalid input', details: err.issues }, { status: 400 })
287
292
  }
@@ -26,6 +26,7 @@ import {
26
26
  } from '../../../openapi'
27
27
  import { resolveDictionaryActorId } from '../../../context'
28
28
  import { createLogger } from '@open-mercato/shared/lib/logger'
29
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
29
30
 
30
31
  const logger = createLogger('dictionaries').child({ component: 'entries-api' })
31
32
 
@@ -130,6 +131,10 @@ export async function POST(req: Request, ctx: { params?: { dictionaryId?: string
130
131
  if (isCrudHttpError(err)) {
131
132
  return NextResponse.json(err.body, { status: err.status })
132
133
  }
134
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
135
+ if (interceptorRejection) {
136
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
137
+ }
133
138
  if (err instanceof z.ZodError) {
134
139
  return NextResponse.json({ error: 'Invalid input', details: err.issues }, { status: 400 })
135
140
  }
@@ -19,6 +19,7 @@ import { organizationUpdateSchema } from '@open-mercato/core/modules/directory/d
19
19
  import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
20
20
  import '@open-mercato/core/modules/directory/commands/organizations'
21
21
  import { createLogger } from '@open-mercato/shared/lib/logger'
22
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
22
23
 
23
24
  const logger = createLogger('directory').child({ component: 'organization-branding' })
24
25
 
@@ -268,6 +269,10 @@ export async function PUT(req: Request) {
268
269
  if (isCrudHttpError(err)) {
269
270
  return NextResponse.json(err.body, { status: err.status })
270
271
  }
272
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
273
+ if (interceptorRejection) {
274
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
275
+ }
271
276
  logger.error('Organization branding update failed', { err })
272
277
  return NextResponse.json(
273
278
  { error: resolved.translate('directory.branding.errors.save', 'Failed to update organization branding.') },
@@ -323,6 +323,13 @@ export async function POST(req: Request) {
323
323
  if (isCrudHttpError(error)) {
324
324
  return Response.json(error.body, { status: error.status })
325
325
  }
326
+ // No command-interceptor mapping here (issue #5097): every `commandBus.execute`
327
+ // in this route runs inside the per-item loop above, whose catch records the
328
+ // failure in `failed[]` and continues, so an interceptor rejection can never
329
+ // reach this handler. The batch contract — HTTP 200 with a per-item failure
330
+ // list — is deliberately unchanged; the route is listed in
331
+ // `ROUTES_WITH_BATCH_ITEM_ERROR_HANDLING` in
332
+ // `packages/core/src/__tests__/command-interceptor-http-coverage.test.ts`.
326
333
  const { translate } = await resolveTranslations()
327
334
  if (error instanceof z.ZodError) {
328
335
  return Response.json(
@@ -337,6 +337,13 @@ export async function POST(req: Request) {
337
337
  if (isCrudHttpError(error)) {
338
338
  return Response.json(error.body, { status: error.status })
339
339
  }
340
+ // No command-interceptor mapping here (issue #5097): every `commandBus.execute`
341
+ // in this route runs inside the per-item loop above, whose catch records the
342
+ // failure in `failed[]` and continues, so an interceptor rejection can never
343
+ // reach this handler. The batch contract — HTTP 200 with a per-item failure
344
+ // list — is deliberately unchanged; the route is listed in
345
+ // `ROUTES_WITH_BATCH_ITEM_ERROR_HANDLING` in
346
+ // `packages/core/src/__tests__/command-interceptor-http-coverage.test.ts`.
340
347
  const { translate } = await resolveTranslations()
341
348
  if (error instanceof z.ZodError) {
342
349
  return Response.json(
@@ -25,6 +25,7 @@ import {
25
25
  } from '../openapi'
26
26
  import type { OpenApiRouteDoc, OpenApiMethodDoc } from '@open-mercato/shared/lib/openapi'
27
27
  import { createLogger } from '@open-mercato/shared/lib/logger'
28
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
28
29
 
29
30
  const logger = createLogger('feature_toggles').child({ component: 'overrides' })
30
31
 
@@ -186,6 +187,10 @@ export async function PUT(req: Request) {
186
187
  if (isCrudHttpError(error)) {
187
188
  return NextResponse.json(error.body, { status: error.status })
188
189
  }
190
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
191
+ if (interceptorRejection) {
192
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
193
+ }
189
194
  const message = error instanceof Error ? error.message : 'Unknown error'
190
195
  if (message === 'NOT_FOUND') return NextResponse.json({ error: 'Not found' }, { status: 404 })
191
196
  if (message === 'INVALID_STATE' || message === 'INVALID_TOGGLE_ID' || message === 'INVALID_TENANT_ID') {
@@ -6,6 +6,7 @@ import { resolveMessageContext } from '../../../../lib/routeHelpers'
6
6
  import { resolveUserFeatures, runMessageMutationGuardAfterSuccess, runMessageMutationGuards } from '../../../guards'
7
7
  import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi/types'
8
8
  import { actionResultResponseSchema } from '../../../openapi'
9
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
9
10
 
10
11
  export const metadata = {
11
12
  POST: { requireAuth: true, requireFeatures: ['messages.actions'] },
@@ -95,6 +96,10 @@ export async function POST(
95
96
  if (isCrudHttpError(error)) {
96
97
  return Response.json(error.body, { status: error.status })
97
98
  }
99
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
100
+ if (interceptorRejection) {
101
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
102
+ }
98
103
  if (error instanceof Error) {
99
104
  if (error.message === 'Message not found') {
100
105
  return Response.json({ error: 'Message not found' }, { status: 404 })
@@ -7,6 +7,7 @@ import {
7
7
  conversationMutationResponseSchema,
8
8
  errorResponseSchema,
9
9
  } from '../../../openapi'
10
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
10
11
 
11
12
  export const metadata = {
12
13
  PUT: { requireAuth: true, requireFeatures: ['messages.view'] },
@@ -78,6 +79,10 @@ async function runConversationArchiveMutation(
78
79
  })
79
80
  return response
80
81
  } catch (error) {
82
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
83
+ if (interceptorRejection) {
84
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
85
+ }
81
86
  if (error instanceof Error) {
82
87
  if (error.message === 'Message not found') {
83
88
  return Response.json({ error: error.message }, { status: 404 })
@@ -7,6 +7,7 @@ import {
7
7
  conversationMutationResponseSchema,
8
8
  errorResponseSchema,
9
9
  } from '../../../openapi'
10
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
10
11
 
11
12
  export const metadata = {
12
13
  PUT: { requireAuth: true, requireFeatures: ['messages.view'] },
@@ -78,6 +79,10 @@ async function runConversationReadMutation(
78
79
  })
79
80
  return response
80
81
  } catch (error) {
82
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
83
+ if (interceptorRejection) {
84
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
85
+ }
81
86
  if (error instanceof Error) {
82
87
  if (error.message === 'Message not found') {
83
88
  return Response.json({ error: error.message }, { status: 404 })
@@ -7,6 +7,7 @@ import {
7
7
  conversationMutationResponseSchema,
8
8
  errorResponseSchema,
9
9
  } from '../../openapi'
10
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
10
11
 
11
12
  export const metadata = {
12
13
  DELETE: { requireAuth: true, requireFeatures: ['messages.view'] },
@@ -73,6 +74,10 @@ export async function DELETE(req: Request, { params }: { params: { id: string }
73
74
  })
74
75
  return response
75
76
  } catch (error) {
77
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
78
+ if (interceptorRejection) {
79
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
80
+ }
76
81
  if (error instanceof Error) {
77
82
  if (error.message === 'Message not found') {
78
83
  return Response.json({ error: error.message }, { status: 404 })
@@ -6,6 +6,7 @@ import { resolveUserFeatures, runMessageMutationGuardAfterSuccess, runMessageMut
6
6
  import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi/types'
7
7
  import { forwardResponseSchema, forwardMessageSchema as forwardSchema } from '../../openapi'
8
8
  import { MessageCommandExecuteResult } from '../../../commands/shared'
9
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
9
10
 
10
11
  export const metadata = {
11
12
  POST: { requireAuth: true, requireFeatures: ['messages.compose'] },
@@ -62,6 +63,10 @@ export async function POST(req: Request, { params }: { params: { id: string } })
62
63
  },
63
64
  })
64
65
  } catch (error) {
66
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
67
+ if (interceptorRejection) {
68
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
69
+ }
65
70
  if (error instanceof Error) {
66
71
  if (error.message === 'Message not found') {
67
72
  return Response.json({ error: 'Message not found' }, { status: 404 })
@@ -10,6 +10,7 @@ import {
10
10
  replyMessageSchema as replyOpenApiSchema,
11
11
  } from '../../openapi'
12
12
  import { MessageCommandExecuteResult } from '../../../commands/shared'
13
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
13
14
 
14
15
  export const metadata = {
15
16
  POST: { requireAuth: true, requireFeatures: ['messages.compose'] },
@@ -66,6 +67,10 @@ export async function POST(req: Request, { params }: { params: { id: string } })
66
67
  },
67
68
  })
68
69
  } catch (error) {
70
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
71
+ if (interceptorRejection) {
72
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
73
+ }
69
74
  if (error instanceof Error) {
70
75
  if (error.message === 'Message not found') {
71
76
  return Response.json({ error: 'Message not found' }, { status: 404 })
@@ -22,6 +22,7 @@ import {
22
22
  updateDraftSchema as updateDraftOpenApiSchema,
23
23
  } from '../openapi'
24
24
  import { createLogger } from '@open-mercato/shared/lib/logger'
25
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
25
26
 
26
27
  const logger = createLogger('messages').child({ component: 'api' })
27
28
 
@@ -421,6 +422,10 @@ export async function PATCH(req: Request, { params }: { params: { id: string } }
421
422
  if (isCrudHttpError(error)) {
422
423
  return Response.json(error.body, { status: error.status })
423
424
  }
425
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
426
+ if (interceptorRejection) {
427
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
428
+ }
424
429
  if (error instanceof Error) {
425
430
  if (error.message === 'Message type cannot be created by users') {
426
431
  return Response.json({ error: error.message }, { status: 400 })
@@ -546,6 +551,10 @@ export async function DELETE(req: Request, { params }: { params: { id: string }
546
551
  if (isCrudHttpError(error)) {
547
552
  return Response.json(error.body, { status: error.status })
548
553
  }
554
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
555
+ if (interceptorRejection) {
556
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
557
+ }
549
558
  if (error instanceof Error && error.message === 'Access denied') {
550
559
  return Response.json({ error: 'Access denied' }, { status: 403 })
551
560
  }
@@ -8,6 +8,7 @@ import { Message, MessageAccessToken, MessageObject, MessageRecipient } from '..
8
8
  import { MAX_TOKEN_USE_COUNT } from '../../../commands/tokens'
9
9
  import { messageTokenResponseSchema } from '../../openapi'
10
10
  import { hashAuthToken } from '../../../../auth/lib/tokenHash'
11
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
11
12
 
12
13
  export const metadata = {
13
14
  GET: { requireAuth: false },
@@ -134,6 +135,10 @@ export async function GET(req: Request, { params }: { params: { token: string }
134
135
  })
135
136
  commandResult = executed.result
136
137
  } catch (error) {
138
+ const interceptorRejection = getCommandInterceptorHttpRejection(error)
139
+ if (interceptorRejection) {
140
+ return Response.json(interceptorRejection.body, { status: interceptorRejection.status })
141
+ }
137
142
  const errorResponse = responseForTokenError(error)
138
143
  if (errorResponse) return errorResponse
139
144
  throw error
@@ -18,6 +18,7 @@ import {
18
18
  type ResourcesResourceTagAssignmentInput,
19
19
  } from '../../../../data/validators'
20
20
  import { createLogger } from '@open-mercato/shared/lib/logger'
21
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
21
22
 
22
23
  const logger = createLogger('resources').child({ component: 'tags' })
23
24
 
@@ -112,6 +113,10 @@ export async function POST(req: Request) {
112
113
  if (isCrudHttpError(err)) {
113
114
  return NextResponse.json(err.body, { status: err.status })
114
115
  }
116
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
117
+ if (interceptorRejection) {
118
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
119
+ }
115
120
  const { translate } = await resolveTranslations()
116
121
  logger.error('Tag assign failed', { err })
117
122
  return NextResponse.json({ error: translate('resources.resources.tags.updateError', 'Failed to update tags.') }, { status: 400 })
@@ -18,6 +18,7 @@ import {
18
18
  type ResourcesResourceTagAssignmentInput,
19
19
  } from '../../../../data/validators'
20
20
  import { createLogger } from '@open-mercato/shared/lib/logger'
21
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
21
22
 
22
23
  const logger = createLogger('resources').child({ component: 'tags' })
23
24
 
@@ -112,6 +113,10 @@ export async function POST(req: Request) {
112
113
  if (isCrudHttpError(err)) {
113
114
  return NextResponse.json(err.body, { status: err.status })
114
115
  }
116
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
117
+ if (interceptorRejection) {
118
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
119
+ }
115
120
  const { translate } = await resolveTranslations()
116
121
  logger.error('Tag unassign failed', { err })
117
122
  return NextResponse.json({ error: translate('resources.resources.tags.updateError', 'Failed to update tags.') }, { status: 400 })
@@ -21,6 +21,7 @@ import { resolveStatusEntryIdByValue } from '../../../lib/statusHelpers'
21
21
  import { resolveEffectiveTenantId } from '../../../lib/publicQuoteTenantScope'
22
22
  import { QuoteAcceptedAdminEmail } from '../../../emails/QuoteAcceptedAdminEmail'
23
23
  import { createLogger } from '@open-mercato/shared/lib/logger'
24
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
24
25
 
25
26
  const logger = createLogger('sales')
26
27
 
@@ -179,6 +180,10 @@ export async function POST(req: Request) {
179
180
  if (isCrudHttpError(err)) {
180
181
  return NextResponse.json(err.body, { status: err.status })
181
182
  }
183
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
184
+ if (interceptorRejection) {
185
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
186
+ }
182
187
  const { translate } = await resolveTranslations()
183
188
  logger.error('sales.quotes.accept failed', { err })
184
189
  return NextResponse.json({ error: translate('sales.quotes.accept.failed', 'Failed to accept quote.') }, { status: 400 })
@@ -16,6 +16,7 @@ import {
16
16
  } from '@open-mercato/shared/lib/crud/mutation-guard-registry'
17
17
  import { withScopedPayload } from '../../utils'
18
18
  import { createLogger } from '@open-mercato/shared/lib/logger'
19
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
19
20
 
20
21
  const logger = createLogger('sales')
21
22
 
@@ -175,6 +176,10 @@ export async function POST(req: Request) {
175
176
  if (isCrudHttpError(err)) {
176
177
  return NextResponse.json(err.body, { status: err.status })
177
178
  }
179
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
180
+ if (interceptorRejection) {
181
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
182
+ }
178
183
  const { translate } = await resolveTranslations()
179
184
  logger.error('sales.quotes.convert failed', { err })
180
185
  return NextResponse.json(
@@ -19,6 +19,7 @@ import {
19
19
  validateCrudMutationGuard,
20
20
  } from '@open-mercato/shared/lib/crud/mutation-guard'
21
21
  import { createLogger } from '@open-mercato/shared/lib/logger'
22
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
22
23
 
23
24
  const logger = createLogger('sales')
24
25
 
@@ -160,6 +161,10 @@ export async function PUT(req: Request) {
160
161
  if (isCrudHttpError(err)) {
161
162
  return NextResponse.json(err.body, { status: err.status })
162
163
  }
164
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
165
+ if (interceptorRejection) {
166
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
167
+ }
163
168
  const { translate } = await resolveTranslations()
164
169
  logger.error('sales.settings.document-numbers.put failed', { err })
165
170
  return NextResponse.json(
@@ -20,6 +20,7 @@ import {
20
20
  import { ensureSalesDictionary } from '../../../lib/dictionaries'
21
21
  import { DictionaryEntry } from '@open-mercato/core/modules/dictionaries/data/entities'
22
22
  import { createLogger } from '@open-mercato/shared/lib/logger'
23
+ import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
23
24
 
24
25
  const logger = createLogger('sales')
25
26
 
@@ -179,6 +180,10 @@ export async function PUT(req: Request) {
179
180
  if (isCrudHttpError(err)) {
180
181
  return NextResponse.json(err.body, { status: err.status })
181
182
  }
183
+ const interceptorRejection = getCommandInterceptorHttpRejection(err)
184
+ if (interceptorRejection) {
185
+ return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
186
+ }
182
187
  const { translate } = await resolveTranslations()
183
188
  logger.error('sales.settings.order-editing.put failed', { err })
184
189
  return NextResponse.json(