@endora-commerce/contracts 0.110.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 (347) hide show
  1. package/dist/accept-language.d.ts +31 -0
  2. package/dist/accept-language.js +64 -0
  3. package/dist/admin-actions.d.ts +2 -0
  4. package/dist/admin-actions.js +18 -0
  5. package/dist/admin-contributions.d.ts +37 -5
  6. package/dist/admin-contributions.js +9 -2
  7. package/dist/admin-roles.d.ts +9 -0
  8. package/dist/admin.d.ts +37 -0
  9. package/dist/admin.js +19 -0
  10. package/dist/api-keys.d.ts +22 -0
  11. package/dist/api-keys.js +4 -0
  12. package/dist/assets-library.d.ts +19 -0
  13. package/dist/assets-library.js +14 -0
  14. package/dist/auth.d.ts +9 -0
  15. package/dist/auth.js +9 -0
  16. package/dist/carts.d.ts +30 -1
  17. package/dist/carts.js +20 -5
  18. package/dist/catalog.d.ts +61 -22
  19. package/dist/catalog.js +32 -6
  20. package/dist/cms.d.ts +33 -3
  21. package/dist/cms.js +15 -0
  22. package/dist/command-hooks.d.ts +301 -0
  23. package/dist/command-hooks.js +248 -0
  24. package/dist/comparisons.d.ts +14 -14
  25. package/dist/credit-limits.d.ts +21 -0
  26. package/dist/credit-limits.js +21 -0
  27. package/dist/crm.d.ts +81 -55
  28. package/dist/crm.js +15 -5
  29. package/dist/custom-fields.d.ts +403 -49
  30. package/dist/custom-fields.js +127 -0
  31. package/dist/customer-accounts.d.ts +138 -0
  32. package/dist/customer-accounts.js +4 -0
  33. package/dist/customer-notifications.d.ts +143 -0
  34. package/dist/customer-notifications.js +41 -0
  35. package/dist/customers.d.ts +52 -0
  36. package/dist/customers.js +53 -0
  37. package/dist/dictionary.d.ts +53 -0
  38. package/dist/dictionary.js +25 -0
  39. package/dist/document-templates.d.ts +4 -4
  40. package/dist/email.d.ts +34 -0
  41. package/dist/email.js +6 -0
  42. package/dist/errors.d.ts +312 -2
  43. package/dist/errors.js +377 -2
  44. package/dist/forms.d.ts +88 -88
  45. package/dist/i18n.d.ts +34 -0
  46. package/dist/i18n.js +15 -0
  47. package/dist/index.d.ts +7 -1
  48. package/dist/index.js +12 -1
  49. package/dist/invoice-ledger.d.ts +6 -6
  50. package/dist/invoices.d.ts +126 -0
  51. package/dist/invoices.js +49 -0
  52. package/dist/line-bounds.d.ts +53 -0
  53. package/dist/line-bounds.js +65 -0
  54. package/dist/megamenu.d.ts +27 -27
  55. package/dist/mfa.d.ts +86 -0
  56. package/dist/mfa.js +90 -0
  57. package/dist/modules.d.ts +21 -5
  58. package/dist/modules.js +60 -3
  59. package/dist/orders.d.ts +141 -0
  60. package/dist/orders.js +80 -3
  61. package/dist/organization-hooks.d.ts +99 -0
  62. package/dist/organization-hooks.js +22 -0
  63. package/dist/organization-registry-lookup.d.ts +5 -5
  64. package/dist/organization-roles.d.ts +1 -0
  65. package/dist/organization-roles.js +7 -0
  66. package/dist/organizations.d.ts +954 -17
  67. package/dist/organizations.js +229 -8
  68. package/dist/price-books.d.ts +173 -25
  69. package/dist/price-books.js +41 -0
  70. package/dist/price-lists.d.ts +5 -2
  71. package/dist/product-feeds.d.ts +157 -8
  72. package/dist/product-feeds.js +41 -2
  73. package/dist/product-scopes.d.ts +17 -0
  74. package/dist/product-scopes.js +31 -5
  75. package/dist/projects.d.ts +61 -28
  76. package/dist/projects.js +47 -9
  77. package/dist/promotions.d.ts +157 -5
  78. package/dist/promotions.js +23 -1
  79. package/dist/pwa.d.ts +39 -0
  80. package/dist/quick-order.d.ts +9 -3
  81. package/dist/quick-order.js +4 -3
  82. package/dist/quote-requests.d.ts +168 -5
  83. package/dist/quote-requests.js +69 -8
  84. package/dist/record-references.d.ts +15 -15
  85. package/dist/returns.d.ts +6 -0
  86. package/dist/returns.js +4 -2
  87. package/dist/sales-channels.d.ts +34 -3
  88. package/dist/sales-channels.js +16 -1
  89. package/dist/schema-extensions.d.ts +36 -0
  90. package/dist/schema-extensions.js +29 -0
  91. package/dist/seo.d.ts +2 -2
  92. package/dist/settings.d.ts +44 -2
  93. package/dist/settings.js +17 -2
  94. package/dist/shopping-lists.d.ts +39 -1
  95. package/dist/shopping-lists.js +37 -3
  96. package/dist/storefront-cache-tags.d.ts +10 -0
  97. package/dist/tasks.d.ts +21 -21
  98. package/dist/taxes.d.ts +27 -0
  99. package/dist/taxes.js +4 -0
  100. package/dist/transactional-emails.d.ts +39 -13
  101. package/dist/webhooks.d.ts +75 -0
  102. package/dist/webhooks.js +24 -0
  103. package/package.json +4 -2
  104. package/dist/actor.d.ts.map +0 -1
  105. package/dist/actor.js.map +0 -1
  106. package/dist/addresses.d.ts.map +0 -1
  107. package/dist/addresses.js.map +0 -1
  108. package/dist/admin-actions.d.ts.map +0 -1
  109. package/dist/admin-actions.js.map +0 -1
  110. package/dist/admin-contributions.d.ts.map +0 -1
  111. package/dist/admin-contributions.js.map +0 -1
  112. package/dist/admin-feedback.d.ts.map +0 -1
  113. package/dist/admin-feedback.js.map +0 -1
  114. package/dist/admin-i18n.d.ts.map +0 -1
  115. package/dist/admin-i18n.js.map +0 -1
  116. package/dist/admin-name.d.ts.map +0 -1
  117. package/dist/admin-name.js.map +0 -1
  118. package/dist/admin-notifications.d.ts.map +0 -1
  119. package/dist/admin-notifications.js.map +0 -1
  120. package/dist/admin-preferences.d.ts.map +0 -1
  121. package/dist/admin-preferences.js.map +0 -1
  122. package/dist/admin-roles.d.ts.map +0 -1
  123. package/dist/admin-roles.js.map +0 -1
  124. package/dist/admin-search.d.ts.map +0 -1
  125. package/dist/admin-search.js.map +0 -1
  126. package/dist/admin-users.d.ts.map +0 -1
  127. package/dist/admin-users.js.map +0 -1
  128. package/dist/admin.d.ts.map +0 -1
  129. package/dist/admin.js.map +0 -1
  130. package/dist/analytics.d.ts.map +0 -1
  131. package/dist/analytics.js.map +0 -1
  132. package/dist/api-keys.d.ts.map +0 -1
  133. package/dist/api-keys.js.map +0 -1
  134. package/dist/assets-library.d.ts.map +0 -1
  135. package/dist/assets-library.js.map +0 -1
  136. package/dist/audit-logs.d.ts.map +0 -1
  137. package/dist/audit-logs.js.map +0 -1
  138. package/dist/auth.d.ts.map +0 -1
  139. package/dist/auth.js.map +0 -1
  140. package/dist/blog.d.ts.map +0 -1
  141. package/dist/blog.js.map +0 -1
  142. package/dist/capabilities.d.ts.map +0 -1
  143. package/dist/capabilities.js.map +0 -1
  144. package/dist/carts.d.ts.map +0 -1
  145. package/dist/carts.js.map +0 -1
  146. package/dist/catalog.d.ts.map +0 -1
  147. package/dist/catalog.js.map +0 -1
  148. package/dist/cms-brand.d.ts.map +0 -1
  149. package/dist/cms-brand.js.map +0 -1
  150. package/dist/cms-contact-form.d.ts.map +0 -1
  151. package/dist/cms-contact-form.js.map +0 -1
  152. package/dist/cms.d.ts.map +0 -1
  153. package/dist/cms.js.map +0 -1
  154. package/dist/common.d.ts.map +0 -1
  155. package/dist/common.js.map +0 -1
  156. package/dist/comparisons.d.ts.map +0 -1
  157. package/dist/comparisons.js.map +0 -1
  158. package/dist/credentials.d.ts.map +0 -1
  159. package/dist/credentials.js.map +0 -1
  160. package/dist/credit-limits.d.ts.map +0 -1
  161. package/dist/credit-limits.js.map +0 -1
  162. package/dist/crm-rich-text.d.ts.map +0 -1
  163. package/dist/crm-rich-text.js.map +0 -1
  164. package/dist/crm.d.ts.map +0 -1
  165. package/dist/crm.js.map +0 -1
  166. package/dist/currencies.d.ts.map +0 -1
  167. package/dist/currencies.js.map +0 -1
  168. package/dist/custom-fields.d.ts.map +0 -1
  169. package/dist/custom-fields.js.map +0 -1
  170. package/dist/customer-accounts.d.ts.map +0 -1
  171. package/dist/customer-accounts.js.map +0 -1
  172. package/dist/customers.d.ts.map +0 -1
  173. package/dist/customers.js.map +0 -1
  174. package/dist/dictionary.d.ts.map +0 -1
  175. package/dist/dictionary.js.map +0 -1
  176. package/dist/document-templates.d.ts.map +0 -1
  177. package/dist/document-templates.js.map +0 -1
  178. package/dist/document-values.d.ts.map +0 -1
  179. package/dist/document-values.js.map +0 -1
  180. package/dist/email-address.d.ts.map +0 -1
  181. package/dist/email-address.js.map +0 -1
  182. package/dist/email.d.ts.map +0 -1
  183. package/dist/email.js.map +0 -1
  184. package/dist/envelopes.d.ts.map +0 -1
  185. package/dist/envelopes.js.map +0 -1
  186. package/dist/environment-inputs.d.ts.map +0 -1
  187. package/dist/environment-inputs.js.map +0 -1
  188. package/dist/erp-connector.d.ts.map +0 -1
  189. package/dist/erp-connector.js.map +0 -1
  190. package/dist/errors.d.ts.map +0 -1
  191. package/dist/errors.js.map +0 -1
  192. package/dist/forms-logic.d.ts.map +0 -1
  193. package/dist/forms-logic.fixtures.d.ts.map +0 -1
  194. package/dist/forms-logic.fixtures.js.map +0 -1
  195. package/dist/forms-logic.js.map +0 -1
  196. package/dist/forms.d.ts.map +0 -1
  197. package/dist/forms.js.map +0 -1
  198. package/dist/google-analytics.d.ts.map +0 -1
  199. package/dist/google-analytics.js.map +0 -1
  200. package/dist/google-tag-manager.d.ts.map +0 -1
  201. package/dist/google-tag-manager.js.map +0 -1
  202. package/dist/i18n.d.ts.map +0 -1
  203. package/dist/i18n.js.map +0 -1
  204. package/dist/import-export.d.ts.map +0 -1
  205. package/dist/import-export.js.map +0 -1
  206. package/dist/index.d.ts.map +0 -1
  207. package/dist/index.js.map +0 -1
  208. package/dist/inventory.d.ts.map +0 -1
  209. package/dist/inventory.js.map +0 -1
  210. package/dist/invoice-ledger.d.ts.map +0 -1
  211. package/dist/invoice-ledger.js.map +0 -1
  212. package/dist/invoices.d.ts.map +0 -1
  213. package/dist/invoices.js.map +0 -1
  214. package/dist/kernel.d.ts.map +0 -1
  215. package/dist/kernel.js.map +0 -1
  216. package/dist/languages.d.ts.map +0 -1
  217. package/dist/languages.js.map +0 -1
  218. package/dist/line-groups.d.ts.map +0 -1
  219. package/dist/line-groups.js.map +0 -1
  220. package/dist/linkedin-ads.d.ts.map +0 -1
  221. package/dist/linkedin-ads.js.map +0 -1
  222. package/dist/localized-name.d.ts.map +0 -1
  223. package/dist/localized-name.js.map +0 -1
  224. package/dist/megamenu.d.ts.map +0 -1
  225. package/dist/megamenu.js.map +0 -1
  226. package/dist/meta-ads.d.ts.map +0 -1
  227. package/dist/meta-ads.js.map +0 -1
  228. package/dist/mfa.d.ts.map +0 -1
  229. package/dist/mfa.js.map +0 -1
  230. package/dist/modules.d.ts.map +0 -1
  231. package/dist/modules.js.map +0 -1
  232. package/dist/money-decimal.d.ts.map +0 -1
  233. package/dist/money-decimal.js.map +0 -1
  234. package/dist/money-input.d.ts.map +0 -1
  235. package/dist/money-input.js.map +0 -1
  236. package/dist/newsletter.d.ts.map +0 -1
  237. package/dist/newsletter.js.map +0 -1
  238. package/dist/order-minimums.d.ts.map +0 -1
  239. package/dist/order-minimums.js.map +0 -1
  240. package/dist/orders.d.ts.map +0 -1
  241. package/dist/orders.js.map +0 -1
  242. package/dist/organization-registry-lookup.d.ts.map +0 -1
  243. package/dist/organization-registry-lookup.js.map +0 -1
  244. package/dist/organization-roles.d.ts.map +0 -1
  245. package/dist/organization-roles.js.map +0 -1
  246. package/dist/organizations.d.ts.map +0 -1
  247. package/dist/organizations.js.map +0 -1
  248. package/dist/page-builder-props.d.ts.map +0 -1
  249. package/dist/page-builder-props.js.map +0 -1
  250. package/dist/page-builder-values.d.ts.map +0 -1
  251. package/dist/page-builder-values.js.map +0 -1
  252. package/dist/pagination.d.ts.map +0 -1
  253. package/dist/pagination.js.map +0 -1
  254. package/dist/payment-methods.d.ts.map +0 -1
  255. package/dist/payment-methods.js.map +0 -1
  256. package/dist/payment-return-url.d.ts.map +0 -1
  257. package/dist/payment-return-url.js.map +0 -1
  258. package/dist/payments.d.ts.map +0 -1
  259. package/dist/payments.js.map +0 -1
  260. package/dist/pim-connector.d.ts.map +0 -1
  261. package/dist/pim-connector.js.map +0 -1
  262. package/dist/pim-field-path.d.ts.map +0 -1
  263. package/dist/pim-field-path.js.map +0 -1
  264. package/dist/pim-locale-mapping.d.ts.map +0 -1
  265. package/dist/pim-locale-mapping.js.map +0 -1
  266. package/dist/platform-info.d.ts.map +0 -1
  267. package/dist/platform-info.js.map +0 -1
  268. package/dist/platform-language.d.ts.map +0 -1
  269. package/dist/platform-language.js.map +0 -1
  270. package/dist/price-book-decimal.d.ts.map +0 -1
  271. package/dist/price-book-decimal.js.map +0 -1
  272. package/dist/price-books.d.ts.map +0 -1
  273. package/dist/price-books.js.map +0 -1
  274. package/dist/price-lists.d.ts.map +0 -1
  275. package/dist/price-lists.js.map +0 -1
  276. package/dist/product-feeds.d.ts.map +0 -1
  277. package/dist/product-feeds.js.map +0 -1
  278. package/dist/product-scope-model.d.ts.map +0 -1
  279. package/dist/product-scope-model.js.map +0 -1
  280. package/dist/product-scope-overrides.d.ts.map +0 -1
  281. package/dist/product-scope-overrides.js.map +0 -1
  282. package/dist/product-scoped-values.d.ts.map +0 -1
  283. package/dist/product-scoped-values.js.map +0 -1
  284. package/dist/product-scopes.d.ts.map +0 -1
  285. package/dist/product-scopes.js.map +0 -1
  286. package/dist/product-summary-text.d.ts.map +0 -1
  287. package/dist/product-summary-text.js.map +0 -1
  288. package/dist/product-tax-rates.d.ts.map +0 -1
  289. package/dist/product-tax-rates.js.map +0 -1
  290. package/dist/product-url-keys.d.ts.map +0 -1
  291. package/dist/product-url-keys.js.map +0 -1
  292. package/dist/product-value-resolver.d.ts.map +0 -1
  293. package/dist/product-value-resolver.js.map +0 -1
  294. package/dist/projects.d.ts.map +0 -1
  295. package/dist/projects.js.map +0 -1
  296. package/dist/promotions.d.ts.map +0 -1
  297. package/dist/promotions.js.map +0 -1
  298. package/dist/prompt-actions.d.ts.map +0 -1
  299. package/dist/prompt-actions.js.map +0 -1
  300. package/dist/pwa.d.ts.map +0 -1
  301. package/dist/pwa.js.map +0 -1
  302. package/dist/quick-order.d.ts.map +0 -1
  303. package/dist/quick-order.js.map +0 -1
  304. package/dist/quote-requests.d.ts.map +0 -1
  305. package/dist/quote-requests.js.map +0 -1
  306. package/dist/record-references.d.ts.map +0 -1
  307. package/dist/record-references.js.map +0 -1
  308. package/dist/record-rich-text.d.ts.map +0 -1
  309. package/dist/record-rich-text.js.map +0 -1
  310. package/dist/returns.d.ts.map +0 -1
  311. package/dist/returns.js.map +0 -1
  312. package/dist/sales-channels.d.ts.map +0 -1
  313. package/dist/sales-channels.js.map +0 -1
  314. package/dist/saved-list-views.d.ts.map +0 -1
  315. package/dist/saved-list-views.js.map +0 -1
  316. package/dist/scope-notice.d.ts.map +0 -1
  317. package/dist/scope-notice.js.map +0 -1
  318. package/dist/scoped-write-encoding.d.ts.map +0 -1
  319. package/dist/scoped-write-encoding.js.map +0 -1
  320. package/dist/search.d.ts.map +0 -1
  321. package/dist/search.js.map +0 -1
  322. package/dist/seo.d.ts.map +0 -1
  323. package/dist/seo.js.map +0 -1
  324. package/dist/settings.d.ts.map +0 -1
  325. package/dist/settings.js.map +0 -1
  326. package/dist/shipments.d.ts.map +0 -1
  327. package/dist/shipments.js.map +0 -1
  328. package/dist/shipping-methods.d.ts.map +0 -1
  329. package/dist/shipping-methods.js.map +0 -1
  330. package/dist/shopping-lists.d.ts.map +0 -1
  331. package/dist/shopping-lists.js.map +0 -1
  332. package/dist/storefront-cache-tags.d.ts.map +0 -1
  333. package/dist/storefront-cache-tags.js.map +0 -1
  334. package/dist/storefront-language-path.d.ts.map +0 -1
  335. package/dist/storefront-language-path.js.map +0 -1
  336. package/dist/storefront-value-overrides.d.ts.map +0 -1
  337. package/dist/storefront-value-overrides.js.map +0 -1
  338. package/dist/tasks.d.ts.map +0 -1
  339. package/dist/tasks.js.map +0 -1
  340. package/dist/taxes.d.ts.map +0 -1
  341. package/dist/taxes.js.map +0 -1
  342. package/dist/text-normalization.d.ts.map +0 -1
  343. package/dist/text-normalization.js.map +0 -1
  344. package/dist/transactional-emails.d.ts.map +0 -1
  345. package/dist/transactional-emails.js.map +0 -1
  346. package/dist/webhooks.d.ts.map +0 -1
  347. package/dist/webhooks.js.map +0 -1
