@endora-commerce/contracts 0.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/actor.d.ts +79 -0
  4. package/dist/actor.d.ts.map +1 -0
  5. package/dist/actor.js +41 -0
  6. package/dist/actor.js.map +1 -0
  7. package/dist/addresses.d.ts +134 -0
  8. package/dist/addresses.d.ts.map +1 -0
  9. package/dist/addresses.js +16 -0
  10. package/dist/addresses.js.map +1 -0
  11. package/dist/admin-actions.d.ts +367 -0
  12. package/dist/admin-actions.d.ts.map +1 -0
  13. package/dist/admin-actions.js +287 -0
  14. package/dist/admin-actions.js.map +1 -0
  15. package/dist/admin-contributions.d.ts +518 -0
  16. package/dist/admin-contributions.d.ts.map +1 -0
  17. package/dist/admin-contributions.js +495 -0
  18. package/dist/admin-contributions.js.map +1 -0
  19. package/dist/admin-i18n.d.ts +135 -0
  20. package/dist/admin-i18n.d.ts.map +1 -0
  21. package/dist/admin-i18n.js +72 -0
  22. package/dist/admin-i18n.js.map +1 -0
  23. package/dist/admin-notifications.d.ts +55 -0
  24. package/dist/admin-notifications.d.ts.map +1 -0
  25. package/dist/admin-notifications.js +16 -0
  26. package/dist/admin-notifications.js.map +1 -0
  27. package/dist/admin-roles.d.ts +125 -0
  28. package/dist/admin-roles.d.ts.map +1 -0
  29. package/dist/admin-roles.js +2 -0
  30. package/dist/admin-roles.js.map +1 -0
  31. package/dist/admin-users.d.ts +178 -0
  32. package/dist/admin-users.d.ts.map +1 -0
  33. package/dist/admin-users.js +14 -0
  34. package/dist/admin-users.js.map +1 -0
  35. package/dist/admin.d.ts +243 -0
  36. package/dist/admin.d.ts.map +1 -0
  37. package/dist/admin.js +246 -0
  38. package/dist/admin.js.map +1 -0
  39. package/dist/analytics.d.ts +123 -0
  40. package/dist/analytics.d.ts.map +1 -0
  41. package/dist/analytics.js +68 -0
  42. package/dist/analytics.js.map +1 -0
  43. package/dist/api-keys.d.ts +97 -0
  44. package/dist/api-keys.d.ts.map +1 -0
  45. package/dist/api-keys.js +64 -0
  46. package/dist/api-keys.js.map +1 -0
  47. package/dist/assets-library.d.ts +684 -0
  48. package/dist/assets-library.d.ts.map +1 -0
  49. package/dist/assets-library.js +181 -0
  50. package/dist/assets-library.js.map +1 -0
  51. package/dist/audit-logs.d.ts +141 -0
  52. package/dist/audit-logs.d.ts.map +1 -0
  53. package/dist/audit-logs.js +31 -0
  54. package/dist/audit-logs.js.map +1 -0
  55. package/dist/auth.d.ts +174 -0
  56. package/dist/auth.d.ts.map +1 -0
  57. package/dist/auth.js +27 -0
  58. package/dist/auth.js.map +1 -0
  59. package/dist/blog.d.ts +669 -0
  60. package/dist/blog.d.ts.map +1 -0
  61. package/dist/blog.js +360 -0
  62. package/dist/blog.js.map +1 -0
  63. package/dist/capabilities.d.ts +40 -0
  64. package/dist/capabilities.d.ts.map +1 -0
  65. package/dist/capabilities.js +38 -0
  66. package/dist/capabilities.js.map +1 -0
  67. package/dist/carts.d.ts +1367 -0
  68. package/dist/carts.d.ts.map +1 -0
  69. package/dist/carts.js +405 -0
  70. package/dist/carts.js.map +1 -0
  71. package/dist/catalog.d.ts +2855 -0
  72. package/dist/catalog.d.ts.map +1 -0
  73. package/dist/catalog.js +1543 -0
  74. package/dist/catalog.js.map +1 -0
  75. package/dist/cms.d.ts +872 -0
  76. package/dist/cms.d.ts.map +1 -0
  77. package/dist/cms.js +468 -0
  78. package/dist/cms.js.map +1 -0
  79. package/dist/common.d.ts +82 -0
  80. package/dist/common.d.ts.map +1 -0
  81. package/dist/common.js +72 -0
  82. package/dist/common.js.map +1 -0
  83. package/dist/comparisons.d.ts +487 -0
  84. package/dist/comparisons.d.ts.map +1 -0
  85. package/dist/comparisons.js +221 -0
  86. package/dist/comparisons.js.map +1 -0
  87. package/dist/credentials.d.ts +292 -0
  88. package/dist/credentials.d.ts.map +1 -0
  89. package/dist/credentials.js +142 -0
  90. package/dist/credentials.js.map +1 -0
  91. package/dist/credit-limits.d.ts +111 -0
  92. package/dist/credit-limits.d.ts.map +1 -0
  93. package/dist/credit-limits.js +35 -0
  94. package/dist/credit-limits.js.map +1 -0
  95. package/dist/currencies.d.ts +127 -0
  96. package/dist/currencies.d.ts.map +1 -0
  97. package/dist/currencies.js +20 -0
  98. package/dist/currencies.js.map +1 -0
  99. package/dist/custom-fields.d.ts +345 -0
  100. package/dist/custom-fields.d.ts.map +1 -0
  101. package/dist/custom-fields.js +185 -0
  102. package/dist/custom-fields.js.map +1 -0
  103. package/dist/customer-accounts.d.ts +690 -0
  104. package/dist/customer-accounts.d.ts.map +1 -0
  105. package/dist/customer-accounts.js +41 -0
  106. package/dist/customer-accounts.js.map +1 -0
  107. package/dist/customers.d.ts +305 -0
  108. package/dist/customers.d.ts.map +1 -0
  109. package/dist/customers.js +158 -0
  110. package/dist/customers.js.map +1 -0
  111. package/dist/dictionary.d.ts +580 -0
  112. package/dist/dictionary.d.ts.map +1 -0
  113. package/dist/dictionary.js +297 -0
  114. package/dist/dictionary.js.map +1 -0
  115. package/dist/email-address.d.ts +62 -0
  116. package/dist/email-address.d.ts.map +1 -0
  117. package/dist/email-address.js +64 -0
  118. package/dist/email-address.js.map +1 -0
  119. package/dist/email.d.ts +175 -0
  120. package/dist/email.d.ts.map +1 -0
  121. package/dist/email.js +45 -0
  122. package/dist/email.js.map +1 -0
  123. package/dist/envelopes.d.ts +15 -0
  124. package/dist/envelopes.d.ts.map +1 -0
  125. package/dist/envelopes.js +16 -0
  126. package/dist/envelopes.js.map +1 -0
  127. package/dist/environment-inputs.d.ts +306 -0
  128. package/dist/environment-inputs.d.ts.map +1 -0
  129. package/dist/environment-inputs.js +277 -0
  130. package/dist/environment-inputs.js.map +1 -0
  131. package/dist/erp-connector.d.ts +52 -0
  132. package/dist/erp-connector.d.ts.map +1 -0
  133. package/dist/erp-connector.js +34 -0
  134. package/dist/erp-connector.js.map +1 -0
  135. package/dist/errors.d.ts +455 -0
  136. package/dist/errors.d.ts.map +1 -0
  137. package/dist/errors.js +532 -0
  138. package/dist/errors.js.map +1 -0
  139. package/dist/google-analytics.d.ts +181 -0
  140. package/dist/google-analytics.d.ts.map +1 -0
  141. package/dist/google-analytics.js +176 -0
  142. package/dist/google-analytics.js.map +1 -0
  143. package/dist/google-tag-manager.d.ts +111 -0
  144. package/dist/google-tag-manager.d.ts.map +1 -0
  145. package/dist/google-tag-manager.js +129 -0
  146. package/dist/google-tag-manager.js.map +1 -0
  147. package/dist/i18n.d.ts +69 -0
  148. package/dist/i18n.d.ts.map +1 -0
  149. package/dist/i18n.js +59 -0
  150. package/dist/i18n.js.map +1 -0
  151. package/dist/import-export.d.ts +63 -0
  152. package/dist/import-export.d.ts.map +1 -0
  153. package/dist/import-export.js +37 -0
  154. package/dist/import-export.js.map +1 -0
  155. package/dist/index.d.ts +82 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +126 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/inventory.d.ts +673 -0
  160. package/dist/inventory.d.ts.map +1 -0
  161. package/dist/inventory.js +412 -0
  162. package/dist/inventory.js.map +1 -0
  163. package/dist/invoice-ledger.d.ts +366 -0
  164. package/dist/invoice-ledger.d.ts.map +1 -0
  165. package/dist/invoice-ledger.js +114 -0
  166. package/dist/invoice-ledger.js.map +1 -0
  167. package/dist/invoices.d.ts +845 -0
  168. package/dist/invoices.d.ts.map +1 -0
  169. package/dist/invoices.js +314 -0
  170. package/dist/invoices.js.map +1 -0
  171. package/dist/kernel.d.ts +49 -0
  172. package/dist/kernel.d.ts.map +1 -0
  173. package/dist/kernel.js +19 -0
  174. package/dist/kernel.js.map +1 -0
  175. package/dist/languages.d.ts +122 -0
  176. package/dist/languages.d.ts.map +1 -0
  177. package/dist/languages.js +24 -0
  178. package/dist/languages.js.map +1 -0
  179. package/dist/linkedin-ads.d.ts +167 -0
  180. package/dist/linkedin-ads.d.ts.map +1 -0
  181. package/dist/linkedin-ads.js +156 -0
  182. package/dist/linkedin-ads.js.map +1 -0
  183. package/dist/megamenu.d.ts +556 -0
  184. package/dist/megamenu.d.ts.map +1 -0
  185. package/dist/megamenu.js +186 -0
  186. package/dist/megamenu.js.map +1 -0
  187. package/dist/meta-ads.d.ts +126 -0
  188. package/dist/meta-ads.d.ts.map +1 -0
  189. package/dist/meta-ads.js +112 -0
  190. package/dist/meta-ads.js.map +1 -0
  191. package/dist/mfa.d.ts +274 -0
  192. package/dist/mfa.d.ts.map +1 -0
  193. package/dist/mfa.js +187 -0
  194. package/dist/mfa.js.map +1 -0
  195. package/dist/modules.d.ts +1706 -0
  196. package/dist/modules.d.ts.map +1 -0
  197. package/dist/modules.js +1390 -0
  198. package/dist/modules.js.map +1 -0
  199. package/dist/newsletter.d.ts +611 -0
  200. package/dist/newsletter.d.ts.map +1 -0
  201. package/dist/newsletter.js +345 -0
  202. package/dist/newsletter.js.map +1 -0
  203. package/dist/orders.d.ts +1175 -0
  204. package/dist/orders.d.ts.map +1 -0
  205. package/dist/orders.js +630 -0
  206. package/dist/orders.js.map +1 -0
  207. package/dist/organizations.d.ts +938 -0
  208. package/dist/organizations.d.ts.map +1 -0
  209. package/dist/organizations.js +418 -0
  210. package/dist/organizations.js.map +1 -0
  211. package/dist/pagination.d.ts +21 -0
  212. package/dist/pagination.d.ts.map +1 -0
  213. package/dist/pagination.js +22 -0
  214. package/dist/pagination.js.map +1 -0
  215. package/dist/payment-methods.d.ts +472 -0
  216. package/dist/payment-methods.d.ts.map +1 -0
  217. package/dist/payment-methods.js +175 -0
  218. package/dist/payment-methods.js.map +1 -0
  219. package/dist/payment-return-url.d.ts +53 -0
  220. package/dist/payment-return-url.d.ts.map +1 -0
  221. package/dist/payment-return-url.js +35 -0
  222. package/dist/payment-return-url.js.map +1 -0
  223. package/dist/payments.d.ts +386 -0
  224. package/dist/payments.d.ts.map +1 -0
  225. package/dist/payments.js +84 -0
  226. package/dist/payments.js.map +1 -0
  227. package/dist/pim-connector.d.ts +60 -0
  228. package/dist/pim-connector.d.ts.map +1 -0
  229. package/dist/pim-connector.js +43 -0
  230. package/dist/pim-connector.js.map +1 -0
  231. package/dist/pim-field-path.d.ts +6 -0
  232. package/dist/pim-field-path.d.ts.map +1 -0
  233. package/dist/pim-field-path.js +101 -0
  234. package/dist/pim-field-path.js.map +1 -0
  235. package/dist/platform-language.d.ts +20 -0
  236. package/dist/platform-language.d.ts.map +1 -0
  237. package/dist/platform-language.js +22 -0
  238. package/dist/platform-language.js.map +1 -0
  239. package/dist/price-lists.d.ts +685 -0
  240. package/dist/price-lists.d.ts.map +1 -0
  241. package/dist/price-lists.js +330 -0
  242. package/dist/price-lists.js.map +1 -0
  243. package/dist/product-feeds.d.ts +2837 -0
  244. package/dist/product-feeds.d.ts.map +1 -0
  245. package/dist/product-feeds.js +1504 -0
  246. package/dist/product-feeds.js.map +1 -0
  247. package/dist/product-scope-overrides.d.ts +134 -0
  248. package/dist/product-scope-overrides.d.ts.map +1 -0
  249. package/dist/product-scope-overrides.js +82 -0
  250. package/dist/product-scope-overrides.js.map +1 -0
  251. package/dist/product-value-resolver.d.ts +88 -0
  252. package/dist/product-value-resolver.d.ts.map +1 -0
  253. package/dist/product-value-resolver.js +128 -0
  254. package/dist/product-value-resolver.js.map +1 -0
  255. package/dist/promotions.d.ts +678 -0
  256. package/dist/promotions.d.ts.map +1 -0
  257. package/dist/promotions.js +479 -0
  258. package/dist/promotions.js.map +1 -0
  259. package/dist/prompt-actions.d.ts +582 -0
  260. package/dist/prompt-actions.d.ts.map +1 -0
  261. package/dist/prompt-actions.js +221 -0
  262. package/dist/prompt-actions.js.map +1 -0
  263. package/dist/pwa.d.ts +293 -0
  264. package/dist/pwa.d.ts.map +1 -0
  265. package/dist/pwa.js +204 -0
  266. package/dist/pwa.js.map +1 -0
  267. package/dist/quick-order.d.ts +340 -0
  268. package/dist/quick-order.d.ts.map +1 -0
  269. package/dist/quick-order.js +177 -0
  270. package/dist/quick-order.js.map +1 -0
  271. package/dist/quote-requests.d.ts +538 -0
  272. package/dist/quote-requests.d.ts.map +1 -0
  273. package/dist/quote-requests.js +308 -0
  274. package/dist/quote-requests.js.map +1 -0
  275. package/dist/returns.d.ts +774 -0
  276. package/dist/returns.d.ts.map +1 -0
  277. package/dist/returns.js +389 -0
  278. package/dist/returns.js.map +1 -0
  279. package/dist/sales-channels.d.ts +392 -0
  280. package/dist/sales-channels.d.ts.map +1 -0
  281. package/dist/sales-channels.js +285 -0
  282. package/dist/sales-channels.js.map +1 -0
  283. package/dist/scope-notice.d.ts +60 -0
  284. package/dist/scope-notice.d.ts.map +1 -0
  285. package/dist/scope-notice.js +56 -0
  286. package/dist/scope-notice.js.map +1 -0
  287. package/dist/search.d.ts +321 -0
  288. package/dist/search.d.ts.map +1 -0
  289. package/dist/search.js +160 -0
  290. package/dist/search.js.map +1 -0
  291. package/dist/seo.d.ts +113 -0
  292. package/dist/seo.d.ts.map +1 -0
  293. package/dist/seo.js +63 -0
  294. package/dist/seo.js.map +1 -0
  295. package/dist/settings.d.ts +453 -0
  296. package/dist/settings.d.ts.map +1 -0
  297. package/dist/settings.js +337 -0
  298. package/dist/settings.js.map +1 -0
  299. package/dist/shipments.d.ts +140 -0
  300. package/dist/shipments.d.ts.map +1 -0
  301. package/dist/shipments.js +14 -0
  302. package/dist/shipments.js.map +1 -0
  303. package/dist/shipping-methods.d.ts +350 -0
  304. package/dist/shipping-methods.d.ts.map +1 -0
  305. package/dist/shipping-methods.js +99 -0
  306. package/dist/shipping-methods.js.map +1 -0
  307. package/dist/shopping-lists.d.ts +122 -0
  308. package/dist/shopping-lists.d.ts.map +1 -0
  309. package/dist/shopping-lists.js +92 -0
  310. package/dist/shopping-lists.js.map +1 -0
  311. package/dist/taxes.d.ts +106 -0
  312. package/dist/taxes.d.ts.map +1 -0
  313. package/dist/taxes.js +80 -0
  314. package/dist/taxes.js.map +1 -0
  315. package/dist/text-normalization.d.ts +199 -0
  316. package/dist/text-normalization.d.ts.map +1 -0
  317. package/dist/text-normalization.js +205 -0
  318. package/dist/text-normalization.js.map +1 -0
  319. package/dist/transactional-emails.d.ts +459 -0
  320. package/dist/transactional-emails.d.ts.map +1 -0
  321. package/dist/transactional-emails.js +212 -0
  322. package/dist/transactional-emails.js.map +1 -0
  323. package/dist/webhooks.d.ts +69 -0
  324. package/dist/webhooks.d.ts.map +1 -0
  325. package/dist/webhooks.js +53 -0
  326. package/dist/webhooks.js.map +1 -0
  327. package/package.json +46 -0
