@endora-commerce/contracts 0.109.0 → 0.111.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 (385) hide show
  1. package/dist/accept-language.d.ts +31 -0
  2. package/dist/accept-language.js +64 -0
  3. package/dist/actor.d.ts +16 -0
  4. package/dist/addresses.d.ts +35 -0
  5. package/dist/addresses.js +8 -1
  6. package/dist/admin-actions.d.ts +2 -0
  7. package/dist/admin-actions.js +18 -0
  8. package/dist/admin-contributions.d.ts +99 -12
  9. package/dist/admin-contributions.js +36 -10
  10. package/dist/admin-roles.d.ts +17 -2
  11. package/dist/admin-users.d.ts +9 -0
  12. package/dist/admin.d.ts +114 -4
  13. package/dist/admin.js +98 -3
  14. package/dist/api-keys.d.ts +22 -0
  15. package/dist/api-keys.js +4 -0
  16. package/dist/assets-library.d.ts +45 -0
  17. package/dist/assets-library.js +20 -3
  18. package/dist/audit-logs.d.ts +12 -0
  19. package/dist/audit-logs.js +12 -0
  20. package/dist/auth.d.ts +9 -0
  21. package/dist/auth.js +9 -0
  22. package/dist/blog.d.ts +382 -22
  23. package/dist/blog.js +199 -17
  24. package/dist/carts.d.ts +423 -36
  25. package/dist/carts.js +150 -12
  26. package/dist/catalog.d.ts +379 -208
  27. package/dist/catalog.js +241 -163
  28. package/dist/cms-brand.d.ts +14 -14
  29. package/dist/cms.d.ts +71 -16
  30. package/dist/cms.js +15 -0
  31. package/dist/command-hooks.d.ts +301 -0
  32. package/dist/command-hooks.js +248 -0
  33. package/dist/common.d.ts +23 -6
  34. package/dist/common.js +25 -2
  35. package/dist/comparisons.d.ts +21 -14
  36. package/dist/comparisons.js +2 -1
  37. package/dist/credit-limits.d.ts +22 -0
  38. package/dist/credit-limits.js +35 -0
  39. package/dist/crm.d.ts +134 -78
  40. package/dist/crm.js +21 -5
  41. package/dist/custom-fields.d.ts +417 -49
  42. package/dist/custom-fields.js +142 -1
  43. package/dist/customer-accounts.d.ts +324 -22
  44. package/dist/customer-accounts.js +43 -0
  45. package/dist/customer-notifications.d.ts +143 -0
  46. package/dist/customer-notifications.js +41 -0
  47. package/dist/customers.d.ts +92 -73
  48. package/dist/customers.js +98 -10
  49. package/dist/dictionary.d.ts +53 -0
  50. package/dist/dictionary.js +25 -0
  51. package/dist/document-templates.d.ts +12 -12
  52. package/dist/email.d.ts +34 -0
  53. package/dist/email.js +6 -0
  54. package/dist/errors.d.ts +431 -3
  55. package/dist/errors.js +523 -3
  56. package/dist/forms-logic.d.ts +79 -0
  57. package/dist/forms-logic.fixtures.d.ts +52 -0
  58. package/dist/forms-logic.fixtures.js +610 -0
  59. package/dist/forms-logic.js +699 -0
  60. package/dist/forms.d.ts +9833 -0
  61. package/dist/forms.js +827 -0
  62. package/dist/i18n.d.ts +34 -0
  63. package/dist/i18n.js +15 -0
  64. package/dist/import-export.d.ts +180 -0
  65. package/dist/import-export.js +60 -0
  66. package/dist/index.d.ts +16 -1
  67. package/dist/index.js +30 -1
  68. package/dist/inventory.d.ts +9 -9
  69. package/dist/invoice-ledger.d.ts +13 -13
  70. package/dist/invoices.d.ts +126 -0
  71. package/dist/invoices.js +53 -0
  72. package/dist/line-bounds.d.ts +53 -0
  73. package/dist/line-bounds.js +65 -0
  74. package/dist/megamenu.d.ts +27 -27
  75. package/dist/mfa.d.ts +210 -4
  76. package/dist/mfa.js +136 -0
  77. package/dist/modules.d.ts +56 -8
  78. package/dist/modules.js +128 -3
  79. package/dist/money-decimal.d.ts +54 -0
  80. package/dist/money-decimal.js +95 -0
  81. package/dist/newsletter.d.ts +4 -4
  82. package/dist/orders.d.ts +246 -12
  83. package/dist/orders.js +140 -7
  84. package/dist/organization-hooks.d.ts +99 -0
  85. package/dist/organization-hooks.js +22 -0
  86. package/dist/organization-registry-lookup.d.ts +362 -0
  87. package/dist/organization-registry-lookup.js +196 -0
  88. package/dist/organization-roles.d.ts +341 -0
  89. package/dist/organization-roles.js +218 -0
  90. package/dist/organizations.d.ts +1074 -103
  91. package/dist/organizations.js +293 -28
  92. package/dist/page-builder-props.d.ts +56 -56
  93. package/dist/pim-connector.d.ts +7 -3
  94. package/dist/pim-connector.js +6 -2
  95. package/dist/pim-field-path.d.ts +5 -1
  96. package/dist/pim-field-path.js +37 -81
  97. package/dist/pim-locale-mapping.d.ts +131 -0
  98. package/dist/pim-locale-mapping.js +193 -0
  99. package/dist/price-books.d.ts +215 -63
  100. package/dist/price-books.js +47 -2
  101. package/dist/price-lists.d.ts +13 -10
  102. package/dist/product-feeds.d.ts +249 -100
  103. package/dist/product-feeds.js +46 -2
  104. package/dist/product-scope-model.d.ts +161 -0
  105. package/dist/product-scope-model.js +161 -0
  106. package/dist/product-scope-overrides.d.ts +0 -103
  107. package/dist/product-scope-overrides.js +0 -54
  108. package/dist/product-scoped-values.d.ts +2610 -0
  109. package/dist/product-scoped-values.js +425 -0
  110. package/dist/product-scopes.d.ts +199 -64
  111. package/dist/product-scopes.js +120 -23
  112. package/dist/product-tax-rates.d.ts +38 -0
  113. package/dist/product-tax-rates.js +45 -0
  114. package/dist/product-url-keys.d.ts +51 -45
  115. package/dist/product-url-keys.js +73 -39
  116. package/dist/product-value-resolver.d.ts +37 -60
  117. package/dist/product-value-resolver.js +36 -96
  118. package/dist/projects.d.ts +76 -28
  119. package/dist/projects.js +53 -9
  120. package/dist/promotions.d.ts +163 -11
  121. package/dist/promotions.js +23 -1
  122. package/dist/pwa.d.ts +41 -2
  123. package/dist/quick-order.d.ts +159 -9
  124. package/dist/quick-order.js +79 -4
  125. package/dist/quote-requests.d.ts +231 -17
  126. package/dist/quote-requests.js +111 -9
  127. package/dist/record-references.d.ts +15 -15
  128. package/dist/record-references.js +2 -3
  129. package/dist/record-rich-text.js +2 -1
  130. package/dist/returns.d.ts +214 -52
  131. package/dist/returns.js +143 -28
  132. package/dist/sales-channels.d.ts +34 -3
  133. package/dist/sales-channels.js +16 -1
  134. package/dist/saved-list-views.d.ts +28 -0
  135. package/dist/saved-list-views.js +14 -1
  136. package/dist/schema-extensions.d.ts +36 -0
  137. package/dist/schema-extensions.js +29 -0
  138. package/dist/scoped-write-encoding.d.ts +100 -0
  139. package/dist/scoped-write-encoding.js +135 -0
  140. package/dist/search.d.ts +18 -16
  141. package/dist/seo.d.ts +83 -30
  142. package/dist/seo.js +8 -1
  143. package/dist/settings.d.ts +173 -2
  144. package/dist/settings.js +53 -2
  145. package/dist/shopping-lists.d.ts +63 -4
  146. package/dist/shopping-lists.js +57 -3
  147. package/dist/storefront-cache-tags.d.ts +22 -0
  148. package/dist/storefront-cache-tags.js +12 -0
  149. package/dist/storefront-value-overrides.d.ts +18 -56
  150. package/dist/storefront-value-overrides.js +11 -86
  151. package/dist/tasks.d.ts +27 -27
  152. package/dist/taxes.d.ts +27 -0
  153. package/dist/taxes.js +4 -0
  154. package/dist/transactional-emails.d.ts +48 -22
  155. package/dist/webhooks.d.ts +75 -0
  156. package/dist/webhooks.js +24 -0
  157. package/package.json +5 -3
  158. package/dist/actor.d.ts.map +0 -1
  159. package/dist/actor.js.map +0 -1
  160. package/dist/addresses.d.ts.map +0 -1
  161. package/dist/addresses.js.map +0 -1
  162. package/dist/admin-actions.d.ts.map +0 -1
  163. package/dist/admin-actions.js.map +0 -1
  164. package/dist/admin-contributions.d.ts.map +0 -1
  165. package/dist/admin-contributions.js.map +0 -1
  166. package/dist/admin-feedback.d.ts.map +0 -1
  167. package/dist/admin-feedback.js.map +0 -1
  168. package/dist/admin-i18n.d.ts.map +0 -1
  169. package/dist/admin-i18n.js.map +0 -1
  170. package/dist/admin-name.d.ts.map +0 -1
  171. package/dist/admin-name.js.map +0 -1
  172. package/dist/admin-notifications.d.ts.map +0 -1
  173. package/dist/admin-notifications.js.map +0 -1
  174. package/dist/admin-preferences.d.ts.map +0 -1
  175. package/dist/admin-preferences.js.map +0 -1
  176. package/dist/admin-roles.d.ts.map +0 -1
  177. package/dist/admin-roles.js.map +0 -1
  178. package/dist/admin-search.d.ts.map +0 -1
  179. package/dist/admin-search.js.map +0 -1
  180. package/dist/admin-users.d.ts.map +0 -1
  181. package/dist/admin-users.js.map +0 -1
  182. package/dist/admin.d.ts.map +0 -1
  183. package/dist/admin.js.map +0 -1
  184. package/dist/analytics.d.ts.map +0 -1
  185. package/dist/analytics.js.map +0 -1
  186. package/dist/api-keys.d.ts.map +0 -1
  187. package/dist/api-keys.js.map +0 -1
  188. package/dist/assets-library.d.ts.map +0 -1
  189. package/dist/assets-library.js.map +0 -1
  190. package/dist/audit-logs.d.ts.map +0 -1
  191. package/dist/audit-logs.js.map +0 -1
  192. package/dist/auth.d.ts.map +0 -1
  193. package/dist/auth.js.map +0 -1
  194. package/dist/blog.d.ts.map +0 -1
  195. package/dist/blog.js.map +0 -1
  196. package/dist/capabilities.d.ts.map +0 -1
  197. package/dist/capabilities.js.map +0 -1
  198. package/dist/carts.d.ts.map +0 -1
  199. package/dist/carts.js.map +0 -1
  200. package/dist/catalog.d.ts.map +0 -1
  201. package/dist/catalog.js.map +0 -1
  202. package/dist/cms-brand.d.ts.map +0 -1
  203. package/dist/cms-brand.js.map +0 -1
  204. package/dist/cms-contact-form.d.ts.map +0 -1
  205. package/dist/cms-contact-form.js.map +0 -1
  206. package/dist/cms.d.ts.map +0 -1
  207. package/dist/cms.js.map +0 -1
  208. package/dist/common.d.ts.map +0 -1
  209. package/dist/common.js.map +0 -1
  210. package/dist/comparisons.d.ts.map +0 -1
  211. package/dist/comparisons.js.map +0 -1
  212. package/dist/credentials.d.ts.map +0 -1
  213. package/dist/credentials.js.map +0 -1
  214. package/dist/credit-limits.d.ts.map +0 -1
  215. package/dist/credit-limits.js.map +0 -1
  216. package/dist/crm-rich-text.d.ts.map +0 -1
  217. package/dist/crm-rich-text.js.map +0 -1
  218. package/dist/crm.d.ts.map +0 -1
  219. package/dist/crm.js.map +0 -1
  220. package/dist/currencies.d.ts.map +0 -1
  221. package/dist/currencies.js.map +0 -1
  222. package/dist/custom-fields.d.ts.map +0 -1
  223. package/dist/custom-fields.js.map +0 -1
  224. package/dist/customer-accounts.d.ts.map +0 -1
  225. package/dist/customer-accounts.js.map +0 -1
  226. package/dist/customers.d.ts.map +0 -1
  227. package/dist/customers.js.map +0 -1
  228. package/dist/dictionary.d.ts.map +0 -1
  229. package/dist/dictionary.js.map +0 -1
  230. package/dist/document-templates.d.ts.map +0 -1
  231. package/dist/document-templates.js.map +0 -1
  232. package/dist/document-values.d.ts.map +0 -1
  233. package/dist/document-values.js.map +0 -1
  234. package/dist/email-address.d.ts.map +0 -1
  235. package/dist/email-address.js.map +0 -1
  236. package/dist/email.d.ts.map +0 -1
  237. package/dist/email.js.map +0 -1
  238. package/dist/envelopes.d.ts.map +0 -1
  239. package/dist/envelopes.js.map +0 -1
  240. package/dist/environment-inputs.d.ts.map +0 -1
  241. package/dist/environment-inputs.js.map +0 -1
  242. package/dist/erp-connector.d.ts.map +0 -1
  243. package/dist/erp-connector.js.map +0 -1
  244. package/dist/errors.d.ts.map +0 -1
  245. package/dist/errors.js.map +0 -1
  246. package/dist/google-analytics.d.ts.map +0 -1
  247. package/dist/google-analytics.js.map +0 -1
  248. package/dist/google-tag-manager.d.ts.map +0 -1
  249. package/dist/google-tag-manager.js.map +0 -1
  250. package/dist/i18n.d.ts.map +0 -1
  251. package/dist/i18n.js.map +0 -1
  252. package/dist/import-export.d.ts.map +0 -1
  253. package/dist/import-export.js.map +0 -1
  254. package/dist/index.d.ts.map +0 -1
  255. package/dist/index.js.map +0 -1
  256. package/dist/inventory.d.ts.map +0 -1
  257. package/dist/inventory.js.map +0 -1
  258. package/dist/invoice-ledger.d.ts.map +0 -1
  259. package/dist/invoice-ledger.js.map +0 -1
  260. package/dist/invoices.d.ts.map +0 -1
  261. package/dist/invoices.js.map +0 -1
  262. package/dist/kernel.d.ts.map +0 -1
  263. package/dist/kernel.js.map +0 -1
  264. package/dist/languages.d.ts.map +0 -1
  265. package/dist/languages.js.map +0 -1
  266. package/dist/line-groups.d.ts.map +0 -1
  267. package/dist/line-groups.js.map +0 -1
  268. package/dist/linkedin-ads.d.ts.map +0 -1
  269. package/dist/linkedin-ads.js.map +0 -1
  270. package/dist/localized-name.d.ts.map +0 -1
  271. package/dist/localized-name.js.map +0 -1
  272. package/dist/megamenu.d.ts.map +0 -1
  273. package/dist/megamenu.js.map +0 -1
  274. package/dist/meta-ads.d.ts.map +0 -1
  275. package/dist/meta-ads.js.map +0 -1
  276. package/dist/mfa.d.ts.map +0 -1
  277. package/dist/mfa.js.map +0 -1
  278. package/dist/modules.d.ts.map +0 -1
  279. package/dist/modules.js.map +0 -1
  280. package/dist/money-decimal.d.ts.map +0 -1
  281. package/dist/money-decimal.js.map +0 -1
  282. package/dist/money-input.d.ts.map +0 -1
  283. package/dist/money-input.js.map +0 -1
  284. package/dist/newsletter.d.ts.map +0 -1
  285. package/dist/newsletter.js.map +0 -1
  286. package/dist/order-minimums.d.ts.map +0 -1
  287. package/dist/order-minimums.js.map +0 -1
  288. package/dist/orders.d.ts.map +0 -1
  289. package/dist/orders.js.map +0 -1
  290. package/dist/organizations.d.ts.map +0 -1
  291. package/dist/organizations.js.map +0 -1
  292. package/dist/page-builder-props.d.ts.map +0 -1
  293. package/dist/page-builder-props.js.map +0 -1
  294. package/dist/page-builder-values.d.ts.map +0 -1
  295. package/dist/page-builder-values.js.map +0 -1
  296. package/dist/pagination.d.ts.map +0 -1
  297. package/dist/pagination.js.map +0 -1
  298. package/dist/payment-methods.d.ts.map +0 -1
  299. package/dist/payment-methods.js.map +0 -1
  300. package/dist/payment-return-url.d.ts.map +0 -1
  301. package/dist/payment-return-url.js.map +0 -1
  302. package/dist/payments.d.ts.map +0 -1
  303. package/dist/payments.js.map +0 -1
  304. package/dist/pim-connector.d.ts.map +0 -1
  305. package/dist/pim-connector.js.map +0 -1
  306. package/dist/pim-field-path.d.ts.map +0 -1
  307. package/dist/pim-field-path.js.map +0 -1
  308. package/dist/platform-info.d.ts.map +0 -1
  309. package/dist/platform-info.js.map +0 -1
  310. package/dist/platform-language.d.ts.map +0 -1
  311. package/dist/platform-language.js.map +0 -1
  312. package/dist/price-book-decimal.d.ts.map +0 -1
  313. package/dist/price-book-decimal.js.map +0 -1
  314. package/dist/price-books.d.ts.map +0 -1
  315. package/dist/price-books.js.map +0 -1
  316. package/dist/price-lists.d.ts.map +0 -1
  317. package/dist/price-lists.js.map +0 -1
  318. package/dist/product-feeds.d.ts.map +0 -1
  319. package/dist/product-feeds.js.map +0 -1
  320. package/dist/product-scope-overrides.d.ts.map +0 -1
  321. package/dist/product-scope-overrides.js.map +0 -1
  322. package/dist/product-scopes.d.ts.map +0 -1
  323. package/dist/product-scopes.js.map +0 -1
  324. package/dist/product-summary-text.d.ts.map +0 -1
  325. package/dist/product-summary-text.js.map +0 -1
  326. package/dist/product-url-keys.d.ts.map +0 -1
  327. package/dist/product-url-keys.js.map +0 -1
  328. package/dist/product-value-resolver.d.ts.map +0 -1
  329. package/dist/product-value-resolver.js.map +0 -1
  330. package/dist/projects.d.ts.map +0 -1
  331. package/dist/projects.js.map +0 -1
  332. package/dist/promotions.d.ts.map +0 -1
  333. package/dist/promotions.js.map +0 -1
  334. package/dist/prompt-actions.d.ts.map +0 -1
  335. package/dist/prompt-actions.js.map +0 -1
  336. package/dist/pwa.d.ts.map +0 -1
  337. package/dist/pwa.js.map +0 -1
  338. package/dist/quick-order.d.ts.map +0 -1
  339. package/dist/quick-order.js.map +0 -1
  340. package/dist/quote-requests.d.ts.map +0 -1
  341. package/dist/quote-requests.js.map +0 -1
  342. package/dist/record-references.d.ts.map +0 -1
  343. package/dist/record-references.js.map +0 -1
  344. package/dist/record-rich-text.d.ts.map +0 -1
  345. package/dist/record-rich-text.js.map +0 -1
  346. package/dist/returns.d.ts.map +0 -1
  347. package/dist/returns.js.map +0 -1
  348. package/dist/sales-channels.d.ts.map +0 -1
  349. package/dist/sales-channels.js.map +0 -1
  350. package/dist/saved-list-views.d.ts.map +0 -1
  351. package/dist/saved-list-views.js.map +0 -1
  352. package/dist/scope-notice.d.ts.map +0 -1
  353. package/dist/scope-notice.js.map +0 -1
  354. package/dist/scoped-translations.d.ts +0 -48
  355. package/dist/scoped-translations.d.ts.map +0 -1
  356. package/dist/scoped-translations.js +0 -78
  357. package/dist/scoped-translations.js.map +0 -1
  358. package/dist/search.d.ts.map +0 -1
  359. package/dist/search.js.map +0 -1
  360. package/dist/seo.d.ts.map +0 -1
  361. package/dist/seo.js.map +0 -1
  362. package/dist/settings.d.ts.map +0 -1
  363. package/dist/settings.js.map +0 -1
  364. package/dist/shipments.d.ts.map +0 -1
  365. package/dist/shipments.js.map +0 -1
  366. package/dist/shipping-methods.d.ts.map +0 -1
  367. package/dist/shipping-methods.js.map +0 -1
  368. package/dist/shopping-lists.d.ts.map +0 -1
  369. package/dist/shopping-lists.js.map +0 -1
  370. package/dist/storefront-cache-tags.d.ts.map +0 -1
  371. package/dist/storefront-cache-tags.js.map +0 -1
  372. package/dist/storefront-language-path.d.ts.map +0 -1
  373. package/dist/storefront-language-path.js.map +0 -1
  374. package/dist/storefront-value-overrides.d.ts.map +0 -1
  375. package/dist/storefront-value-overrides.js.map +0 -1
  376. package/dist/tasks.d.ts.map +0 -1
  377. package/dist/tasks.js.map +0 -1
  378. package/dist/taxes.d.ts.map +0 -1
  379. package/dist/taxes.js.map +0 -1
  380. package/dist/text-normalization.d.ts.map +0 -1
  381. package/dist/text-normalization.js.map +0 -1
  382. package/dist/transactional-emails.d.ts.map +0 -1
  383. package/dist/transactional-emails.js.map +0 -1
  384. package/dist/webhooks.d.ts.map +0 -1
  385. package/dist/webhooks.js.map +0 -1