@@ -30,6 +30,41 @@ export const supportedEntityTypeSchema = z.enum([
30
30
  // while that module is present.
31
31
  'task',
32
32
  ]);
33
+ /**
34
+ * The one custom-field host binding registry (`specs/178-extensible-columns/`
35
+ * FR-010, research R-8).
36
+ *
37
+ * Moved here from `custom_fields`' module-internal storage binding so that two
38
+ * readers can share one answer: `custom_fields` reads it for the table and the
39
+ * value column its host probes and list filters build against, and the platform
40
+ * derives its extensible host list from it — every custom-field host table is
41
+ * extensible (OD-15), so a second list of them would be a second answer waiting
42
+ * to disagree. Purely a storage binding: no host logic lives here, and neither
43
+ * the table nor the column ever comes from a caller.
44
+ */
45
+ export const CUSTOM_FIELD_HOST_BINDINGS = {
46
+ category: { table: 'categories', valueColumn: 'custom_field_values', ownerModuleId: 'catalog' },
47
+ order: { table: 'orders', valueColumn: 'custom_field_values', ownerModuleId: 'orders' },
48
+ organization: {
49
+ table: 'organizations',
50
+ valueColumn: 'custom_field_values',
51
+ ownerModuleId: 'organizations',
52
+ },
53
+ customer: {
54
+ table: 'customer_accounts',
55
+ valueColumn: 'custom_field_values',
56
+ ownerModuleId: 'customer_accounts',
57
+ },
58
+ quote_request: {
59
+ table: 'quote_requests',
60
+ valueColumn: 'custom_field_values',
61
+ ownerModuleId: 'quote_requests',
62
+ },
63
+ product: { table: 'products', valueColumn: 'attribute_values', ownerModuleId: 'catalog' },
64
+ opportunity: { table: 'crm_opportunities', valueColumn: 'custom_field_values', ownerModuleId: 'crm' },
65
+ project: { table: 'projects', valueColumn: 'custom_field_values', ownerModuleId: 'projects' },
66
+ task: { table: 'tasks', valueColumn: 'custom_field_values', ownerModuleId: 'tasks' },
67
+ };
33
68
  /**
34
69
  * The set of runtime value types. `text` is stored as a string; `select` stores one option value; `multiselect` an array.
35
70
  *
@@ -62,6 +97,23 @@ export const customFieldValueTypeSchema = z.enum([
62
97
  * already being answered.
63
98
  */