@@ -0,0 +1,1175 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Orders module contracts — Source of truth per Principle V.
4
+ * See specs/001-b2b-platform-foundation/contracts/orders.contract.md.
5
+ */
6
+ /**
7
+ * Configurable order status code (feature 038). Was a fixed enum
8
+ * (`orderStatusSchema`); with the data-driven lifecycle the authoritative
9
+ * status is a code validated in-service against the configured `order_statuses`
10
+ * set.
11
+ */
12
+ export declare const orderStatusCodeSchema: z.ZodString;
13
+ export declare const orderItemSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ productId: z.ZodString;
16
+ productSnapshot: z.ZodObject<{
17
+ sku: z.ZodString;
18
+ name: z.ZodString;
19
+ primaryAssetUrl: z.ZodNullable<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ variantId: z.ZodNullable<z.ZodString>;
22
+ variantSnapshot: z.ZodNullable<z.ZodObject<{
23
+ sku: z.ZodString;
24
+ label: z.ZodString;
25
+ }, z.core.$strip>>;
26
+ quantity: z.ZodNumber;
27
+ unitPrice: z.ZodNumber;
28
+ taxRate: z.ZodNumber;
29
+ lineTotal: z.ZodNumber;
30
+ }, z.core.$strip>;
31
+ export type OrderItem = z.infer<typeof orderItemSchema>;
32
+ export declare const nextActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ kind: z.ZodLiteral<"redirect_to_gateway">;
34
+ url: z.ZodString;
35
+ expiresAt: z.ZodString;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ kind: z.ZodLiteral<"awaiting_transfer">;
38
+ accountDetails: z.ZodObject<{
39
+ accountNumber: z.ZodString;
40
+ accountHolder: z.ZodString;
41
+ bankName: z.ZodString;
42
+ amount: z.ZodNumber;
43
+ currency: z.ZodString;
44
+ reference: z.ZodString;
45
+ }, z.core.$strip>;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ kind: z.ZodLiteral<"none">;
48
+ }, z.core.$strip>], "kind">;
49
+ export type NextAction = z.infer<typeof nextActionSchema>;
50
+ export declare const orderSchema: z.ZodObject<{
51
+ id: z.ZodString;
52
+ businessId: z.ZodString;
53
+ organizationId: z.ZodString;
54
+ placedByCustomerAccountId: z.ZodString;
55
+ placedOnBehalfByAdminUserId: z.ZodNullable<z.ZodString>;
56
+ salesChannelId: z.ZodString;
57
+ status: z.ZodString;
58
+ statusName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
59
+ statusDefaultName: z.ZodOptional<z.ZodString>;
60
+ paymentStatus: z.ZodEnum<{
61
+ paid: "paid";
62
+ awaiting_payment: "awaiting_payment";
63
+ failed: "failed";
64
+ deferred: "deferred";
65
+ refunded: "refunded";
66
+ }>;
67
+ deliveryAddress: z.ZodObject<{
68
+ recipientName: z.ZodString;
69
+ street: z.ZodString;
70
+ city: z.ZodString;
71
+ postalCode: z.ZodString;
72
+ country: z.ZodString;
73
+ phone: z.ZodOptional<z.ZodString>;
74
+ companyName: z.ZodOptional<z.ZodString>;
75
+ taxId: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ billingAddress: z.ZodObject<{
78
+ recipientName: z.ZodString;
79
+ street: z.ZodString;
80
+ city: z.ZodString;
81
+ postalCode: z.ZodString;
82
+ country: z.ZodString;
83
+ phone: z.ZodOptional<z.ZodString>;
84
+ companyName: z.ZodOptional<z.ZodString>;
85
+ taxId: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strip>;
87
+ deliveryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
88
+ provider: z.ZodString;
89
+ pointId: z.ZodString;
90
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ }, z.core.$strip>>>;
93
+ deliveryMethod: z.ZodObject<{
94
+ id: z.ZodString;
95
+ code: z.ZodString;
96
+ name: z.ZodString;
97
+ cost: z.ZodNumber;
98
+ }, z.core.$strip>;
99
+ paymentMethod: z.ZodObject<{
100
+ id: z.ZodString;
101
+ code: z.ZodString;
102
+ name: z.ZodString;
103
+ kind: z.ZodEnum<{
104
+ bank_transfer: "bank_transfer";
105
+ pickup: "pickup";
106
+ credit_limit: "credit_limit";
107
+ gateway: "gateway";
108
+ }>;
109
+ }, z.core.$strip>;
110
+ sourceQuoteRequestId: z.ZodNullable<z.ZodString>;
111
+ items: z.ZodArray<z.ZodObject<{
112
+ id: z.ZodString;
113
+ productId: z.ZodString;
114
+ productSnapshot: z.ZodObject<{
115
+ sku: z.ZodString;
116
+ name: z.ZodString;
117
+ primaryAssetUrl: z.ZodNullable<z.ZodString>;
118
+ }, z.core.$strip>;
119
+ variantId: z.ZodNullable<z.ZodString>;
120
+ variantSnapshot: z.ZodNullable<z.ZodObject<{
121
+ sku: z.ZodString;
122
+ label: z.ZodString;
123
+ }, z.core.$strip>>;
124
+ quantity: z.ZodNumber;
125
+ unitPrice: z.ZodNumber;
126
+ taxRate: z.ZodNumber;
127
+ lineTotal: z.ZodNumber;
128
+ }, z.core.$strip>>;
129
+ subtotal: z.ZodNumber;
130
+ taxTotal: z.ZodNumber;
131
+ discountTotal: z.ZodNumber;
132
+ appliedPromotions: z.ZodDefault<z.ZodArray<z.ZodObject<{
133
+ promotionId: z.ZodString;
134
+ couponId: z.ZodNullable<z.ZodString>;
135
+ amount: z.ZodNumber;
136
+ currency: z.ZodString;
137
+ }, z.core.$strip>>>;
138
+ deliveryTotal: z.ZodNumber;
139
+ total: z.ZodNumber;
140
+ currency: z.ZodString;
141
+ placedAt: z.ZodString;
142
+ customerNote: z.ZodNullable<z.ZodString>;
143
+ nextAction: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ kind: z.ZodLiteral<"redirect_to_gateway">;
145
+ url: z.ZodString;
146
+ expiresAt: z.ZodString;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"awaiting_transfer">;
149
+ accountDetails: z.ZodObject<{
150
+ accountNumber: z.ZodString;
151
+ accountHolder: z.ZodString;
152
+ bankName: z.ZodString;
153
+ amount: z.ZodNumber;
154
+ currency: z.ZodString;
155
+ reference: z.ZodString;
156
+ }, z.core.$strip>;
157
+ }, z.core.$strip>, z.ZodObject<{
158
+ kind: z.ZodLiteral<"none">;
159
+ }, z.core.$strip>], "kind">>;
160
+ customerCancellable: z.ZodOptional<z.ZodBoolean>;
161
+ }, z.core.$strip>;
162
+ export type Order = z.infer<typeof orderSchema>;
163
+ export declare const placeOrderRequestSchema: z.ZodObject<{
164
+ deliveryAddressId: z.ZodString;
165
+ billingAddressId: z.ZodString;
166
+ deliveryMethodId: z.ZodString;
167
+ paymentMethodId: z.ZodString;
168
+ salesChannelId: z.ZodOptional<z.ZodString>;
169
+ promotionCode: z.ZodOptional<z.ZodString>;
170
+ customerNote: z.ZodOptional<z.ZodString>;
171
+ idempotencyKey: z.ZodOptional<z.ZodString>;
172
+ billingCompanyName: z.ZodOptional<z.ZodString>;
173
+ billingTaxId: z.ZodOptional<z.ZodString>;
174
+ deliveryPoint: z.ZodOptional<z.ZodObject<{
175
+ provider: z.ZodString;
176
+ pointId: z.ZodString;
177
+ label: z.ZodOptional<z.ZodString>;
178
+ address: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strip>>;
180
+ shippingAdapterData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
181
+ }, z.core.$strip>;
182
+ export type PlaceOrderRequest = z.infer<typeof placeOrderRequestSchema>;
183
+ /**
184
+ * Read-only order-total preview for the active cart with a chosen delivery +
185
+ * payment method (feature 049). Computes the exact total server-side — including
186
+ * per-product VAT, delivery cost, payment surcharge, and promotion discount —
187
+ * so the storefront never re-derives pricing on the client. `billingAddressId`
188
+ * refines the tax country to match placement; omit ⇒ the organization's country.
189
+ */
190
+ export declare const orderPreviewTotalRequestSchema: z.ZodObject<{
191
+ deliveryMethodId: z.ZodString;
192
+ paymentMethodId: z.ZodString;
193
+ billingAddressId: z.ZodOptional<z.ZodString>;
194
+ }, z.core.$strip>;
195
+ export type OrderPreviewTotalRequest = z.infer<typeof orderPreviewTotalRequestSchema>;
196
+ export declare const orderPreviewTotalResponseSchema: z.ZodObject<{
197
+ subtotal: z.ZodNumber;
198
+ taxTotal: z.ZodNumber;
199
+ deliveryTotal: z.ZodNumber;
200
+ paymentSurcharge: z.ZodNumber;
201
+ discountTotal: z.ZodNumber;
202
+ total: z.ZodNumber;
203
+ currency: z.ZodString;
204
+ }, z.core.$strip>;
205
+ export type OrderPreviewTotalResponse = z.infer<typeof orderPreviewTotalResponseSchema>;
206
+ export declare const adminOrderStatusTransitionSchema: z.ZodObject<{
207
+ to: z.ZodString;
208
+ reason: z.ZodOptional<z.ZodString>;
209
+ }, z.core.$strip>;
210
+ export declare const adminOrderPaymentStatusTransitionSchema: z.ZodObject<{
211
+ to: z.ZodEnum<{
212
+ paid: "paid";
213
+ refunded: "refunded";
214
+ }>;
215
+ reason: z.ZodOptional<z.ZodString>;
216
+ invoiceId: z.ZodOptional<z.ZodString>;
217
+ }, z.core.$strip>;
218
+ export declare const adminOrderRefundRequestSchema: z.ZodObject<{
219
+ amount: z.ZodOptional<z.ZodNumber>;
220
+ }, z.core.$strip>;
221
+ export declare const adminOrderShippedRequestSchema: z.ZodObject<{
222
+ trackingNumber: z.ZodString;
223
+ carrierCode: z.ZodString;
224
+ shippedAt: z.ZodString;
225
+ }, z.core.$strip>;
226
+ /**
227
+ * Status badge colour — an arbitrary `#rrggbb` hex value. The admin colour
228
+ * picker offers a curated preset palette plus a free custom colour. The default
229
+ * is a neutral slate, matching the legacy uncoloured look.
230
+ */
231
+ export declare const ORDER_STATUS_DEFAULT_COLOR = "#64748b";
232
+ /** Curated preset palette surfaced by the admin colour picker. */
233
+ export declare const ORDER_STATUS_COLOR_PRESETS: readonly ["#64748b", "#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6"];
234
+ export declare const orderStatusColorSchema: z.ZodString;
235
+ export type OrderStatusColor = z.infer<typeof orderStatusColorSchema>;
236
+ export declare const orderStatusDefSchema: z.ZodObject<{
237
+ code: z.ZodString;
238
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
239
+ defaultName: z.ZodString;
240
+ isInitial: z.ZodBoolean;
241
+ isTerminal: z.ZodBoolean;
242
+ isSystem: z.ZodBoolean;
243
+ weight: z.ZodNumber;
244
+ color: z.ZodString;
245
+ inUseCount: z.ZodNumber;
246
+ }, z.core.$strip>;
247
+ export type OrderStatusDefDto = z.infer<typeof orderStatusDefSchema>;
248
+ export declare const orderStatusTransitionDtoSchema: z.ZodObject<{
249
+ fromStatusCode: z.ZodString;
250
+ toStatusCode: z.ZodString;
251
+ isSystem: z.ZodBoolean;
252
+ }, z.core.$strip>;
253
+ export type OrderStatusTransitionDto = z.infer<typeof orderStatusTransitionDtoSchema>;
254
+ export declare const orderStatusGraphResponseSchema: z.ZodObject<{
255
+ statuses: z.ZodArray<z.ZodObject<{
256
+ code: z.ZodString;
257
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
258
+ defaultName: z.ZodString;
259
+ isInitial: z.ZodBoolean;
260
+ isTerminal: z.ZodBoolean;
261
+ isSystem: z.ZodBoolean;
262
+ weight: z.ZodNumber;
263
+ color: z.ZodString;
264
+ inUseCount: z.ZodNumber;
265
+ }, z.core.$strip>>;
266
+ transitions: z.ZodArray<z.ZodObject<{
267
+ fromStatusCode: z.ZodString;
268
+ toStatusCode: z.ZodString;
269
+ isSystem: z.ZodBoolean;
270
+ }, z.core.$strip>>;
271
+ }, z.core.$strip>;
272
+ export type OrderStatusGraphResponse = z.infer<typeof orderStatusGraphResponseSchema>;
273
+ export declare const createOrderStatusRequestSchema: z.ZodObject<{
274
+ code: z.ZodString;
275
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
276
+ defaultName: z.ZodString;
277
+ isTerminal: z.ZodOptional<z.ZodBoolean>;
278
+ weight: z.ZodOptional<z.ZodNumber>;
279
+ color: z.ZodOptional<z.ZodString>;
280
+ }, z.core.$strip>;
281
+ export type CreateOrderStatusRequest = z.infer<typeof createOrderStatusRequestSchema>;
282
+ export declare const updateOrderStatusRequestSchema: z.ZodObject<{
283
+ name: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
284
+ defaultName: z.ZodOptional<z.ZodString>;
285
+ isTerminal: z.ZodOptional<z.ZodBoolean>;
286
+ weight: z.ZodOptional<z.ZodNumber>;
287
+ color: z.ZodOptional<z.ZodString>;
288
+ }, z.core.$strip>;
289
+ export type UpdateOrderStatusRequest = z.infer<typeof updateOrderStatusRequestSchema>;
290
+ export declare const setOrderTransitionsRequestSchema: z.ZodObject<{
291
+ add: z.ZodOptional<z.ZodArray<z.ZodObject<{
292
+ fromStatusCode: z.ZodString;
293
+ toStatusCode: z.ZodString;
294
+ }, z.core.$strip>>>;
295
+ remove: z.ZodOptional<z.ZodArray<z.ZodObject<{
296
+ fromStatusCode: z.ZodString;
297
+ toStatusCode: z.ZodString;
298
+ }, z.core.$strip>>>;
299
+ }, z.core.$strip>;
300
+ export type SetOrderTransitionsRequest = z.infer<typeof setOrderTransitionsRequestSchema>;
301
+ export declare const adminOrdersListQuerySchema: z.ZodObject<{
302
+ status: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string[] | undefined, string | string[] | undefined>>;
303
+ paymentStatus: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
304
+ paid: "paid";
305
+ awaiting_payment: "awaiting_payment";
306
+ failed: "failed";
307
+ deferred: "deferred";
308
+ refunded: "refunded";
309
+ }>, z.ZodArray<z.ZodEnum<{
310
+ paid: "paid";
311
+ awaiting_payment: "awaiting_payment";
312
+ failed: "failed";
313
+ deferred: "deferred";
314
+ refunded: "refunded";
315
+ }>>]>>, z.ZodTransform<("paid" | "awaiting_payment" | "failed" | "deferred" | "refunded")[] | undefined, "paid" | "awaiting_payment" | "failed" | "deferred" | "refunded" | ("paid" | "awaiting_payment" | "failed" | "deferred" | "refunded")[] | undefined>>;
316
+ salesChannelId: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string[] | undefined, string | string[] | undefined>>;
317
+ paymentMethodId: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string[] | undefined, string | string[] | undefined>>;
318
+ deliveryMethodId: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string[] | undefined, string | string[] | undefined>>;
319
+ organizationId: z.ZodOptional<z.ZodString>;
320
+ q: z.ZodOptional<z.ZodString>;
321
+ orgName: z.ZodOptional<z.ZodString>;
322
+ customerName: z.ZodOptional<z.ZodString>;
323
+ placedFrom: z.ZodOptional<z.ZodString>;
324
+ placedTo: z.ZodOptional<z.ZodString>;
325
+ totalMin: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
326
+ totalMax: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
327
+ sort: z.ZodOptional<z.ZodString>;
328
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
329
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
330
+ }, z.core.$strip>;
331
+ export type AdminOrdersListQuery = z.infer<typeof adminOrdersListQuerySchema>;
332
+ export declare const adminOrderRowSchema: z.ZodObject<{
333
+ id: z.ZodString;
334
+ businessId: z.ZodString;
335
+ customerName: z.ZodNullable<z.ZodString>;
336
+ organizationId: z.ZodString;
337
+ organizationName: z.ZodNullable<z.ZodString>;
338
+ status: z.ZodString;
339
+ statusName: z.ZodRecord<z.ZodString, z.ZodString>;
340
+ paymentStatus: z.ZodEnum<{
341
+ paid: "paid";
342
+ awaiting_payment: "awaiting_payment";
343
+ failed: "failed";
344
+ deferred: "deferred";
345
+ refunded: "refunded";
346
+ }>;
347
+ total: z.ZodNumber;
348
+ currency: z.ZodString;
349
+ placedAt: z.ZodString;
350
+ createdAt: z.ZodString;
351
+ salesChannelId: z.ZodString;
352
+ salesChannelName: z.ZodNullable<z.ZodString>;
353
+ deliveryMethodName: z.ZodNullable<z.ZodString>;
354
+ paymentMethodName: z.ZodNullable<z.ZodString>;
355
+ shipToName: z.ZodNullable<z.ZodString>;
356
+ billToName: z.ZodNullable<z.ZodString>;
357
+ }, z.core.$strip>;
358
+ export type AdminOrderRow = z.infer<typeof adminOrderRowSchema>;
359
+ export declare const adminOrdersListResponseSchema: z.ZodObject<{
360
+ data: z.ZodArray<z.ZodObject<{
361
+ id: z.ZodString;
362
+ businessId: z.ZodString;
363
+ customerName: z.ZodNullable<z.ZodString>;
364
+ organizationId: z.ZodString;
365
+ organizationName: z.ZodNullable<z.ZodString>;
366
+ status: z.ZodString;
367
+ statusName: z.ZodRecord<z.ZodString, z.ZodString>;
368
+ paymentStatus: z.ZodEnum<{
369
+ paid: "paid";
370
+ awaiting_payment: "awaiting_payment";
371
+ failed: "failed";
372
+ deferred: "deferred";
373
+ refunded: "refunded";
374
+ }>;
375
+ total: z.ZodNumber;
376
+ currency: z.ZodString;
377
+ placedAt: z.ZodString;
378
+ createdAt: z.ZodString;
379
+ salesChannelId: z.ZodString;
380
+ salesChannelName: z.ZodNullable<z.ZodString>;
381
+ deliveryMethodName: z.ZodNullable<z.ZodString>;
382
+ paymentMethodName: z.ZodNullable<z.ZodString>;
383
+ shipToName: z.ZodNullable<z.ZodString>;
384
+ billToName: z.ZodNullable<z.ZodString>;
385
+ }, z.core.$strip>>;
386
+ pagination: z.ZodObject<{
387
+ page: z.ZodNumber;
388
+ pageSize: z.ZodNumber;
389
+ total: z.ZodNumber;
390
+ }, z.core.$strip>;
391
+ counts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
392
+ paymentStatusCounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
393
+ }, z.core.$strip>;
394
+ export type AdminOrdersListResponse = z.infer<typeof adminOrdersListResponseSchema>;
395
+ export declare const bulkOrderStatusRequestSchema: z.ZodObject<{
396
+ orderIds: z.ZodArray<z.ZodString>;
397
+ toStatusCode: z.ZodString;
398
+ reason: z.ZodOptional<z.ZodString>;
399
+ }, z.core.$strip>;
400
+ export type BulkOrderStatusRequest = z.infer<typeof bulkOrderStatusRequestSchema>;
401
+ export declare const bulkOrderStatusResponseSchema: z.ZodObject<{
402
+ changed: z.ZodArray<z.ZodString>;
403
+ skipped: z.ZodArray<z.ZodObject<{
404
+ orderId: z.ZodString;
405
+ reason: z.ZodEnum<{
406
+ not_found: "not_found";
407
+ invalid_transition: "invalid_transition";
408
+ terminal: "terminal";
409
+ }>;
410
+ }, z.core.$strip>>;
411
+ }, z.core.$strip>;
412
+ export type BulkOrderStatusResponse = z.infer<typeof bulkOrderStatusResponseSchema>;
413
+ export declare const bulkPrintInvoicesRequestSchema: z.ZodObject<{
414
+ orderIds: z.ZodArray<z.ZodString>;
415
+ }, z.core.$strip>;
416
+ export type BulkPrintInvoicesRequest = z.infer<typeof bulkPrintInvoicesRequestSchema>;
417
+ export declare const orderSavedViewSortSchema: z.ZodObject<{
418
+ field: z.ZodString;
419
+ dir: z.ZodEnum<{
420
+ asc: "asc";
421
+ desc: "desc";
422
+ }>;
423
+ }, z.core.$strip>;
424
+ export declare const orderSavedViewSchema: z.ZodObject<{
425
+ id: z.ZodString;
426
+ name: z.ZodString;
427
+ shared: z.ZodBoolean;
428
+ ownerAdminUserId: z.ZodString;
429
+ filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
430
+ sort: z.ZodObject<{
431
+ field: z.ZodString;
432
+ dir: z.ZodEnum<{
433
+ asc: "asc";
434
+ desc: "desc";
435
+ }>;
436
+ }, z.core.$strip>;
437
+ visibleColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
438
+ }, z.core.$strip>;
439
+ export type OrderSavedView = z.infer<typeof orderSavedViewSchema>;
440
+ export declare const createOrderSavedViewRequestSchema: z.ZodObject<{
441
+ name: z.ZodString;
442
+ shared: z.ZodBoolean;
443
+ filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
444
+ sort: z.ZodObject<{
445
+ field: z.ZodString;
446
+ dir: z.ZodEnum<{
447
+ asc: "asc";
448
+ desc: "desc";
449
+ }>;
450
+ }, z.core.$strip>;
451
+ visibleColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
452
+ }, z.core.$strip>;
453
+ export type CreateOrderSavedViewRequest = z.infer<typeof createOrderSavedViewRequestSchema>;
454
+ export declare const updateOrderSavedViewRequestSchema: z.ZodObject<{
455
+ name: z.ZodOptional<z.ZodString>;
456
+ shared: z.ZodOptional<z.ZodBoolean>;
457
+ filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
458
+ sort: z.ZodOptional<z.ZodObject<{
459
+ field: z.ZodString;
460
+ dir: z.ZodEnum<{
461
+ asc: "asc";
462
+ desc: "desc";
463
+ }>;
464
+ }, z.core.$strip>>;
465
+ visibleColumns: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>>;
466
+ }, z.core.$strip>;
467
+ export type UpdateOrderSavedViewRequest = z.infer<typeof updateOrderSavedViewRequestSchema>;
468
+ export declare const adminCreateOrderItemSchema: z.ZodObject<{
469
+ productId: z.ZodString;
470
+ variantId: z.ZodOptional<z.ZodString>;
471
+ quantity: z.ZodNumber;
472
+ }, z.core.$strip>;
473
+ /**
474
+ * A brand-new address typed inline on the admin create-order form, instead of
475
+ * picking an existing one from the customer's organization address book. The
476
+ * address is always snapshotted onto the order; `saveToAddressBook` controls
477
+ * whether it is also persisted to the org book for reuse (false = one-time).
478
+ */
479
+ export declare const adminCreateOrderInlineAddressSchema: z.ZodObject<{
480
+ recipientName: z.ZodString;
481
+ street: z.ZodString;
482
+ city: z.ZodString;
483
+ postalCode: z.ZodString;
484
+ country: z.ZodString;
485
+ phone: z.ZodOptional<z.ZodString>;
486
+ saveToAddressBook: z.ZodBoolean;
487
+ }, z.core.$strip>;
488
+ export type AdminCreateOrderInlineAddress = z.infer<typeof adminCreateOrderInlineAddressSchema>;
489
+ export declare const adminCreateOrderRequestSchema: z.ZodObject<{
490
+ customerAccountId: z.ZodString;
491
+ salesChannelId: z.ZodString;
492
+ items: z.ZodArray<z.ZodObject<{
493
+ productId: z.ZodString;
494
+ variantId: z.ZodOptional<z.ZodString>;
495
+ quantity: z.ZodNumber;
496
+ }, z.core.$strip>>;
497
+ deliveryMethodId: z.ZodString;
498
+ paymentMethodId: z.ZodString;
499
+ deliveryAddressId: z.ZodOptional<z.ZodString>;
500
+ billingAddressId: z.ZodOptional<z.ZodString>;
501
+ deliveryAddress: z.ZodOptional<z.ZodObject<{
502
+ recipientName: z.ZodString;
503
+ street: z.ZodString;
504
+ city: z.ZodString;
505
+ postalCode: z.ZodString;
506
+ country: z.ZodString;
507
+ phone: z.ZodOptional<z.ZodString>;
508
+ saveToAddressBook: z.ZodBoolean;
509
+ }, z.core.$strip>>;
510
+ billingAddress: z.ZodOptional<z.ZodObject<{
511
+ recipientName: z.ZodString;
512
+ street: z.ZodString;
513
+ city: z.ZodString;
514
+ postalCode: z.ZodString;
515
+ country: z.ZodString;
516
+ phone: z.ZodOptional<z.ZodString>;
517
+ saveToAddressBook: z.ZodBoolean;
518
+ }, z.core.$strip>>;
519
+ customerNote: z.ZodOptional<z.ZodString>;
520
+ comment: z.ZodOptional<z.ZodObject<{
521
+ body: z.ZodString;
522
+ isCustomerVisible: z.ZodBoolean;
523
+ notifyCustomer: z.ZodBoolean;
524
+ }, z.core.$strip>>;
525
+ }, z.core.$strip>;
526
+ export type AdminCreateOrderRequest = z.infer<typeof adminCreateOrderRequestSchema>;
527
+ /**
528
+ * Inline address for the external order-intake body — the admin-create
529
+ * pattern: per side, the caller supplies EITHER an existing org address id OR
530
+ * an inline address. `saveToAddressBook` defaults to a one-time address (the
531
+ * org book stays clean; the order keeps its own snapshot).
532
+ */
533
+ export declare const apiInlineAddressSchema: z.ZodObject<{
534
+ recipientName: z.ZodString;
535
+ street: z.ZodString;
536
+ city: z.ZodString;
537
+ postalCode: z.ZodString;
538
+ country: z.ZodString;
539
+ phone: z.ZodOptional<z.ZodString>;
540
+ saveToAddressBook: z.ZodDefault<z.ZodBoolean>;
541
+ }, z.core.$strip>;
542
+ export type ApiInlineAddress = z.infer<typeof apiInlineAddressSchema>;
543
+ /**
544
+ * `POST /api/v1/external/orders` body (bound API keys only). Line items are
545
+ * addressed by SKU + quantity; the response reuses the existing serialized
546
+ * order envelope — no bespoke partner DTO.
547
+ */
548
+ export declare const apiPlaceOrderRequestSchema: z.ZodObject<{
549
+ lines: z.ZodArray<z.ZodObject<{
550
+ sku: z.ZodString;
551
+ quantity: z.ZodNumber;
552
+ }, z.core.$strip>>;
553
+ deliveryMethodId: z.ZodString;
554
+ paymentMethodId: z.ZodString;
555
+ deliveryAddressId: z.ZodOptional<z.ZodString>;
556
+ billingAddressId: z.ZodOptional<z.ZodString>;
557
+ deliveryAddress: z.ZodOptional<z.ZodObject<{
558
+ recipientName: z.ZodString;
559
+ street: z.ZodString;
560
+ city: z.ZodString;
561
+ postalCode: z.ZodString;
562
+ country: z.ZodString;
563
+ phone: z.ZodOptional<z.ZodString>;
564
+ saveToAddressBook: z.ZodDefault<z.ZodBoolean>;
565
+ }, z.core.$strip>>;
566
+ billingAddress: z.ZodOptional<z.ZodObject<{
567
+ recipientName: z.ZodString;
568
+ street: z.ZodString;
569
+ city: z.ZodString;
570
+ postalCode: z.ZodString;
571
+ country: z.ZodString;
572
+ phone: z.ZodOptional<z.ZodString>;
573
+ saveToAddressBook: z.ZodDefault<z.ZodBoolean>;
574
+ }, z.core.$strip>>;
575
+ customerReference: z.ZodOptional<z.ZodString>;
576
+ }, z.core.$strip>;
577
+ export type ApiPlaceOrderRequest = z.infer<typeof apiPlaceOrderRequestSchema>;
578
+ export declare const adminOrderPreviewRequestSchema: z.ZodObject<{
579
+ customerAccountId: z.ZodString;
580
+ salesChannelId: z.ZodString;
581
+ items: z.ZodArray<z.ZodObject<{
582
+ productId: z.ZodString;
583
+ variantId: z.ZodOptional<z.ZodString>;
584
+ quantity: z.ZodNumber;
585
+ }, z.core.$strip>>;
586
+ deliveryMethodId: z.ZodOptional<z.ZodString>;
587
+ paymentMethodId: z.ZodOptional<z.ZodString>;
588
+ }, z.core.$strip>;
589
+ export type AdminOrderPreviewRequest = z.infer<typeof adminOrderPreviewRequestSchema>;
590
+ export declare const adminOrderPreviewLineSchema: z.ZodObject<{
591
+ productId: z.ZodString;
592
+ variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
593
+ quantity: z.ZodNumber;
594
+ unitPrice: z.ZodString;
595
+ currency: z.ZodString;
596
+ lineTotal: z.ZodNumber;
597
+ unavailable: z.ZodOptional<z.ZodBoolean>;
598
+ }, z.core.$strip>;
599
+ export declare const adminOrderPreviewResponseSchema: z.ZodObject<{
600
+ lines: z.ZodArray<z.ZodObject<{
601
+ productId: z.ZodString;
602
+ variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
603
+ quantity: z.ZodNumber;
604
+ unitPrice: z.ZodString;
605
+ currency: z.ZodString;
606
+ lineTotal: z.ZodNumber;
607
+ unavailable: z.ZodOptional<z.ZodBoolean>;
608
+ }, z.core.$strip>>;
609
+ summary: z.ZodObject<{
610
+ subtotal: z.ZodNumber;
611
+ taxTotal: z.ZodNumber;
612
+ deliveryTotal: z.ZodNumber;
613
+ paymentSurcharge: z.ZodNumber;
614
+ discountTotal: z.ZodNumber;
615
+ total: z.ZodNumber;
616
+ currency: z.ZodString;
617
+ }, z.core.$strip>;
618
+ messages: z.ZodArray<z.ZodObject<{
619
+ productId: z.ZodString;
620
+ code: z.ZodString;
621
+ }, z.core.$strip>>;
622
+ }, z.core.$strip>;
623
+ export type AdminOrderPreviewResponse = z.infer<typeof adminOrderPreviewResponseSchema>;
624
+ export declare const orderCommentSchema: z.ZodObject<{
625
+ id: z.ZodString;
626
+ orderId: z.ZodString;
627
+ authorAdminUserId: z.ZodNullable<z.ZodString>;
628
+ authorCustomerAccountId: z.ZodNullable<z.ZodString>;
629
+ body: z.ZodString;
630
+ isCustomerVisible: z.ZodBoolean;
631
+ notifyCustomer: z.ZodBoolean;
632
+ createdAt: z.ZodString;
633
+ }, z.core.$strip>;
634
+ export type OrderComment = z.infer<typeof orderCommentSchema>;
635
+ export declare const adminAddOrderCommentRequestSchema: z.ZodObject<{
636
+ body: z.ZodString;
637
+ isCustomerVisible: z.ZodBoolean;
638
+ notifyCustomer: z.ZodBoolean;
639
+ }, z.core.$strip>;
640
+ export type AdminAddOrderCommentRequest = z.infer<typeof adminAddOrderCommentRequestSchema>;
641
+ export declare const customerAddOrderCommentRequestSchema: z.ZodObject<{
642
+ body: z.ZodString;
643
+ }, z.core.$strip>;
644
+ export type CustomerAddOrderCommentRequest = z.infer<typeof customerAddOrderCommentRequestSchema>;
645
+ export declare const reorderUnavailableItemSchema: z.ZodObject<{
646
+ productId: z.ZodString;
647
+ variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
648
+ reason: z.ZodEnum<{
649
+ out_of_stock: "out_of_stock";
650
+ discontinued: "discontinued";
651
+ out_of_catalog_scope: "out_of_catalog_scope";
652
+ no_price: "no_price";
653
+ }>;
654
+ }, z.core.$strip>;
655
+ export declare const customerReorderResponseSchema: z.ZodObject<{
656
+ cartId: z.ZodString;
657
+ checkoutUrl: z.ZodString;
658
+ unavailableItems: z.ZodArray<z.ZodObject<{
659
+ productId: z.ZodString;
660
+ variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
661
+ reason: z.ZodEnum<{
662
+ out_of_stock: "out_of_stock";
663
+ discontinued: "discontinued";
664
+ out_of_catalog_scope: "out_of_catalog_scope";
665
+ no_price: "no_price";
666
+ }>;
667
+ }, z.core.$strip>>;
668
+ }, z.core.$strip>;
669
+ export type CustomerReorderResponse = z.infer<typeof customerReorderResponseSchema>;
670
+ export declare const adminReorderResponseSchema: z.ZodObject<{
671
+ newOrderId: z.ZodOptional<z.ZodString>;
672
+ cartId: z.ZodOptional<z.ZodString>;
673
+ unavailableItems: z.ZodArray<z.ZodObject<{
674
+ productId: z.ZodString;
675
+ variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
676
+ reason: z.ZodEnum<{
677
+ out_of_stock: "out_of_stock";
678
+ discontinued: "discontinued";
679
+ out_of_catalog_scope: "out_of_catalog_scope";
680
+ no_price: "no_price";
681
+ }>;
682
+ }, z.core.$strip>>;
683
+ }, z.core.$strip>;
684
+ export type AdminReorderResponse = z.infer<typeof adminReorderResponseSchema>;
685
+ export declare const cloneOrderToQuoteResponseSchema: z.ZodObject<{
686
+ quoteRequestId: z.ZodString;
687
+ }, z.core.$strip>;
688
+ export type CloneOrderToQuoteResponse = z.infer<typeof cloneOrderToQuoteResponseSchema>;
689
+ /**
690
+ * The two lifecycle statuses that are **not** admin-configurable, materialised
691
+ * with universal edges at seed time (feature 038, data-model.md §2), plus the
692
+ * initial one.
693
+ *
694
+ * Published as **constants, not a port** (FR-013): switching `orders` off does
695
+ * not change the spelling of `'on_hold'`, and a gated port answering 503 to
696
+ * "what is the on-hold status code" would be a bug. `payments` compares against
697
+ * the first of them when a gateway reports a partial capture.
698
+ */
699
+ export declare const ORDER_STATUS_ON_HOLD = "on_hold";
700
+ export declare const ORDER_STATUS_CANCELLED = "cancelled";
701
+ export declare const ORDER_STATUS_INITIAL = "new";
702
+ /**
703
+ * The money axis of an order.
704
+ *
705
+ * `failed` is set by the settlement ingress when a gateway declines a payment
706
+ * (feature 085, FR-001). The wire vocabulary — `paymentStatusSchema` in
707
+ * `common.ts` — has carried the value since feature 034, so nothing on the wire
708
+ * changes here; what changed is that the platform can now produce it. It is
709
+ * **system-written only**: `adminOrderPaymentStatusTransitionSchema` accepts
710
+ * `paid` and `refunded` and nothing else, so an operator can see a failed
711
+ * payment but never set one.
712
+ */
713
+ export type OrderPaymentStatus = 'awaiting_payment' | 'paid' | 'failed' | 'deferred' | 'refunded';
714
+ export interface OrderAddressSnapshot {
715
+ recipientName: string;
716
+ street: string;
717
+ city: string;
718
+ postalCode: string;
719
+ country: string;
720
+ phone?: string | null;
721
+ /** Billing only — company name and tax id captured at placement. */
722
+ companyName?: string | null;
723
+ taxId?: string | null;
724
+ }
725
+ export interface OrderDeliveryMethodSnapshot {
726
+ code: string;
727
+ name: string;
728
+ cost: number;
729
+ }
730
+ export interface OrderDeliveryPointSnapshot {
731
+ provider: string;
732
+ pointId: string;
733
+ label?: string | null;
734
+ address?: string | null;
735
+ }
736
+ export interface OrderPaymentMethodSnapshot {
737
+ code: string;
738
+ name: string;
739
+ kind: 'bank_transfer' | 'pickup' | 'credit_limit' | 'gateway';
740
+ /** Feature 034 — adapter registry key the order was placed with. */
741
+ adapter?: string;
742
+ /** Feature 034 — flat payment surcharge captured at placement. */
743
+ additionalPrice?: number;
744
+ }
745
+ /**
746
+ * An order as it crosses a module boundary — a plain shape, never the ORM
747
+ * entity (FR-011).
748
+ *
749
+ * The money columns keep their `string` form. They are `decimal(14,2)` and the
750
+ * entity carries them as strings for exactly one reason: a `number` cannot
751
+ * round-trip a monetary value, and the four payment gateways that read this
752
+ * record all forward the figure to a provider.
753
+ *
754
+ * `status` is a `string` rather than a union because the lifecycle is
755
+ * admin-configurable (feature 038 FR-001/FR-006) — the set of statuses is a
756
+ * table, not an enum, and a consumer that narrowed it would break the first
757
+ * time an operator added one.
758
+ */
759
+ export interface OrderRecord {
760
+ id: string;
761
+ businessId: string;
762
+ organizationId: string;
763
+ placedByCustomerAccountId: string;
764
+ placedOnBehalfByAdminUserId: string | null;
765
+ salesChannelId: string;
766
+ status: string;
767
+ paymentStatus: OrderPaymentStatus;
768
+ deliveryAddress: OrderAddressSnapshot;
769
+ billingAddress: OrderAddressSnapshot;
770
+ deliveryPointSnapshot?: OrderDeliveryPointSnapshot | null;
771
+ /**
772
+ * The adapter-specific shipping envelope captured at placement (feature 068).
773
+ * Opaque here on purpose: only the delivery method's own `ShippingAdapter`
774
+ * knows its shape, and it is published on the record so a carrier module can
775
+ * read the order it is shipping over `OrderReadPort` rather than reaching for
776
+ * this module's entity.
777
+ */
778
+ shippingAdapterData?: Record<string, unknown> | null;
779
+ deliveryMethodId: string;
780
+ deliveryMethodSnapshot: OrderDeliveryMethodSnapshot;
781
+ paymentMethodId: string;
782
+ paymentMethodSnapshot: OrderPaymentMethodSnapshot;
783
+ sourceQuoteRequestId: string | null;
784
+ subtotal: string;
785
+ taxTotal: string;
786
+ discountTotal: string;
787
+ deliveryTotal: string;
788
+ total: string;
789
+ currency: string;
790
+ promotionCode: string | null;
791
+ customerNote: string | null;
792
+ placedAt: Date;
793
+ createdAt: Date;
794
+ updatedAt: Date;
795
+ customFieldValues: Record<string, unknown>;
796
+ }
797
+ /** One line of an order, as `invoices` reads it. */
798
+ export interface OrderItemRecord {
799
+ id: string;
800
+ orderId: string;
801
+ productId: string;
802
+ productSnapshot: {
803
+ sku: string;
804
+ name: string;
805
+ slug?: string | null;
806
+ };
807
+ variantId: string | null;
808
+ variantSnapshot: {
809
+ sku: string;
810
+ label: string;
811
+ } | null;
812
+ packagingUnitSnapshot: {
813
+ name: string;
814
+ baseQuantity: number;
815
+ } | null;
816
+ quantity: number;
817
+ unitPrice: string;
818
+ taxRate: string;
819
+ lineTotal: string;
820
+ createdAt: Date;
821
+ }
822
+ /**
823
+ * Container name: `orderReadPort`. Owner: `orders`.
824
+ *
825
+ * Thirty-three of the 42 inbound sites are `em.findOne(Order, { id })` — four
826
+ * payment gateways, `invoices`, `shipments`, `quote_requests` and the export
827
+ * adapter each spelling the same lookup. That is what this port is.
828
+ *
829
+ * When `orders` is off every method fails closed, and that is the answer a
830
+ * gateway callback should get: acknowledging a payment against an order the
831
+ * platform will not read is worse than making the provider retry.
832
+ *
833
+ * Whether `orders` has an off state at all is its manifest's `activation` to
834
+ * say, not this line's: a module declaring `nonDeactivatable` never enters one.
835
+ */
836
+ export interface OrderReadPort {
837
+ findById(id: string): Promise<OrderRecord | null>;
838
+ findByIds(ids: readonly string[]): Promise<OrderRecord[]>;
839
+ /** Every order, newest first — for the bulk export adapter. */
840
+ listAll(): Promise<OrderRecord[]>;
841
+ /** The order's lines, in insertion order. */
842
+ listItems(orderId: string): Promise<OrderItemRecord[]>;
843
+ /**
844
+ * Ids of orders whose business id contains `fragment`, case-insensitively,
845
+ * capped at `limit`. An empty `fragment` returns no ids.
846
+ *
847
+ * Published after Phase P, for `invoices`' `filter[orderNumber]`. It is not
848
+ * {@link OrderListPort.list}'s `q`, which also matches the buying
849
+ * organisation and the placing customer — an invoice list filtered by "order
850
+ * number" that quietly matched a company name would be a different filter
851
+ * wearing the same label. It is not `findByIds` either: the caller has a
852
+ * fragment, not ids.
853
+ *
854
+ * `limit` is the caller's, applied by the owner, so the narrowing happens
855
+ * once. `invoices` used to `em.find(Order, { businessId: { $ilike } }, {
856
+ * limit: 500 })` and then narrow again against its own page size, which
857
+ * silently dropped matches beyond the 500th.
858
+ */
859
+ findIdsByBusinessIdLike(fragment: string, limit: number): Promise<string[]>;
860
+ /**
861
+ * The distinct sales channels one customer has ordered on, most recently
862
+ * ordered-on first. A customer with no orders answers `[]`.
863
+ *
864
+ * Published for feature 080's T048 (D-169), for the `customers` detail
865
+ * header. It is a **read**, so it is a method here and not an
866
+ * `EntityManager`-taking apply port: handing a read a transaction handle
867
+ * re-opens a write seam to serve it.
868
+ *
869
+ * It is deliberately not {@link OrderListPort.list} with a
870
+ * `placedByCustomerAccountId`. That read is paginated, so the channels it
871
+ * yields are the channels on one page, and a detail header that silently
872
+ * narrowed with the page size would be a different fact under the same
873
+ * label. `customers` used to answer it with `em.find(Order, {
874
+ * placedByCustomerAccountId }, { fields: ['salesChannelId'] })` inside its
875
+ * own module, which was unpaginated and correct and read this module's table
876
+ * whether this module was there or not.
877
+ *
878
+ * The ids come back **already distinct**: the deduplication is the owner's,
879
+ * because it is what makes the ordering meaningful — the answer is one entry
880
+ * per channel keyed on that customer's latest order there.
881
+ */
882
+ salesChannelIdsForCustomer(customerAccountId: string): Promise<string[]>;
883
+ }
884
+ /** The admin order list's filter set. Page and page size are required. */
885
+ export interface OrderListQuery {
886
+ status?: string[] | undefined;
887
+ /** The money axis (feature 085, FR-021). */
888
+ paymentStatus?: string[] | undefined;
889
+ salesChannelId?: string[] | undefined;
890
+ paymentMethodId?: string[] | undefined;
891
+ deliveryMethodId?: string[] | undefined;
892
+ organizationId?: string | undefined;
893
+ /**
894
+ * Feature 040 — restrict to a single customer's own orders. Used by the
895
+ * customer self-service history and the admin customer-detail orders panel.
896
+ * Aggregates across sales channels when `salesChannelId` is omitted.
897
+ */
898
+ placedByCustomerAccountId?: string | undefined;
899
+ q?: string | undefined;
900
+ /** Dedicated org / customer name filters, AND-combined with the global `q`. */
901
+ orgName?: string | undefined;
902
+ customerName?: string | undefined;
903
+ placedFrom?: string | undefined;
904
+ placedTo?: string | undefined;
905
+ totalMin?: number | undefined;
906
+ totalMax?: number | undefined;
907
+ sort?: string | undefined;
908
+ page: number;
909
+ pageSize: number;
910
+ }
911
+ /** Restricts a list to the organisations the caller may see. */
912
+ export interface OrderListScope {
913
+ allowedOrganizationIds: string[];
914
+ }
915
+ /**
916
+ * One row of the admin order list.
917
+ *
918
+ * Deliberately **not** `AdminOrderRow` from this file's HTTP section, though
919
+ * the fields line up: that shape narrows `paymentStatus` and `status` to the
920
+ * unions the API documents, and the list is served straight off a
921
+ * configurable-status table (feature 038 FR-001/FR-006). Reusing the narrowed
922
+ * type would be a lie a consumer could act on the first time an operator adds
923
+ * a status.
924
+ */
925
+ export interface OrderListRow {
926
+ id: string;
927
+ businessId: string;
928
+ customerName: string | null;
929
+ organizationId: string;
930
+ organizationName: string | null;
931
+ status: string;
932
+ statusName: Record<string, string>;
933
+ paymentStatus: string;
934
+ total: number;
935
+ currency: string;
936
+ placedAt: string;
937
+ createdAt: string;
938
+ salesChannelId: string;
939
+ salesChannelName: string | null;
940
+ deliveryMethodName: string | null;
941
+ paymentMethodName: string | null;
942
+ shipToName: string | null;
943
+ billToName: string | null;
944
+ }
945
+ export interface OrderListResult {
946
+ rows: OrderListRow[];
947
+ total: number;
948
+ /** Per lifecycle status, over every filter except the status filter. */
949
+ counts: Record<string, number>;
950
+ /**
951
+ * Per payment status, over every filter except the payment-status filter
952
+ * (feature 085). Two maps and not one: `paid` is both a shipped order status
953
+ * code and a payment status, so a single map would merge two populations.
954
+ */
955
+ paymentStatusCounts: Record<string, number>;
956
+ }
957
+ /**
958
+ * Container name: `orderListPort`. Owner: `orders`.
959
+ *
960
+ * `customers` serves both the self-service order history and the admin
961
+ * customer-detail orders panel from this one list. It reaches it today as
962
+ * `Pick<OrderListService, 'list'>` — a type operator in front of a
963
+ * cross-module import of the class, which is the violation with punctuation on
964
+ * (FR-011). This is the shape that replaces it.
965
+ *
966
+ * **Owner off:** the seam fails closed — resolving this port throws
967
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
968
+ * half-executes. Whether `orders` has an off state at all is its manifest's
969
+ * `activation` to say, not this line's: a module declaring
970
+ * `nonDeactivatable` never enters one.
971
+ */
972
+ export interface OrderListPort {
973
+ list(query: OrderListQuery, scope?: OrderListScope): Promise<OrderListResult>;
974
+ }
975
+ /** Who the buyer is, for a placement made on their behalf or by them. */
976
+ export interface OrderCustomerContext {
977
+ customerAccountId: string;
978
+ organizationId: string;
979
+ /**
980
+ * When the request is from an admin user impersonating this customer, carry
981
+ * the admin's id so the order is stamped with it (FR-042 / R-12).
982
+ */
983
+ impersonatorAdminUserId?: string | null;
984
+ }
985
+ /**
986
+ * What a placement answers with: the order row **plus** the payment
987
+ * next-action computed during that placement.
988
+ *
989
+ * `nextAction` is not on {@link OrderRecord} and must not be: it is a virtual
990
+ * column (`persist: false`, `order.entity.ts`) that exists only in the reply to
991
+ * the call that created the order, so a *read* of an order can never carry a
992
+ * meaningful one. It is on this record because the one thing a caller does with
993
+ * a freshly placed order is route the buyer — to the gateway, to the transfer
994
+ * details, or to the success page.
995
+ *
996
+ * Corrected in feature 075's `quick_order` cut: the port below published
997
+ * `OrderRecord`, and `quick_order`'s one-click response renders `nextAction`.
998
+ * Cutting onto the port as published would have dropped the redirect from the
999
+ * one-click reply — a product change wearing a refactor, on the path
1000
+ * MR !582 / issue #64 had just brought under test.
1001
+ */
1002
+ export interface PlacedOrderRecord extends OrderRecord {
1003
+ nextAction: NextAction | null;
1004
+ }
1005
+ /**
1006
+ * Container name: `orderPlacementPort`. Owner: `orders`.
1007
+ *
1008
+ * `quick_order`'s one-click buy is the only consumer: it seeds the cart and
1009
+ * then places. It already reaches the service through a lazy accessor that can
1010
+ * answer `null`, which is how it expresses "ordering is unavailable"; the port
1011
+ * expresses the same thing as a 503 at the seam, which is stronger — a `null`
1012
+ * accessor is indistinguishable from a wiring mistake.
1013
+ *
1014
+ * **Owner off:** the seam fails closed — resolving this port throws
1015
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
1016
+ * half-executes. Whether `orders` has an off state at all is its manifest's
1017
+ * `activation` to say, not this line's: a module declaring
1018
+ * `nonDeactivatable` never enters one.
1019
+ */
1020
+ export interface OrderPlacementPort {
1021
+ placeOrder(ctx: OrderCustomerContext, req: PlaceOrderRequest): Promise<PlacedOrderRecord>;
1022
+ }
1023
+ export interface OrderStatusActor {
1024
+ kind: 'admin' | 'customer' | 'system';
1025
+ adminUserId?: string;
1026
+ customerAccountId?: string;
1027
+ source?: 'payment' | 'shipment' | 'reorder' | 'checkout';
1028
+ }
1029
+ /** What a caller announcing a committed status change has to say. */
1030
+ export interface OrderStatusChange {
1031
+ orderId: string;
1032
+ organizationId: string;
1033
+ salesChannelId: string;
1034
+ from: string;
1035
+ to: string;
1036
+ actor: OrderStatusActor;
1037
+ reason?: string | null;
1038
+ /**
1039
+ * Feature 062 — human-readable order number for webhook receivers
1040
+ * (contracts/order-webhooks.md §5). Optional: system-driven callers
1041
+ * (payments, shipments) may not have it in scope.
1042
+ */
1043
+ businessId?: string | null;
1044
+ }
1045
+ /**
1046
+ * Container name: `orderStatusAnnouncePort`. Owner: `orders`.
1047
+ *
1048
+ * `payments` and `shipments` move an order's status inside their own
1049
+ * transaction and then have to announce it, which they do today by importing
1050
+ * `orders`' event builder and handing it their own `EventBus`. The templated
1051
+ * event names (`order.status.from_x_to_y.after`, `order.status.to_y.after`)
1052
+ * are `orders`' vocabulary and must be built in one place — they are not known
1053
+ * at compile time, because the status set is admin-configurable.
1054
+ *
1055
+ * A no-op when `from === to`, as the builder already is.
1056
+ *
1057
+ * **Owner off:** the seam fails closed — resolving this port throws
1058
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
1059
+ * half-executes. Whether `orders` has an off state at all is its manifest's
1060
+ * `activation` to say, not this line's: a module declaring
1061
+ * `nonDeactivatable` never enters one.
1062
+ */
1063
+ export interface OrderStatusAnnouncePort {
1064
+ announceStatusChanged(change: OrderStatusChange): void;
1065
+ }
1066
+ /** Why a requested transition did not happen. */
1067
+ export type OrderTransitionRefusal =
1068
+ /** No order with that id. */
1069
+ 'not_found'
1070
+ /** `to` is not a configured status code. */
1071
+ | 'unknown_status'
1072
+ /** The configured lifecycle has no edge, or the source status is terminal. */
1073
+ | 'not_permitted'
1074
+ /** A registered before-guard vetoed it. */
1075
+ | 'vetoed';
1076
+ /**
1077
+ * What became of a requested transition.
1078
+ *
1079
+ * `already_there` is separated from the refusals because it is not one: the
1080
+ * order is where the caller wanted it, nothing moved, and nothing was
1081
+ * recorded. It is the normal outcome of a second declined payment attempt on
1082
+ * an order already held.
1083
+ */
1084
+ export type OrderTransitionOutcome = {
1085
+ applied: true;
1086
+ from: string;
1087
+ to: string;
1088
+ } | {
1089
+ applied: false;
1090
+ reason: 'already_there';
1091
+ from: string;
1092
+ } | {
1093
+ applied: false;
1094
+ reason: OrderTransitionRefusal;
1095
+ from: string | null;
1096
+ detail: string;
1097
+ };
1098
+ /**
1099
+ * Container name: `orderTransitionPort`. Owner: `orders`.
1100
+ *
1101
+ * The write twin of `orderStatusAnnouncePort`: that one publishes the
1102
+ * *announcement* half of a status change, this one performs the change. Three
1103
+ * sites in `payments` and `shipments` write `order.status` directly, and in
1104
+ * doing so skip graph validation, the veto guards, the audit entry and the
1105
+ * side-effects that release stock allocations and free a credit-limit
1106
+ * reservation. This port is the seam that lets them stop (feature 085).
1107
+ *
1108
+ * It is not `orderTransitionServiceAccessor`, which hands out the
1109
+ * `OrderTransitionService` class: a published port's type argument must be a
1110
+ * contract type, and that accessor also answers `null` until the plugin body
1111
+ * has run.
1112
+ *
1113
+ * **Call this after your own commit, never inside your transaction.** The
1114
+ * implementation obtains its own EntityManager, so a caller running inside
1115
+ * `em.transactional` would have the order written on a *different* pooled
1116
+ * connection that commits independently — the caller's rollback cannot reach
1117
+ * it, which is the shape `check:transaction-context` refuses (issue #200).
1118
+ * Both settlement handlers therefore write their payment or shipment row,
1119
+ * commit, and only then call this. The failure mode of that ordering lands on
1120
+ * the safe side: a crash in between leaves the payment recorded and the
1121
+ * lifecycle unmoved, which the buyer can retry, where the opposite ordering
1122
+ * would hold an order against a payment nobody recorded.
1123
+ *
1124
+ * **Refusals are outcomes, not exceptions**, because both settlement callers
1125
+ * are answering a payment service provider: a thrown refusal becomes a non-2xx
1126
+ * callback response, which every PSP retries indefinitely. The refusal has to
1127
+ * be visible to the caller and invisible to the provider.
1128
+ *
1129
+ * **Owner off:** the seam fails closed — resolving this port throws
1130
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
1131
+ * half-executes. A consumer must not wrap the call in a bare `catch`, which
1132
+ * would turn that into fail-open. Whether `orders` has an off state at all is
1133
+ * its manifest's `activation` to say, not this line's: a module declaring
1134
+ * `nonDeactivatable` never enters one.
1135
+ */
1136
+ export interface OrderTransitionPort {
1137
+ /**
1138
+ * Move an order to status `to`, applying the configured lifecycle: graph
1139
+ * validation, the before-guards, the audit entry and the status's
1140
+ * side-effects. The caller invokes none of those and needs to know about
1141
+ * none of them.
1142
+ */
1143
+ applyStatus(input: {
1144
+ orderId: string;
1145
+ to: string;
1146
+ actor: OrderStatusActor;
1147
+ reason?: string | null;
1148
+ }): Promise<OrderTransitionOutcome>;
1149
+ /**
1150
+ * Whether an order's current status is terminal, per the configured graph.
1151
+ *
1152
+ * A caller that has to refuse acting on a finished order asks this rather
1153
+ * than comparing against the string `'cancelled'`: the status set is
1154
+ * operator-configurable and a deployment may add terminal statuses of its
1155
+ * own. `null` when there is no such order, so the caller answers 404 in its
1156
+ * own words instead of guessing.
1157
+ */
1158
+ isTerminal(orderId: string): Promise<boolean | null>;
1159
+ }
1160
+ /**
1161
+ * The answer to a buyer-side claim on an order's GA4 `purchase` conversion
1162
+ * (issue #277).
1163
+ *
1164
+ * `counted: true` means this caller is the one that may report the conversion;
1165
+ * every later caller, on any device, gets `false`. The storefront asks before
1166
+ * it fires, so the tag runs once per order and never again — which is what
1167
+ * stops a buyer who reopens their order from being counted twice, and what
1168
+ * lets the two surfaces that may count an order (`/checkout/success` and
1169
+ * `/orders/:id`) share one answer instead of guessing about each other.
1170
+ */
1171
+ export declare const purchaseConversionClaimResponseSchema: z.ZodObject<{
1172
+ counted: z.ZodBoolean;
1173
+ }, z.core.$strip>;
1174
+ export type PurchaseConversionClaimResponse = z.infer<typeof purchaseConversionClaimResponseSchema>;
1175
+ //# sourceMappingURL=orders.d.ts.map