package/dist/mfa.d.ts CHANGED
@@ -37,6 +37,108 @@ export declare const federatedSignInOptionsResponseSchema: z.ZodObject<{
37
37
  }>>;
38
38
  }, z.core.$strip>;
39
39
  export type FederatedSignInOptionsResponse = z.infer<typeof federatedSignInOptionsResponseSchema>;
40
+ /**
41
+ * The `error` a refused federated sign-in carries back to the storefront or the Admin UI:
42
+ * `/login?error=<code>` (issues #789, #813). A code, never a sentence — each frontend words
43
+ * it in its own copy and reads any other value as its generic sign-in failure
44
+ * (`specs/conventions/module-i18n.md`, URL-borne errors). These are redirect codes, not API
45
+ * `error.code` values, which is why they are lower-case and fall outside `errorCodeRe`.
46
+ *
47
+ * - `unknown_provider` — the provider in the path is not one the platform supports.
48
+ * - `provider_unavailable` — the provider is not configured or not enabled for the channel.
49
+ * - `sign_in_cancelled` — the provider answered with an error, or the callback is incomplete.
50
+ * - `sign_in_expired` — the transaction is gone or belongs to another browser.
51
+ * - `sign_in_failed` — the code exchange with the provider failed.
52
+ * - `email_unverified` — the provider's e-mail address is not verified.
53
+ * - `no_matching_account` — no account matches the provider identity.
54
+ * - `account_blocked` — the matched account is blocked.
55
+ * - `registration_disabled_in_channel` — no account exists and personal (org-less)
56
+ * registration is off on the channel the sign-in started on
57
+ * (`customers.allow_registration_without_organization`), so none was created. Business
58
+ * registration is not affected.
59
+ * - `mfa_setup_required` — a second factor is enforced and not set up yet.
60
+ * - `sales_channel_sign_in_required` — no account exists and the store is closed to
61
+ * anonymous visitors, so none was created.
62
+ * - `sales_channel_not_permitted` — the account's Organization may not use this store.
63
+ */
64
+ export declare const federatedSignInErrorCodeSchema: z.ZodEnum<{
65
+ unknown_provider: "unknown_provider";
66
+ provider_unavailable: "provider_unavailable";
67
+ sign_in_cancelled: "sign_in_cancelled";
68
+ sign_in_expired: "sign_in_expired";
69
+ sign_in_failed: "sign_in_failed";
70
+ email_unverified: "email_unverified";
71
+ no_matching_account: "no_matching_account";
72
+ account_blocked: "account_blocked";
73
+ registration_disabled_in_channel: "registration_disabled_in_channel";
74
+ mfa_setup_required: "mfa_setup_required";
75
+ sales_channel_sign_in_required: "sales_channel_sign_in_required";
76
+ sales_channel_not_permitted: "sales_channel_not_permitted";
77
+ }>;
78
+ export type FederatedSignInErrorCode = z.infer<typeof federatedSignInErrorCodeSchema>;
79
+ /**
80
+ * The storefront route the customer callback sends the browser to, on the sales
81
+ * channel's own storefront origin (`sales_channels.storefront_url`, else
82
+ * `STOREFRONT_BASE_URL`): `<origin>/auth/federated/complete?code=<code>`. Not
83
+ * language-prefixed. The storefront redeems the code server-to-server through
84
+ * `POST /api/v1/auth/customer/oauth/exchange` and sets its own cookies, so the
85
+ * sign-in works when the API is served from another host than the storefront.
86
+ */
87
+ export declare const FEDERATED_SIGN_IN_COMPLETE_PATH = "/auth/federated/complete";
88
+ /** Seconds a hand-off code can be redeemed for; it is single-use either way. */
89
+ export declare const FEDERATED_SIGN_IN_HANDOFF_TTL_SECONDS = 60;
90
+ /**
91
+ * `GET /api/v1/auth/customer/oauth/:provider/start` query. `binding` is the
92
+ * SHA-256 (lower-case hex) of the secret the storefront put in its own
93
+ * `b2b_federated_binding` cookie before redirecting here; the exchange is
94
+ * answered only for a caller presenting that secret, so a hand-off code cannot be
95
+ * redeemed from another browser (login CSRF, history replay). Required on the
96
+ * customer surface: a start without it is sent back to `/login?error=sign_in_failed`.
97
+ */
98
+ export declare const customerFederatedSignInStartQuerySchema: z.ZodObject<{
99
+ next: z.ZodOptional<z.ZodString>;
100
+ salesChannel: z.ZodOptional<z.ZodString>;
101
+ binding: z.ZodString;
102
+ }, z.core.$strip>;
103
+ export type CustomerFederatedSignInStartQuery = z.infer<typeof customerFederatedSignInStartQuerySchema>;
104
+ /**
105
+ * `POST /api/v1/auth/customer/oauth/exchange` body: the hand-off `code` from the
106
+ * landing URL and the raw `binding` secret from the storefront's cookie.
107
+ */
108
+ export declare const federatedSignInExchangeRequestSchema: z.ZodObject<{
109
+ code: z.ZodString;
110
+ binding: z.ZodString;
111
+ }, z.core.$strict>;
112
+ export type FederatedSignInExchangeRequest = z.infer<typeof federatedSignInExchangeRequestSchema>;
113
+ /**
114
+ * `POST /api/v1/auth/customer/oauth/exchange` answer — the same kinds of answer
115
+ * the password sign-in gives. `authenticated`: the session arrives as
116
+ * `Set-Cookie: b2b_session` (as from `POST /api/v1/auth/customer/login`) and
117
+ * `cartMerge` is the signed-out basket's merge. `mfaRequired`: the storefront
118
+ * keeps `challengeId` in its second-step cookie and sends the buyer to
119
+ * `redirectPath`, the code screen. A second factor still to be set up, and every
120
+ * refusal, never reaches the exchange: the callback sends those to
121
+ * `/login?error=<code>`. Every failure is `400 MFA_FEDERATED_HANDOFF_INVALID`.
122
+ */
123
+ export declare const federatedSignInExchangeResponseSchema: z.ZodObject<{
124
+ data: z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ status: z.ZodLiteral<"authenticated">;
126
+ redirectPath: z.ZodString;
127
+ cartMerge: z.ZodNullable<z.ZodObject<{
128
+ outcome: z.ZodEnum<{
129
+ adopted: "adopted";
130
+ merged: "merged";
131
+ noop: "noop";
132
+ }>;
133
+ destinationCartId: z.ZodString;
134
+ }, z.core.$strip>>;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ status: z.ZodLiteral<"mfaRequired">;
137
+ challengeId: z.ZodString;
138
+ redirectPath: z.ZodString;
139
+ }, z.core.$strip>], "status">;
140
+ }, z.core.$strip>;
141
+ export type FederatedSignInExchangeResponse = z.infer<typeof federatedSignInExchangeResponseSchema>;
40
142
  /**
41
143
  * Discriminated result returned by the first login step (email+password) and
42
144
  * by the OAuth callback. Only `authenticated` carries/sets a session cookie;
@@ -143,11 +245,27 @@ export declare const mfaSocialUnlinkResponseSchema: z.ZodObject<{
143
245
  }>;
144
246
  }, z.core.$strip>;
145
247
  export type MfaSocialUnlinkResponse = z.infer<typeof mfaSocialUnlinkResponseSchema>;
248
+ /**
249
+ * Why the account may not switch its second factor off (issue #935).
250
+ *
251
+ * `factor_required` — it is the account's last second factor, and a
252
+ * requirement is in force for it: a setting, an administrator's role or a
253
+ * customer's organization. The same verdict refuses `POST …/mfa/disable` with
254
+ * `409 MFA_LAST_FACTOR_REQUIRED`.
255
+ */
256
+ export declare const mfaDisableBlockedReasonSchema: z.ZodEnum<{
257
+ factor_required: "factor_required";
258
+ }>;
259
+ export type MfaDisableBlockedReason = z.infer<typeof mfaDisableBlockedReasonSchema>;
146
260
  export declare const mfaStatusResponseSchema: z.ZodObject<{
147
261
  totpActive: z.ZodBoolean;
148
262
  recoveryCodesRemaining: z.ZodNumber;
149
263
  totpEnabledForScope: z.ZodBoolean;
150
264
  totpEnforcedForScope: z.ZodBoolean;
265
+ canDisable: z.ZodBoolean;
266
+ disableBlockedReason: z.ZodNullable<z.ZodEnum<{
267
+ factor_required: "factor_required";
268
+ }>>;
151
269
  socialLinks: z.ZodArray<z.ZodObject<{
152
270
  provider: z.ZodEnum<{
153
271
  google: "google";
@@ -186,6 +304,21 @@ export declare const mfaResetBulkResultSchema: z.ZodObject<{
186
304
  skipped: z.ZodNumber;
187
305
  }, z.core.$strip>;
188
306
  export type MfaResetBulkResult = z.infer<typeof mfaResetBulkResultSchema>;
307
+ /**
308
+ * Why a second-factor requirement cannot be met on this instance: `mfa` has no
309
+ * `MFA_SECRET_ENCRYPTION_KEY`, so it serves no enrolment route (issue #930).
310
+ * One spelling for every refusal and notice that says so — the
311
+ * `mfa.admin.totp_enforced` write, its Settings notice, and a role's
312
+ * two-factor flag — as `details.reason` and as the sentence token.
313
+ */
314
+ export declare const ENCRYPTION_KEY_MISSING: "encryption_key_missing";
315
+ /**
316
+ * Issue #947 — sentence token for customer-side refusals; `details.reason`
317
+ * stays `ENCRYPTION_KEY_MISSING`. Carried as `details.code` by the refusal of
318
+ * `mfa.storefront.totp_enforced` and of an organization's policy, whose
319
+ * sentence names customers rather than administrators.
320
+ */
321
+ export declare const CUSTOMER_ENCRYPTION_KEY_MISSING: "customer_encryption_key_missing";
189
322
  export declare const MFA_SETTING_CODES: {
190
323
  /**
191
324
  * Feature 074 — the operator-activation control (Constitution XVII). It sits
@@ -239,9 +372,13 @@ export interface MfaEnrolmentCountPort {
239
372
  * platform currently **requires** of administrators. `/platform/modules` asks
240
373
  * it before an operator switches `mfa` off and refuses the switch-off while the
241
374
  * answer is `true` (`MFA_DEACTIVATION_BLOCKED`): the requirement is turned off
242
- * first, as its own deliberate settings change, and only then the
243
- * module. Off still means no second factor (D-96); what this adds is that the
244
- * one switch no longer silently takes the administrator requirement with it.
375
+ * first, as its own deliberate change, and only then the module. Off still
376
+ * means no second factor (D-96); what this adds is that the one switch no
377
+ * longer silently takes the administrator requirement with it.
378
+ *
379
+ * The requirement has **two sources** since issue #349: the platform-wide
380
+ * setting `mfa.admin.totp_enforced`, and any admin role whose
381
+ * `requiresTwoFactor` is set. Either one blocks the switch-off.
245
382
  *
246
383
  * Read while the module is still on, through an open gate, for the reason
247
384
  * {@link MfaEnrolmentCountPort} gives. Unlike that count, a read that fails is
@@ -249,8 +386,77 @@ export interface MfaEnrolmentCountPort {
249
386
  * switch-off rather than letting it through.
250
387
  */
251
388
  export interface MfaDeactivationGuardPort {
252
- /** Whether `mfa.admin.totp_enforced` is in force for the admin surface. */
389
+ /**
390
+ * Whether a second factor is required of any administrator: the setting
391
+ * `mfa.admin.totp_enforced`, or a role with `requiresTwoFactor`.
392
+ */
253
393
  isAdminSecondFactorRequired(): Promise<boolean>;
394
+ /**
395
+ * The same answer, by source, so the refusal can name what to turn off:
396
+ * whether the setting is on, and the codes of the roles that set the flag.
397
+ */
398
+ requirement(): Promise<MfaAdminSecondFactorRequirement>;
399
+ }
400
+ /** What requires administrators to use a second factor — see {@link MfaDeactivationGuardPort}. */
401
+ export interface MfaAdminSecondFactorRequirement {
402
+ /** `mfa.admin.totp_enforced` is on. */
403
+ readonly setting: boolean;
404
+ /** Codes of the roles whose `requiresTwoFactor` is set, in role-list order. */
405
+ readonly roleCodes: readonly string[];
406
+ }
407
+ /**
408
+ * Why a second-factor requirement started binding these administrators: a
409
+ * role's flag was turned on, a role with the flag was given to them, or
410
+ * (issue #349, E-349-1) `mfa.admin.totp_enforced` was switched on.
411
+ */
412
+ export type MfaAdminEnforcementTrigger = 'role_requirement_enabled' | 'role_assigned' | 'setting_enabled';
413
+ /** What {@link MfaAdminEnforcementPort.endUnprotectedAdminSessions} is told. */
414
+ export type MfaEndUnprotectedAdminSessionsOptions = {
415
+ /** The acting administrator's own current session, which is kept. */
416
+ readonly exceptSessionId?: string;
417
+ } & ({
418
+ readonly trigger: 'role_requirement_enabled' | 'role_assigned';
419
+ /** The role whose requirement now binds them, for the audit row. */
420
+ readonly roleCode: string;
421
+ } | {
422
+ readonly trigger: 'setting_enabled';
423
+ /** The setting that now binds them, for the audit row. */
424
+ readonly settingCode: string;
425
+ });
426
+ /**
427
+ * Container name: `mfaAdminEnforcementPort`. Owner: `mfa`.
428
+ *
429
+ * Issue #349 — what `admin_users` needs from `mfa` when a role's
430
+ * `requiresTwoFactor` starts binding administrators, either because the flag
431
+ * was turned on or because an administrator was given the role.
432
+ *
433
+ * An administrator session lasts thirty days, so a requirement applied only at
434
+ * the next sign-in could stay unenforced for a month. An administrator with an
435
+ * **active** enrolment keeps their sessions: `beginLogin` challenged them for
436
+ * it, or they proved it by confirming the enrolment. The others were opened
437
+ * without a second factor, and those end.
438
+ *
439
+ * Non-binding for `admin_users`: it resolves this only while `mfa` is present,
440
+ * and with `mfa` absent the flag cannot be turned on at all
441
+ * (`MFA_REQUIRED_FOR_ROLE_TWO_FACTOR`). `mfa` calls it itself when
442
+ * `mfa.admin.totp_enforced` is switched on (issue #349, E-349-1).
443
+ *
444
+ * Without the encryption key no requirement is in force (issue #948, owner
445
+ * ruling Q6), so none binds anybody: nothing is ended and nobody is counted.
446
+ */
447
+ export interface MfaAdminEnforcementPort {
448
+ /**
449
+ * End every session and pending login of these administrators that is not
450
+ * protected by an active second factor, sparing `exceptSessionId`. Records
451
+ * one audit row when anybody was affected. Answers how many administrators
452
+ * had no active enrolment, which is how many were signed out — `0`, and
453
+ * nothing ended, where no second factor can be enrolled.
454
+ */
455
+ endUnprotectedAdminSessions(adminUserIds: readonly string[], options: MfaEndUnprotectedAdminSessionsOptions): Promise<number>;
456
+ /** How many of these administrators have no active enrolment — the preview of the call above. */
457
+ countUnprotected(adminUserIds: readonly string[]): Promise<number>;
458
+ /** Whether a requirement set now can be met: `mfa` composed with its encryption key. */
459
+ canEnforceAdminSecondFactor(): Promise<boolean>;
254
460
  }
255
461
  /**
256
462
  * Container name: `mfaEnrolmentStatePort`. Owner: `mfa`.
package/dist/mfa.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // the two-step login result, federated sign-in, and admin reset/enforcement.
5
5
  // Provider client secrets are NOT modelled here — they are backend config/env.
6
6
  import { z } from 'zod';
7
+ import { cartMergeOutcomePublicSchema } from './organizations.js';
7
8
  // ---------------------------------------------------------------------------
8
9
  // Shared enums
9
10
  // ---------------------------------------------------------------------------
@@ -36,6 +37,114 @@ export const mfaSocialProviderSchema = z.enum(['google', 'microsoft']);
36
37
  export const federatedSignInOptionsResponseSchema = z.object({
37
38
  providers: z.array(mfaSocialProviderSchema),
38
39
  });
40
+ /**
41
+ * The `error` a refused federated sign-in carries back to the storefront or the Admin UI:
42
+ * `/login?error=<code>` (issues #789, #813). A code, never a sentence — each frontend words
43
+ * it in its own copy and reads any other value as its generic sign-in failure
44
+ * (`specs/conventions/module-i18n.md`, URL-borne errors). These are redirect codes, not API
45
+ * `error.code` values, which is why they are lower-case and fall outside `errorCodeRe`.
46
+ *
47
+ * - `unknown_provider` — the provider in the path is not one the platform supports.
48
+ * - `provider_unavailable` — the provider is not configured or not enabled for the channel.
49
+ * - `sign_in_cancelled` — the provider answered with an error, or the callback is incomplete.
50
+ * - `sign_in_expired` — the transaction is gone or belongs to another browser.
51
+ * - `sign_in_failed` — the code exchange with the provider failed.
52
+ * - `email_unverified` — the provider's e-mail address is not verified.
53
+ * - `no_matching_account` — no account matches the provider identity.
54
+ * - `account_blocked` — the matched account is blocked.
55
+ * - `registration_disabled_in_channel` — no account exists and personal (org-less)
56
+ * registration is off on the channel the sign-in started on
57
+ * (`customers.allow_registration_without_organization`), so none was created. Business
58
+ * registration is not affected.
59
+ * - `mfa_setup_required` — a second factor is enforced and not set up yet.
60
+ * - `sales_channel_sign_in_required` — no account exists and the store is closed to
61
+ * anonymous visitors, so none was created.
62
+ * - `sales_channel_not_permitted` — the account's Organization may not use this store.
63
+ */
64
+ export const federatedSignInErrorCodeSchema = z.enum([
65
+ 'unknown_provider',
66
+ 'provider_unavailable',
67
+ 'sign_in_cancelled',
68
+ 'sign_in_expired',
69
+ 'sign_in_failed',
70
+ 'email_unverified',
71
+ 'no_matching_account',
72
+ 'account_blocked',
73
+ 'registration_disabled_in_channel',
74
+ 'mfa_setup_required',
75
+ 'sales_channel_sign_in_required',
76
+ 'sales_channel_not_permitted',
77
+ ]);
78
+ // ---------------------------------------------------------------------------
79
+ // Federated customer sign-in hand-off (issue #1279)
80
+ // ---------------------------------------------------------------------------
81
+ /**
82
+ * The storefront route the customer callback sends the browser to, on the sales
83
+ * channel's own storefront origin (`sales_channels.storefront_url`, else
84
+ * `STOREFRONT_BASE_URL`): `<origin>/auth/federated/complete?code=<code>`. Not
85
+ * language-prefixed. The storefront redeems the code server-to-server through
86
+ * `POST /api/v1/auth/customer/oauth/exchange` and sets its own cookies, so the
87
+ * sign-in works when the API is served from another host than the storefront.
88
+ */
89
+ export const FEDERATED_SIGN_IN_COMPLETE_PATH = '/auth/federated/complete';
90
+ /** Seconds a hand-off code can be redeemed for; it is single-use either way. */
91
+ export const FEDERATED_SIGN_IN_HANDOFF_TTL_SECONDS = 60;
92
+ /**
93
+ * `GET /api/v1/auth/customer/oauth/:provider/start` query. `binding` is the
94
+ * SHA-256 (lower-case hex) of the secret the storefront put in its own
95
+ * `b2b_federated_binding` cookie before redirecting here; the exchange is
96
+ * answered only for a caller presenting that secret, so a hand-off code cannot be
97
+ * redeemed from another browser (login CSRF, history replay). Required on the
98
+ * customer surface: a start without it is sent back to `/login?error=sign_in_failed`.
99
+ */
100
+ export const customerFederatedSignInStartQuerySchema = z.object({
101
+ next: z.string().max(2048).optional(),
102
+ salesChannel: z.string().optional(),
103
+ binding: z.string().regex(/^[0-9a-f]{64}$/),
104
+ });
105
+ /** 32 random bytes, base64url without padding. */
106
+ const handoffTokenSchema = z.string().regex(/^[A-Za-z0-9_-]{43}$/);
107
+ /**
108
+ * `POST /api/v1/auth/customer/oauth/exchange` body: the hand-off `code` from the
109
+ * landing URL and the raw `binding` secret from the storefront's cookie.
110
+ */
111
+ export const federatedSignInExchangeRequestSchema = z
112
+ .object({
113
+ code: handoffTokenSchema,
114
+ binding: handoffTokenSchema,
115
+ })
116
+ .strict();
117
+ /** A path on the storefront: starts with `/`, never `//`. Carries the language prefix. */
118
+ const storefrontRedirectPathSchema = z
119
+ .string()
120
+ .min(1)
121
+ .refine((path) => path.startsWith('/') && !path.startsWith('//'), {
122
+ message: 'Must be a root-relative path',
123
+ });
124
+ /**
125
+ * `POST /api/v1/auth/customer/oauth/exchange` answer — the same kinds of answer
126
+ * the password sign-in gives. `authenticated`: the session arrives as
127
+ * `Set-Cookie: b2b_session` (as from `POST /api/v1/auth/customer/login`) and
128
+ * `cartMerge` is the signed-out basket's merge. `mfaRequired`: the storefront
129
+ * keeps `challengeId` in its second-step cookie and sends the buyer to
130
+ * `redirectPath`, the code screen. A second factor still to be set up, and every
131
+ * refusal, never reaches the exchange: the callback sends those to
132
+ * `/login?error=<code>`. Every failure is `400 MFA_FEDERATED_HANDOFF_INVALID`.
133
+ */
134
+ export const federatedSignInExchangeResponseSchema = z.object({
135
+ data: z.discriminatedUnion('status', [
136
+ z.object({
137
+ status: z.literal('authenticated'),
138
+ redirectPath: storefrontRedirectPathSchema,
139
+ cartMerge: cartMergeOutcomePublicSchema.nullable(),
140
+ }),
141
+ z.object({
142
+ status: z.literal('mfaRequired'),
143
+ challengeId: z.string().min(1),
144
+ redirectPath: storefrontRedirectPathSchema,
145
+ }),
146
+ ]),
147
+ });
39
148
  // ---------------------------------------------------------------------------
40
149
  // Two-step login result (replaces the inline `twoFactorCode` shape)
41
150
  // ---------------------------------------------------------------------------
@@ -133,11 +242,23 @@ export const mfaSocialUnlinkResponseSchema = z.object({
133
242
  status: z.literal('unlinked'),
134
243
  provider: mfaSocialProviderSchema,
135
244
  });
245
+ /**
246
+ * Why the account may not switch its second factor off (issue #935).
247
+ *
248
+ * `factor_required` — it is the account's last second factor, and a
249
+ * requirement is in force for it: a setting, an administrator's role or a
250
+ * customer's organization. The same verdict refuses `POST …/mfa/disable` with
251
+ * `409 MFA_LAST_FACTOR_REQUIRED`.
252
+ */
253
+ export const mfaDisableBlockedReasonSchema = z.enum(['factor_required']);
136
254
  export const mfaStatusResponseSchema = z.object({
137
255
  totpActive: z.boolean(),
138
256
  recoveryCodesRemaining: z.number().int().nonnegative(),
139
257
  totpEnabledForScope: z.boolean(),
140
258
  totpEnforcedForScope: z.boolean(),
259
+ /** The surface renders the disable control from this, never from its own guess (issue #935). */
260
+ canDisable: z.boolean(),
261
+ disableBlockedReason: mfaDisableBlockedReasonSchema.nullable(),
141
262
  socialLinks: z.array(mfaSocialLinkSummarySchema),
142
263
  });
143
264
  // ---------------------------------------------------------------------------
@@ -165,6 +286,21 @@ export const mfaResetBulkResultSchema = z.object({
165
286
  // ---------------------------------------------------------------------------
166
287
  // Setting codes (single source for both manifest and resolver)
167
288
  // ---------------------------------------------------------------------------
289
+ /**
290
+ * Why a second-factor requirement cannot be met on this instance: `mfa` has no
291
+ * `MFA_SECRET_ENCRYPTION_KEY`, so it serves no enrolment route (issue #930).
292
+ * One spelling for every refusal and notice that says so — the
293
+ * `mfa.admin.totp_enforced` write, its Settings notice, and a role's
294
+ * two-factor flag — as `details.reason` and as the sentence token.
295
+ */
296
+ export const ENCRYPTION_KEY_MISSING = 'encryption_key_missing';
297
+ /**
298
+ * Issue #947 — sentence token for customer-side refusals; `details.reason`
299
+ * stays `ENCRYPTION_KEY_MISSING`. Carried as `details.code` by the refusal of
300
+ * `mfa.storefront.totp_enforced` and of an organization's policy, whose
301
+ * sentence names customers rather than administrators.
302
+ */
303
+ export const CUSTOMER_ENCRYPTION_KEY_MISSING = 'customer_encryption_key_missing';
168
304
  export const MFA_SETTING_CODES = {
169
305
  /**
170
306
  * Feature 074 — the operator-activation control (Constitution XVII). It sits
package/dist/modules.d.ts CHANGED
@@ -426,10 +426,10 @@ export type OmittedModule = z.infer<typeof OmittedModuleSchema>;
426
426
  * report's, so neither belongs here
427
427
  * (`specs/107-override-report-and-ladder/contracts/deployment-declaration.md` §5).
428
428
  *
429
- * Every field defaults to empty, so a declaration that leaves one out means
429
+ * Every field defaults to empty (or is optional), so a declaration that leaves one out means
430
430
  * "none of these" rather than "unparseable" — the reading an absent file already
431
431
  * gets. A deployment that diverges by nothing still ships the file with all
432
- * three written out, because the mechanism is easier to find than to remember.
432
+ * fields written out, because the mechanism is easier to find than to remember.
433
433
  */
434
434
  export declare const DeploymentDivergenceDeclarationSchema: z.ZodObject<{
435
435
  omittedModules: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -438,13 +438,14 @@ export declare const DeploymentDivergenceDeclarationSchema: z.ZodObject<{
438
438
  }, z.core.$strip>>>;
439
439
  decorationOrder: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
440
440
  reasons: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
441
+ commandHookOrder: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
441
442
  }, z.core.$strict>;
442
443
  export type DeploymentDivergenceDeclaration = z.infer<typeof DeploymentDivergenceDeclarationSchema>;
443
444
  /**
444
445
  * One kind of divergence a deployment's tree can hold
445
446
  * (`specs/107-override-report-and-ladder/data-model.md` §2.3).
446
447
  *
447
- * Nine, and every one of them is one seam of `ModuleContext` — seven read off
448
+ * Ten, and every one of them is one seam of `ModuleContext` — eight read off
448
449
  * the members themselves, plus `port-consumed` (which is `lazyPort` over the
449
450
  * cradle rather than a member) and `omission` (which comes from the declaration
450
451
  * and from no seam at all). `routes`, `ungatedRoutes`, `onBoot` and the manifest
@@ -453,7 +454,7 @@ export type DeploymentDivergenceDeclaration = z.infer<typeof DeploymentDivergenc
453
454
  * named in {@link DivergenceBoundary.notRecorded} so a reader can tell "not a
454
455
  * divergence" from "not looked at".
455
456
  */
456
- export type DivergenceKind = 'omission' | 'registration' | 'port-provided' | 'port-consumed' | 'subscription' | 'interceptor' | 'decoration' | 'root-plugin' | 'worker';
457
+ export type DivergenceKind = 'omission' | 'registration' | 'port-provided' | 'port-consumed' | 'subscription' | 'interceptor' | 'decoration' | 'root-plugin' | 'worker' | 'command-hook';
457
458
  /**
458
459
  * `<kind>:<module>:<subject>` — the three facts that identify a divergence
459
460
  * independently of where it is written.
@@ -502,6 +503,12 @@ export type DivergenceDetail = {
502
503
  } | {
503
504
  readonly kind: 'root-plugin';
504
505
  readonly declaredReason: string;
506
+ } | {
507
+ readonly kind: 'command-hook';
508
+ /** `beforeCommit` or `afterCommit`. */
509
+ readonly phase: 'beforeCommit' | 'afterCommit';
510
+ /** The hook's id, unique within its module. */
511
+ readonly id: string;
505
512
  } | {
506
513
  readonly kind: 'omission';
507
514
  };
@@ -664,6 +671,32 @@ export declare const ExclusiveCapabilitySchema: z.ZodObject<{
664
671
  errorCode: z.ZodString;
665
672
  }, z.core.$strip>;
666
673
  export type ExclusiveCapability = z.infer<typeof ExclusiveCapabilitySchema>;
674
+ /**
675
+ * The shape of an **organization permission** code (`specs/170-organization-roles/`,
676
+ * FR-020, research R-2): `<module>.<action>`, lower snake case, exactly one dot.
677
+ *
678
+ * The operator vocabulary is `<area>:<action>` (`permissions` below). Two
679
+ * shapes make a mix-up visible in review, and the permission inventory's
680
+ * `cross-vocabulary` finding makes it fail the build.
681
+ */
682
+ export declare const ORGANIZATION_PERMISSION_CODE: RegExp;
683
+ /**
684
+ * One organization permission a module declares — a buyer action its routes
685
+ * or services gate (`contracts/organization-permissions-manifest.md` §1).
686
+ *
687
+ * `label` and `description` are the English fallbacks; the translations live
688
+ * in the declaring module's own bundle under
689
+ * `organizationPermissions.<code>.label` and `.description`. `memberDefault`
690
+ * says whether an Organization's *Member* role holds the code from the moment
691
+ * it is first offered (FR-021, research R-17).
692
+ */
693
+ export declare const moduleOrganizationPermissionDeclarationSchema: z.ZodObject<{
694
+ code: z.ZodString;
695
+ label: z.ZodString;
696
+ description: z.ZodString;
697
+ memberDefault: z.ZodBoolean;
698
+ }, z.core.$strict>;
699
+ export type ModuleOrganizationPermissionDeclaration = z.infer<typeof moduleOrganizationPermissionDeclarationSchema>;
667
700
  export declare const ModuleManifestSchema: z.ZodObject<{
668
701
  id: z.ZodString;
669
702
  name: z.ZodString;
@@ -803,6 +836,7 @@ export declare const ModuleManifestSchema: z.ZodObject<{
803
836
  }>;
804
837
  targetRoute: z.ZodString;
805
838
  requiredPermission: z.ZodOptional<z.ZodString>;
839
+ entryApiRoute: z.ZodOptional<z.ZodString>;
806
840
  keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
807
841
  keywordsKey: z.ZodOptional<z.ZodString>;
808
842
  weight: z.ZodDefault<z.ZodNumber>;
@@ -814,6 +848,12 @@ export declare const ModuleManifestSchema: z.ZodObject<{
814
848
  description: z.ZodOptional<z.ZodString>;
815
849
  requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
816
850
  }, z.core.$strip>>>;
851
+ organizationPermissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
852
+ code: z.ZodString;
853
+ label: z.ZodString;
854
+ description: z.ZodString;
855
+ memberDefault: z.ZodBoolean;
856
+ }, z.core.$strict>>>;
817
857
  transactionalEmails: z.ZodOptional<z.ZodArray<z.ZodObject<{
818
858
  code: z.ZodString;
819
859
  name: z.ZodString;
@@ -842,8 +882,8 @@ export declare const ModuleManifestSchema: z.ZodObject<{
842
882
  descriptionKey: z.ZodOptional<z.ZodString>;
843
883
  category: z.ZodString;
844
884
  contexts: z.ZodArray<z.ZodEnum<{
845
- cms: "cms";
846
885
  email: "email";
886
+ cms: "cms";
847
887
  invoice: "invoice";
848
888
  newsletter: "newsletter";
849
889
  document: "document";
@@ -853,11 +893,11 @@ export declare const ModuleManifestSchema: z.ZodObject<{
853
893
  number: "number";
854
894
  object: "object";
855
895
  array: "array";
856
- uuid: "uuid";
857
896
  text: "text";
897
+ select: "select";
858
898
  external: "external";
899
+ uuid: "uuid";
859
900
  textarea: "textarea";
860
- select: "select";
861
901
  radio: "radio";
862
902
  richtext: "richtext";
863
903
  }>;
@@ -886,8 +926,8 @@ export declare const ModuleManifestSchema: z.ZodObject<{
886
926
  key: z.ZodString;
887
927
  titleKey: z.ZodString;
888
928
  contexts: z.ZodArray<z.ZodEnum<{
889
- cms: "cms";
890
929
  email: "email";
930
+ cms: "cms";
891
931
  invoice: "invoice";
892
932
  newsletter: "newsletter";
893
933
  document: "document";
@@ -940,6 +980,14 @@ export declare const ModuleManifestSchema: z.ZodObject<{
940
980
  storefront: "storefront";
941
981
  }>>;
942
982
  }, z.core.$strip>>>;
983
+ hookableActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
984
+ action: z.ZodString;
985
+ objectType: z.ZodString;
986
+ phases: z.ZodArray<z.ZodEnum<{
987
+ beforeCommit: "beforeCommit";
988
+ afterCommit: "afterCommit";
989
+ }>>;
990
+ }, z.core.$strict>>>;
943
991
  }, z.core.$strip>;
944
992
  export type ModuleManifest = z.infer<typeof ModuleManifestSchema>;
945
993
  /**