64
99
  export const customFieldAudienceSchema = z.enum(['customer', 'internal']);
100
+ /**
101
+ * Feature 175 — the forms on which a BUYER may supply a custom-field value
102
+ * (`specs/175-buyer-input-custom-fields/`, OD-3). A closed vocabulary: the
103
+ * next surface is a release, not data an operator types. A definition names
104
+ * the surfaces it is open on (`customerInput`); an entity type's registry entry
105
+ * names the surfaces it offers at all.
106
+ */
107
+ export const customFieldInputSurfaceSchema = z.enum(['organization.register']);
108
+ /**
109
+ * Feature 175 — how the admin custom-field panel offers a field: `edit`
110
+ * (an input), `read` (the value, no input) or `hidden` (not rendered).
111
+ *
112
+ * **A panel convenience, not access control** (OD-8, FR-007): no API endpoint
113
+ * reads it, so what the admin API accepts, answers, filters, exports and
114
+ * audits is the same at every level. A `required` field is always `edit`.
115
+ */
116
+ export const customFieldAdminAccessSchema = z.enum(['edit', 'read', 'hidden']);
65
117
  export const localizedLabelSchema = z.record(z.string(), z.string());
66
118
  /** A select/multiselect option. `id` absent on create. */
67
119
  export const customFieldOptionSchema = z.object({
@@ -124,10 +176,27 @@ export const customFieldDefinitionSchema = z.object({
124
176
  listFilter: z.boolean(),
125
177
  /** See {@link customFieldCarryToSchema} (feature 162). */
126
178
  carryTo: customFieldCarryToSchema,
179
+ /**
180
+ * Feature 175 — the input surfaces a buyer may supply this field's value on
181
+ * ({@link customFieldInputSurfaceSchema}). Only surfaces the entity type
182
+ * offers ({@link customFieldEntityTypeInfoSchema}); non-empty only with the
183
+ * `customer` audience and never for `page_builder`. Stored deduplicated and
184
+ * sorted.
185
+ */
186
+ customerInput: z.array(customFieldInputSurfaceSchema),
187
+ /** Feature 175 — see {@link customFieldAdminAccessSchema}. */
188
+ adminAccess: customFieldAdminAccessSchema,
127
189
  options: z.array(customFieldOptionSchema).default([]),
128
190
  createdAt: isoDateTimeSchema,
129
191
  updatedAt: isoDateTimeSchema,
130
192
  });
193
+ /**
194
+ * `GET /api/v1/admin/custom-fields/definitions` — the definitions, optionally of
195
+ * one entity type, whose type's owner module is present (issue #599).
196
+ */
197
+ export const customFieldDefinitionListResponseSchema = z.object({
198
+ data: z.array(customFieldDefinitionSchema),
199
+ });
131
200
  /** Create a definition. `entityType` + `key` are immutable after create. */
132
201
  export const createCustomFieldDefinitionSchema = customFieldDefinitionSchema
133
202
  .omit({ id: true, createdAt: true, updatedAt: true })
@@ -136,10 +205,14 @@ export const createCustomFieldDefinitionSchema = customFieldDefinitionSchema
136
205
  // A definition created without `listFilter` is not a list filter; the
137
206
  // server reads the absence as `false` rather than the schema defaulting it.
138
207
  // A definition created without `carryTo` carries nothing (feature 162).
208
+ // Feature 175 — one created without `customerInput` is open on no surface,
209
+ // and one without `adminAccess` is editable in the admin panel.
139
210
  .extend({
140
211
  audience: customFieldAudienceSchema.default('internal'),
141
212
  listFilter: z.boolean().optional(),
142
213
  carryTo: customFieldCarryToSchema.default([]),
214
+ customerInput: z.array(customFieldInputSurfaceSchema).default([]),
215
+ adminAccess: customFieldAdminAccessSchema.default('edit'),
143
216
  });
144
217
  /** Patch a definition. `entityType` and `key` cannot change once records may hold values. */
145
218
  export const updateCustomFieldDefinitionSchema = createCustomFieldDefinitionSchema
@@ -155,6 +228,8 @@ export const updateCustomFieldDefinitionSchema = createCustomFieldDefinitionSche
155
228
  config: z.record(z.string(), z.unknown()).optional(),
156
229
  listFilter: z.boolean().optional(),
157
230
  carryTo: customFieldCarryToSchema.optional(),
231
+ customerInput: z.array(customFieldInputSurfaceSchema).optional(),
232
+ adminAccess: customFieldAdminAccessSchema.optional(),
158
233
  });
159
234
  /**
160
235
  * One supported host entity type as served by the admin entity-types listing
@@ -180,6 +255,16 @@ export const customFieldEntityTypeInfoSchema = z.object({
180
255
  * (feature 162), filtered to targets whose owner module is present.
181
256
  */
182
257
  carryTargets: z.array(supportedEntityTypeSchema).default([]),
258
+ /**
259
+ * Feature 175 — the input surfaces definitions of this type may be opened
260
+ * on; the definition editor offers the buyer-input option only when it is
261
+ * non-empty (FR-035).
262
+ */
263
+ customerInputSurfaces: z.array(customFieldInputSurfaceSchema).default([]),
264
+ });
265
+ /** `GET /api/v1/admin/custom-fields/entity-types` — the served entity types (issue #599). */
266
+ export const customFieldEntityTypeListResponseSchema = z.object({
267
+ data: z.array(customFieldEntityTypeInfoSchema),
183
268
  });
184
269
  /** A validated value bag keyed by definition `key`. Values are typed by their definition's `valueType`. */
185
270
  export const customFieldValuesSchema = z.record(z.string(), z.unknown());
@@ -192,6 +277,12 @@ export const customFieldValidationErrorSchema = z.object({
192
277
  'unknown_option',
193
278
  'out_of_range',
194
279
  'duplicate_option',
280
+ // Feature 175 — a buyer-supplied key that is not a live definition open on
281
+ // the surface (also every key when the value port is not composed).
282
+ 'not_open_for_input',
283
+ // Feature 175 — more than 50 keys in one buyer-supplied group; `field` is
284
+ // the group's name, not a key.
285
+ 'too_many_keys',
195
286
  ]),
196
287
  message: z.string(),
197
288
  });
@@ -335,6 +426,33 @@ export const customFieldListFilterFieldSchema = z
335
426
  options: z.array(z.object({ value: z.string(), label: localizedLabelSchema, labelDefault: z.string() })),
336
427
  })
337
428
  .strict();
429
+ /**
430
+ * Feature 175 — one field open on a buyer input surface, as the public read
431
+ * `GET /api/v1/custom-fields/input-surfaces/:surface` answers it
432
+ * (`specs/175-buyer-input-custom-fields/contracts/input-surface-read.md`).
433
+ * Labels are resolved in the request's language with `labelDefault` as the
434
+ * fallback. Never a stored value, the audience, the admin access level or
435
+ * `config`; never a `page_builder` field.
436
+ */
437
+ export const inputSurfaceFieldSchema = z.object({
438
+ key: z.string(),
439
+ valueType: customFieldValueTypeSchema.exclude(['page_builder']),
440
+ required: z.boolean(),
441
+ label: z.string(),
442
+ /** `[]` unless the field is `select` / `multiselect`. */
443
+ options: z.array(z.object({ value: z.string(), label: z.string() })),
444
+ sortOrder: z.number().int(),
445
+ });
446
+ /**
447
+ * The fields open on one surface, per entity type in display order. An
448
+ * unknown surface, or one no entity type declares, answers `entities: {}`.
449
+ */
450
+ export const inputSurfaceFieldsResponseSchema = z.object({
451
+ data: z.object({
452
+ surface: z.string(),
453
+ entities: z.partialRecord(supportedEntityTypeSchema, z.array(inputSurfaceFieldSchema)),
454
+ }),
455
+ });
338
456
  export const customFieldListFilterFieldsResponseSchema = z.object({
339
457
  data: z.array(customFieldListFilterFieldSchema),
340
458
  });
@@ -402,6 +520,15 @@ export const CUSTOM_FIELD_DEFINITION_ERROR_CODES = [
402
520
  'carry_incompatible',
403
521
  // Feature 172 — a value type the definition's entity type does not offer (`page_builder` off `product`).
404
522
  'value_type_unsupported',
523
+ // Feature 175 (research R-4) — the four refusals of the buyer-input and
524
+ // admin-access attributes, each judged on the RESULTING definition: a
525
+ // surface the entity type does not offer; an open field whose audience is
526
+ // not `customer`; an open `page_builder` field; a `required` field that is
527
+ // not `edit` in the admin.
528
+ 'customer_input_unsupported',
529
+ 'customer_input_audience',
530
+ 'customer_input_value_type',
531
+ 'admin_access_required',
405
532
  ];
406
533
  /**
407
534
  * Whether `error` is a refused definition write, narrowed by shape.
@@ -34,6 +34,18 @@ export declare const customerGroupSchema: z.ZodObject<{
34
34
  updatedAt: z.ZodString;
35
35
  }, z.core.$strip>;
36
36
  export type CustomerGroup = z.infer<typeof customerGroupSchema>;
37
+ /** `GET /api/v1/admin/customer-groups` — every group (issue #599). */
38
+ export declare const customerGroupListResponseSchema: z.ZodObject<{
39
+ data: z.ZodArray<z.ZodObject<{
40
+ id: z.ZodString;
41
+ code: z.ZodString;
42
+ name: z.ZodString;
43
+ description: z.ZodNullable<z.ZodString>;
44
+ createdAt: z.ZodString;
45
+ updatedAt: z.ZodString;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>;
48
+ export type CustomerGroupListResponse = z.infer<typeof customerGroupListResponseSchema>;
37
49
  export declare const upsertCustomerGroupRequestSchema: z.ZodObject<{
38
50
  code: z.ZodString;
39
51
  name: z.ZodString;
@@ -125,6 +137,25 @@ export interface CustomerAccountRecord {
125
137
  blockedByCustomerAccountId: string | null;
126
138
  deletionRequestedByAdminUserId: string | null;
127
139
  anonymizedAt: Date | null;
140
+ /**
141
+ * Issue #652 (D-292) — the language the account's owner reads: one BCP-47
142
+ * content-language tag, spelled as the sales channel that captured it spells
143
+ * it (`pl-PL`, `en-US`). Captured at account creation and, while still
144
+ * `null`, at sign-in, from the request's channel and its `Accept-Language`;
145
+ * overwritten only by the owner's own choice on the storefront account page.
146
+ *
147
+ * A message composed outside a request resolves it against the channel it
148
+ * is rendered for — `scopeLanguageOf(renderChannel, preferredLanguage)`:
149
+ * the exact language, else one of the same base language, else that
150
+ * channel's default — so a value the channel no longer offers falls back
151
+ * rather than failing. Inside a request the `Accept-Language` header still
152
+ * decides the response language (D-131).
153
+ *
154
+ * `null` means unknown: the account predates the field and has not signed in
155
+ * since, or was created by an operator. Personal data (D-288 list 2): never
156
+ * written into an audit state, cleared by the anonymisation sweep.
157
+ */
158
+ preferredLanguage: string | null;
128
159
  }
129
160
  /**
130
161
  * Which accounts a lookup should consider. Soft-deleted accounts still resolve
@@ -238,6 +269,19 @@ export interface CustomerAccountCreateInput {
238
269
  * the admin direct-create do not.
239
270
  */
240
271
  emailVerified?: boolean;
272
+ /**
273
+ * Feature 175 — the account's custom-field values, ALREADY VALIDATED by the
274
+ * caller through custom_fields' value port (the caller owns the surface and
275
+ * must validate before its first write). Stored as given; `{}` when absent.
276
+ */
277
+ customFieldValues?: Record<string, unknown>;
278
+ /**
279
+ * Issue #652 (D-292) — the language captured from the creating request:
280
+ * `requestScopeLanguage(requestChannel, Accept-Language)`, so a
281
+ * tag the channel spells. Absent or `null` stores `null` — the admin
282
+ * direct-create, which has no buyer request to read it from.
283
+ */
284
+ preferredLanguage?: string | null;
241
285
  }
242
286
  /** Absent fields are left unchanged. */
243
287
  export interface CustomerAccountProfilePatch {
@@ -250,6 +294,37 @@ export interface CustomerAccountProfilePatch {
250
294
  firstName?: string;
251
295
  lastName?: string;
252
296
  }
297
+ /** Where a preferred-language write comes from (issue #652, D-292). */
298
+ export type CustomerPreferredLanguageSource = 'self_service' | 'sign_in';
299
+ /**
300
+ * Container name: `customerAccountPreferencePort`. Owner: `customer_accounts`.
301
+ *
302
+ * Issue #652 (D-292) — the account's preferred language, the customer twin of
303
+ * `AdminUserPreferencePort`. Two methods, because there are two writers:
304
+ *
305
+ * - `setPreferredLanguage` — the owner's explicit choice on the storefront
306
+ * account page (`customers`' `PATCH /api/v1/me/customer/preferred-language`),
307
+ * the only write that overwrites a stored value. The caller has already
308
+ * checked the tag against the request channel's languages and passes it in
309
+ * that channel's spelling; this port stores it as given. Throws HTTP 404
310
+ * `NOT_FOUND` for an id no live account has.
311
+ * - `captureIfUnset` — a sign-in's capture (federated sign-in through `mfa`):
312
+ * writes only while the account has no value, and does nothing at all —
313
+ * no write, no audit entry — when it already has one or the id is unknown.
314
+ *
315
+ * Both run `customer_account.set_preferred_language` on the Command Bus. Its
316
+ * audit entry names the field and the source and never the tag (D-288 list 2):
317
+ * `{ changedFields: ['preferredLanguage'], source }`.
318
+ *
319
+ * **Owner off:** the seam fails closed — resolving this port throws
320
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`. Whether
321
+ * `customer_accounts` has an off state at all is its manifest's `activation` to
322
+ * say, not this line's: a module declaring `nonDeactivatable` never enters one.
323
+ */
324
+ export interface CustomerAccountPreferencePort {
325
+ setPreferredLanguage(customerAccountId: string, preferredLanguage: string): Promise<CustomerAccountRecord>;
326
+ captureIfUnset(customerAccountId: string, preferredLanguage: string): Promise<void>;
327
+ }
253
328
  /**
254
329
  * Container name: `customerAccountMemberWritePort`. Owner: `customer_accounts`.
255
330
  *
@@ -345,6 +420,14 @@ export interface CustomerLoginInput extends CustomerAuthenticationOrigin {
345
420
  ip?: string;
346
421
  userAgent?: string;
347
422
  salesChannelId?: string | null;
423
+ /**
424
+ * Issue #652 (D-292) — the sign-in request's language, already resolved
425
+ * against its channel (`scopeLanguageOf`). Stored on the account only while
426
+ * the account has none, and only once the password, the block and the
427
+ * channel access have been accepted; a refused sign-in stores nothing.
428
+ * Absent or `null` stores nothing.
429
+ */
430
+ language?: string | null;
348
431
  }
349
432
  /** Where a customer's attempt came from, as far as the caller knows. */
350
433
  export interface CustomerAuthenticationOrigin {
@@ -666,6 +749,59 @@ export interface CustomerAccountRoleCommandPort {
666
749
  changeRole(input: CustomerAccountRoleChangeInput): CustomerAccountRoleChangeCommand;
667
750
  holdersOf(organizationId: string, roleId: string): Promise<string[]>;
668
751
  }
752
+ /**
753
+ * `customer_account.create` as the platform's Command Bus runs it, named
754
+ * structurally for the reason {@link CustomerAccountRoleChangeCommand} is: the
755
+ * platform's `Command<CustomerAccountRecord>` is assignable to it and it to
756
+ * that, so a caller hands it to `commandBus.run` or, as a child, to `ctx.run`
757
+ * unchanged. Its `run` belongs to the bus.
758
+ */
759
+ export interface CustomerAccountCreateCommand {
760
+ readonly action: string;
761
+ readonly objectType: string;
762
+ readonly objectId: string;
763
+ run(ctx: never): Promise<{
764
+ readonly result: CustomerAccountRecord;
765
+ }>;
766
+ }
767
+ /**
768
+ * What {@link CustomerAccountMemberCommandPort.prepareCreate} takes: an account's
769
+ * creation input without the two ids a caller may only know inside its own
770
+ * transaction — a registration learns its Organization's *Administrator* role
771
+ * id from the row the Organization's insert wrote.
772
+ */
773
+ export type CustomerAccountCreatePreparation = Omit<CustomerAccountCreateInput, 'organizationId' | 'organizationRoleId'>;
774
+ /** A prepared account creation: the password is hashed, the Command not yet built. */
775
+ export interface PreparedCustomerAccountCreate {
776
+ /** The `customer_account.create` Command for that Organization and role. */
777
+ command(target: {
778
+ organizationId: string;
779
+ organizationRoleId: string;
780
+ }): CustomerAccountCreateCommand;
781
+ }
782
+ /**
783
+ * Container name: `customerAccountMemberCommandPort`. Owner: `customer_accounts`.
784
+ *
785
+ * The account creation as a **Command factory** (`specs/176-command-hooks-outbox/`
786
+ * FR-002, FR-005, `contracts/registration-command.md`): `organizations` creates
787
+ * a registration's first account as a **child** of `organization.register`
788
+ * through `ctx.run`, so the Organization and its administrator commit together
789
+ * or not at all, each with its own audit entry. No `EntityManager` crosses.
790
+ *
791
+ * `prepareCreate` hashes the password **now**, outside any transaction — the
792
+ * hash's cost is deliberate and must never run while a transaction holds the
793
+ * caller's rows — and the Command it later builds only writes. The Command
794
+ * refuses `409 EMAIL_ALREADY_REGISTERED` from its pre-check and from the unique
795
+ * index, inside its run.
796
+ *
797
+ * {@link CustomerAccountMemberWritePort.create} runs this same Command,
798
+ * top-level, so the creation has one implementation (FR-004).
799
+ *
800
+ * **Owner off:** the seam fails closed, as {@link CustomerAccountRoleCommandPort} does.
801
+ */
802
+ export interface CustomerAccountMemberCommandPort {
803
+ prepareCreate(input: CustomerAccountCreatePreparation): Promise<PreparedCustomerAccountCreate>;
804
+ }
669
805
  /**
670
806
  * A standalone (org-less) self-registration, as `customers` asks for one.
671
807
  *
@@ -687,6 +823,8 @@ export interface CustomerAccountStandaloneCreateInput {
687
823
  password: string;
688
824
  firstName: string;
689
825
  lastName: string;
826
+ /** Issue #652 — as {@link CustomerAccountCreateInput.preferredLanguage}. */
827
+ preferredLanguage?: string | null;
690
828
  }
691
829
  /**
692
830
  * The request the write was made from, stamped onto its audit row.
@@ -50,6 +50,10 @@ export const customerGroupSchema = z.object({
50
50
  createdAt: isoDateTimeSchema,
51
51
  updatedAt: isoDateTimeSchema,
52
52
  });
53
+ /** `GET /api/v1/admin/customer-groups` — every group (issue #599). */
54
+ export const customerGroupListResponseSchema = z.object({
55
+ data: z.array(customerGroupSchema),
56
+ });
53
57
  export const upsertCustomerGroupRequestSchema = z.object({
54
58
  code: z.string().min(1).max(64),
55
59
  name: z.string().min(1).max(160),
@@ -0,0 +1,143 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `customer_notifications` module contracts — the buyer's notification centre on
4
+ * the storefront (`specs/179-rfq-and-customer-notifications/`).
5
+ *
6
+ * Two halves:
7
+ * (1) the in-process port producers record entries through
8
+ * (`contracts/delivery-and-ports.md` §1) — plain TypeScript, as in
9
+ * `admin-notifications.ts`, because it describes an in-process call;
10
+ * (2) the storefront API shapes (`contracts/customer-notifications-storefront-api.md` §2)
11
+ * — Zod schemas, the source of truth for the HTTP boundary (Principle II).
12
+ */
13
+ /**
14
+ * A translatable sentence: the bundle (`scope`, a module id), the key in it and
15
+ * the `{name}` placeholders' values — strings and numbers only, drawn as text.
16
+ * The same shape as `AdminNotificationMessage`, deliberately (research R-13):
17
+ * an entry is translated when it is read, in the reader's language, and the
18
+ * English sentence stored beside it is shown when the key does not resolve.
19
+ */
20
+ export interface CustomerNotificationMessage {
21
+ scope: string;
22
+ key: string;
23
+ params?: Record<string, string | number>;
24
+ }
25
+ export interface RecordCustomerNotificationInput {
26
+ organizationId: string;
27
+ customerAccountId: string;
28
+ /** The channel the entry concerns; `null` = shown on every channel. */
29
+ salesChannelId: string | null;
30
+ /** The producing module's id; the list hides entries whose producer is absent. */
31
+ sourceModule: string;
32
+ /** Unique per `sourceModule`; a second record with the same key is refused (see the port). */
33
+ sourceKey: string;
34
+ /** E.g. `quote_requests.approved`; consumers branch on it, never on the sentence. */
35
+ kind: string;
36
+ subjectType?: string | null;
37
+ subjectId?: string | null;
38
+ /** The finished English sentence — always, also beside `titleMessage`. */
39
+ title: string;
40
+ titleMessage: CustomerNotificationMessage;
41
+ body?: string | null;
42
+ /** `body`, translatable. Rejected without a `body` to fall back to. */
43
+ bodyMessage?: CustomerNotificationMessage | null;
44
+ /** Storefront-relative: starts with one `/`, no scheme, no `//` (FR-047). */
45
+ linkPath?: string | null;
46
+ }
47
+ /** What was recorded, for a caller that wants to correlate its own log. */
48
+ export interface CustomerNotificationRecord {
49
+ id: string;
50
+ createdAt: Date;
51
+ }
52
+ /**
53
+ * Container name: `customerNotificationRecordPort`. Owner: `customer_notifications`
54
+ * (`specs/179-rfq-and-customer-notifications/`).
55
+ *
56
+ * Owner off: the gate fails closed (`ModuleDisabledError`). Callers decide
57
+ * presence in front of it (`effectiveState.isPresent('customer_notifications')`)
58
+ * and never catch the refusal (D-60).
59
+ *
60
+ * `recordWithin` persists into the caller's unit of work, with no fork and no
61
+ * flush, and commits or rolls back with it — the admin bell's `recordWithin`
62
+ * semantics. It validates before persisting and throws a plain `Error` on
63
+ * invalid input (link, params, body/bodyMessage pairing): a programming error,
64
+ * not a delivery outcome.
65
+ *
66
+ * Idempotency: `(sourceModule, sourceKey)` is unique in the database.
67
+ * `recordWithin` relies on the caller's own idempotency (`quote_requests`
68
+ * closes its delivery record in the same transaction, so a second call for the
69
+ * same record cannot happen); `record` answers the existing entry when the key
70
+ * is already present.
71
+ *
72
+ * `EM` is the caller's MikroORM `EntityManager`, a type parameter because this
73
+ * package holds no `@mikro-orm` import (the `AdminNotificationRecordPort`
74
+ * precedent). A consumer writes `CustomerNotificationRecordPort<EntityManager>`.
75
+ */
76
+ export interface CustomerNotificationRecordPort<EM = unknown> {
77
+ record(input: RecordCustomerNotificationInput): Promise<CustomerNotificationRecord>;
78
+ recordWithin(em: EM, input: RecordCustomerNotificationInput): CustomerNotificationRecord;
79
+ }
80
+ /** One entry as the signed-in buyer reads it. */
81
+ export declare const customerNotificationSchema: z.ZodObject<{
82
+ id: z.ZodString;
83
+ kind: z.ZodString;
84
+ title: z.ZodString;
85
+ body: z.ZodNullable<z.ZodString>;
86
+ subject: z.ZodNullable<z.ZodObject<{
87
+ type: z.ZodString;
88
+ id: z.ZodString;
89
+ }, z.core.$strip>>;
90
+ linkPath: z.ZodNullable<z.ZodString>;
91
+ createdAt: z.ZodString;
92
+ readAt: z.ZodNullable<z.ZodString>;
93
+ }, z.core.$strict>;
94
+ export type CustomerNotification = z.infer<typeof customerNotificationSchema>;
95
+ /** `GET /api/v1/storefront/notifications` — newest first, keyset-paged. */
96
+ export declare const customerNotificationListResponseSchema: z.ZodObject<{
97
+ data: z.ZodObject<{
98
+ items: z.ZodArray<z.ZodObject<{
99
+ id: z.ZodString;
100
+ kind: z.ZodString;
101
+ title: z.ZodString;
102
+ body: z.ZodNullable<z.ZodString>;
103
+ subject: z.ZodNullable<z.ZodObject<{
104
+ type: z.ZodString;
105
+ id: z.ZodString;
106
+ }, z.core.$strip>>;
107
+ linkPath: z.ZodNullable<z.ZodString>;
108
+ createdAt: z.ZodString;
109
+ readAt: z.ZodNullable<z.ZodString>;
110
+ }, z.core.$strict>>;
111
+ nextCursor: z.ZodNullable<z.ZodString>;
112
+ unreadCount: z.ZodNumber;
113
+ }, z.core.$strip>;
114
+ }, z.core.$strip>;
115
+ export type CustomerNotificationListResponse = z.infer<typeof customerNotificationListResponseSchema>;
116
+ /**
117
+ * `GET /api/v1/storefront/notifications/:id` — one entry, under the same three
118
+ * visibility predicates as the list; read-only, it marks nothing.
119
+ */
120
+ export declare const customerNotificationResponseSchema: z.ZodObject<{
121
+ data: z.ZodObject<{
122
+ id: z.ZodString;
123
+ kind: z.ZodString;
124
+ title: z.ZodString;
125
+ body: z.ZodNullable<z.ZodString>;
126
+ subject: z.ZodNullable<z.ZodObject<{
127
+ type: z.ZodString;
128
+ id: z.ZodString;
129
+ }, z.core.$strip>>;
130
+ linkPath: z.ZodNullable<z.ZodString>;
131
+ createdAt: z.ZodString;
132
+ readAt: z.ZodNullable<z.ZodString>;
133
+ }, z.core.$strict>;
134
+ }, z.core.$strip>;
135
+ export type CustomerNotificationResponse = z.infer<typeof customerNotificationResponseSchema>;
136
+ /** `GET /api/v1/storefront/notifications/unread-count`. */
137
+ export declare const customerNotificationUnreadCountResponseSchema: z.ZodObject<{
138
+ data: z.ZodObject<{
139
+ unreadCount: z.ZodNumber;
140
+ }, z.core.$strip>;
141
+ }, z.core.$strip>;
142
+ export type CustomerNotificationUnreadCountResponse = z.infer<typeof customerNotificationUnreadCountResponseSchema>;
143
+ //# sourceMappingURL=customer-notifications.d.ts.map
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { isoDateTimeSchema, uuidSchema } from './common.js';
3
+ // ---------------------------------------------------------------------------
4
+ // (2) Storefront API — `/api/v1/storefront/notifications*`
5
+ // ---------------------------------------------------------------------------
6
+ /** One entry as the signed-in buyer reads it. */
7
+ export const customerNotificationSchema = z
8
+ .object({
9
+ id: uuidSchema,
10
+ kind: z.string(),
11
+ /** Rendered in the request's language; the stored English sentence when the key does not resolve. */
12
+ title: z.string(),
13
+ body: z.string().nullable(),
14
+ subject: z.object({ type: z.string(), id: uuidSchema }).nullable(),
15
+ /** Storefront-relative, without locale prefix; the storefront localises it. */
16
+ linkPath: z.string().nullable(),
17
+ createdAt: isoDateTimeSchema,
18
+ readAt: isoDateTimeSchema.nullable(),
19
+ })
20
+ .strict();
21
+ /** `GET /api/v1/storefront/notifications` — newest first, keyset-paged. */
22
+ export const customerNotificationListResponseSchema = z.object({
23
+ data: z.object({
24
+ items: z.array(customerNotificationSchema),
25
+ /** Opaque keyset cursor over `(created_at desc, id desc)`, base64url; `null` on the last page. */
26
+ nextCursor: z.string().nullable(),
27
+ unreadCount: z.number().int().nonnegative(),
28
+ }),
29
+ });
30
+ /**
31
+ * `GET /api/v1/storefront/notifications/:id` — one entry, under the same three
32
+ * visibility predicates as the list; read-only, it marks nothing.
33
+ */
34
+ export const customerNotificationResponseSchema = z.object({
35
+ data: customerNotificationSchema,
36
+ });
37
+ /** `GET /api/v1/storefront/notifications/unread-count`. */
38
+ export const customerNotificationUnreadCountResponseSchema = z.object({
39
+ data: z.object({ unreadCount: z.number().int().nonnegative() }),
40
+ });
41
+ //# sourceMappingURL=customer-notifications.js.map
@@ -156,6 +156,7 @@ export declare const customerSelfProfileSchema: z.ZodObject<{
156
156
  organizationId: z.ZodNullable<z.ZodString>;
157
157
  customerGroupId: z.ZodNullable<z.ZodString>;
158
158
  twoFactorEnabled: z.ZodBoolean;
159
+ preferredLanguage: z.ZodNullable<z.ZodString>;
159
160
  organizationRole: z.ZodObject<{
160
161
  id: z.ZodString;
161
162
  name: z.ZodString;
@@ -168,6 +169,29 @@ export declare const customerSelfProfileSchema: z.ZodObject<{
168
169
  permissions: z.ZodArray<z.ZodString>;
169
170
  }, z.core.$strip>;
170
171
  export type CustomerSelfProfile = z.infer<typeof customerSelfProfileSchema>;
172
+ /**
173
+ * The longest language tag a preferred language may be — RFC 5646 §4.4.1's
174
+ * recommended minimum buffer, and the width of `customer_accounts.preferred_language`.
175
+ */
176
+ export declare const CUSTOMER_PREFERRED_LANGUAGE_MAX_LENGTH = 35;
177
+ /**
178
+ * `PATCH /api/v1/me/customer/preferred-language` — the buyer's explicit choice
179
+ * of the language their e-mails are written in (issue #652, D-292). Not
180
+ * nullable: the account page always submits a language. A tag the request's
181
+ * sales channel does not offer is refused `422 PREFERRED_LANGUAGE_NOT_OFFERED`;
182
+ * an offered one is stored in the channel's spelling, matched
183
+ * case-insensitively.
184
+ */
185
+ export declare const patchCustomerPreferredLanguageBodySchema: z.ZodObject<{
186
+ preferredLanguage: z.ZodString;
187
+ }, z.core.$strip>;
188
+ export type PatchCustomerPreferredLanguageBody = z.infer<typeof patchCustomerPreferredLanguageBodySchema>;
189
+ export declare const patchCustomerPreferredLanguageResponseSchema: z.ZodObject<{
190
+ data: z.ZodObject<{
191
+ preferredLanguage: z.ZodString;
192
+ }, z.core.$strip>;
193
+ }, z.core.$strip>;
194
+ export type PatchCustomerPreferredLanguageResponse = z.infer<typeof patchCustomerPreferredLanguageResponseSchema>;
171
195
  export declare const adminCustomerListItemSchema: z.ZodObject<{
172
196
  id: z.ZodString;
173
197
  email: z.ZodString;
@@ -183,6 +207,33 @@ export declare const adminCustomerListItemSchema: z.ZodObject<{
183
207
  lastLoginAt: z.ZodNullable<z.ZodString>;
184
208
  }, z.core.$strip>;
185
209
  export type AdminCustomerListItem = z.infer<typeof adminCustomerListItemSchema>;
210
+ /**
211
+ * `GET /api/v1/admin/customers` — one page of the admin list (issue #599).
212
+ * Offset paging: `page` is 1-based, `pageSize` 1–100, `total` the rows the
213
+ * filters match across every page.
214
+ */
215
+ export declare const adminCustomerListResponseSchema: z.ZodObject<{
216
+ data: z.ZodArray<z.ZodObject<{
217
+ id: z.ZodString;
218
+ email: z.ZodString;
219
+ firstName: z.ZodString;
220
+ lastName: z.ZodString;
221
+ organizationId: z.ZodNullable<z.ZodString>;
222
+ organizationName: z.ZodNullable<z.ZodString>;
223
+ customerGroupId: z.ZodNullable<z.ZodString>;
224
+ customerGroupName: z.ZodNullable<z.ZodString>;
225
+ blocked: z.ZodBoolean;
226
+ deleted: z.ZodBoolean;
227
+ createdAt: z.ZodString;
228
+ lastLoginAt: z.ZodNullable<z.ZodString>;
229
+ }, z.core.$strip>>;
230
+ meta: z.ZodObject<{
231
+ page: z.ZodNumber;
232
+ pageSize: z.ZodNumber;
233
+ total: z.ZodNumber;
234
+ }, z.core.$strip>;
235
+ }, z.core.$strip>;
236
+ export type AdminCustomerListResponse = z.infer<typeof adminCustomerListResponseSchema>;
186
237
  export declare const adminCustomerBlockInfoSchema: z.ZodObject<{
187
238
  blockedAt: z.ZodString;
188
239
  blockSource: z.ZodEnum<{
@@ -230,6 +281,7 @@ export declare const adminCustomerDetailSchema: z.ZodObject<{
230
281
  }, z.core.$strip>>;
231
282
  emailVerifiedAt: z.ZodNullable<z.ZodString>;
232
283
  twoFactorEnabled: z.ZodBoolean;
284
+ preferredLanguage: z.ZodNullable<z.ZodString>;
233
285
  salesChannelIds: z.ZodArray<z.ZodString>;
234
286
  defaults: z.ZodObject<{
235
287
  paymentMethodId: z.ZodNullable<z.ZodString>;