@endora-commerce/contracts 0.107.0 → 0.109.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 (273) hide show
  1. package/dist/admin-actions.d.ts +12 -3
  2. package/dist/admin-actions.d.ts.map +1 -1
  3. package/dist/admin-actions.js +34 -3
  4. package/dist/admin-actions.js.map +1 -1
  5. package/dist/admin-contributions.d.ts +35 -6
  6. package/dist/admin-contributions.d.ts.map +1 -1
  7. package/dist/admin-contributions.js +46 -0
  8. package/dist/admin-contributions.js.map +1 -1
  9. package/dist/admin-feedback.d.ts +61 -0
  10. package/dist/admin-feedback.d.ts.map +1 -0
  11. package/dist/admin-feedback.js +71 -0
  12. package/dist/admin-feedback.js.map +1 -0
  13. package/dist/admin-name.d.ts +21 -0
  14. package/dist/admin-name.d.ts.map +1 -0
  15. package/dist/admin-name.js +30 -0
  16. package/dist/admin-name.js.map +1 -0
  17. package/dist/admin-notifications.d.ts +17 -1
  18. package/dist/admin-notifications.d.ts.map +1 -1
  19. package/dist/admin-preferences.d.ts +108 -0
  20. package/dist/admin-preferences.d.ts.map +1 -0
  21. package/dist/admin-preferences.js +133 -0
  22. package/dist/admin-preferences.js.map +1 -0
  23. package/dist/admin.d.ts +15 -1
  24. package/dist/admin.d.ts.map +1 -1
  25. package/dist/admin.js +7 -0
  26. package/dist/admin.js.map +1 -1
  27. package/dist/assets-library.d.ts +97 -3
  28. package/dist/assets-library.d.ts.map +1 -1
  29. package/dist/assets-library.js +5 -0
  30. package/dist/assets-library.js.map +1 -1
  31. package/dist/blog.d.ts +57 -0
  32. package/dist/blog.d.ts.map +1 -1
  33. package/dist/blog.js +63 -1
  34. package/dist/blog.js.map +1 -1
  35. package/dist/carts.d.ts +303 -50
  36. package/dist/carts.d.ts.map +1 -1
  37. package/dist/carts.js +95 -13
  38. package/dist/carts.js.map +1 -1
  39. package/dist/catalog.d.ts +512 -40
  40. package/dist/catalog.d.ts.map +1 -1
  41. package/dist/catalog.js +362 -23
  42. package/dist/catalog.js.map +1 -1
  43. package/dist/cms-brand.d.ts +2233 -0
  44. package/dist/cms-brand.d.ts.map +1 -0
  45. package/dist/cms-brand.js +311 -0
  46. package/dist/cms-brand.js.map +1 -0
  47. package/dist/cms-contact-form.d.ts +55 -0
  48. package/dist/cms-contact-form.d.ts.map +1 -0
  49. package/dist/cms-contact-form.js +100 -0
  50. package/dist/cms-contact-form.js.map +1 -0
  51. package/dist/cms.d.ts +537 -3
  52. package/dist/cms.d.ts.map +1 -1
  53. package/dist/cms.js +251 -0
  54. package/dist/cms.js.map +1 -1
  55. package/dist/common.d.ts +4 -0
  56. package/dist/common.d.ts.map +1 -1
  57. package/dist/common.js +14 -0
  58. package/dist/common.js.map +1 -1
  59. package/dist/comparisons.d.ts +7 -0
  60. package/dist/comparisons.d.ts.map +1 -1
  61. package/dist/comparisons.js +2 -0
  62. package/dist/comparisons.js.map +1 -1
  63. package/dist/credit-limits.d.ts.map +1 -1
  64. package/dist/credit-limits.js +3 -2
  65. package/dist/credit-limits.js.map +1 -1
  66. package/dist/crm-rich-text.d.ts +13 -0
  67. package/dist/crm-rich-text.d.ts.map +1 -0
  68. package/dist/crm-rich-text.js +13 -0
  69. package/dist/crm-rich-text.js.map +1 -0
  70. package/dist/crm.d.ts +180 -62
  71. package/dist/crm.d.ts.map +1 -1
  72. package/dist/crm.js +63 -107
  73. package/dist/crm.js.map +1 -1
  74. package/dist/custom-fields.d.ts +436 -5
  75. package/dist/custom-fields.d.ts.map +1 -1
  76. package/dist/custom-fields.js +325 -10
  77. package/dist/custom-fields.js.map +1 -1
  78. package/dist/customer-accounts.d.ts +30 -0
  79. package/dist/customer-accounts.d.ts.map +1 -1
  80. package/dist/customer-accounts.js +31 -0
  81. package/dist/customer-accounts.js.map +1 -1
  82. package/dist/document-templates.d.ts +211 -23
  83. package/dist/document-templates.d.ts.map +1 -1
  84. package/dist/document-templates.js +98 -1
  85. package/dist/document-templates.js.map +1 -1
  86. package/dist/document-values.d.ts +12 -1
  87. package/dist/document-values.d.ts.map +1 -1
  88. package/dist/document-values.js +41 -11
  89. package/dist/document-values.js.map +1 -1
  90. package/dist/email.d.ts +5 -0
  91. package/dist/email.d.ts.map +1 -1
  92. package/dist/errors.d.ts +142 -8
  93. package/dist/errors.d.ts.map +1 -1
  94. package/dist/errors.js +189 -8
  95. package/dist/errors.js.map +1 -1
  96. package/dist/index.d.ts +24 -1
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +43 -1
  99. package/dist/index.js.map +1 -1
  100. package/dist/inventory.d.ts +3 -3
  101. package/dist/invoices.d.ts +6 -2
  102. package/dist/invoices.d.ts.map +1 -1
  103. package/dist/invoices.js +10 -4
  104. package/dist/invoices.js.map +1 -1
  105. package/dist/line-groups.d.ts +80 -0
  106. package/dist/line-groups.d.ts.map +1 -0
  107. package/dist/line-groups.js +130 -0
  108. package/dist/line-groups.js.map +1 -0
  109. package/dist/localized-name.d.ts +20 -0
  110. package/dist/localized-name.d.ts.map +1 -0
  111. package/dist/localized-name.js +45 -0
  112. package/dist/localized-name.js.map +1 -0
  113. package/dist/megamenu.d.ts +674 -0
  114. package/dist/megamenu.d.ts.map +1 -1
  115. package/dist/megamenu.js +96 -3
  116. package/dist/megamenu.js.map +1 -1
  117. package/dist/mfa.d.ts +1 -0
  118. package/dist/mfa.d.ts.map +1 -1
  119. package/dist/mfa.js +8 -2
  120. package/dist/mfa.js.map +1 -1
  121. package/dist/modules.d.ts +8 -1
  122. package/dist/modules.d.ts.map +1 -1
  123. package/dist/modules.js +5 -0
  124. package/dist/modules.js.map +1 -1
  125. package/dist/money-decimal.d.ts +162 -0
  126. package/dist/money-decimal.d.ts.map +1 -0
  127. package/dist/money-decimal.js +365 -0
  128. package/dist/money-decimal.js.map +1 -0
  129. package/dist/money-input.d.ts +64 -0
  130. package/dist/money-input.d.ts.map +1 -0
  131. package/dist/money-input.js +111 -0
  132. package/dist/money-input.js.map +1 -0
  133. package/dist/newsletter.d.ts +3 -3
  134. package/dist/order-minimums.d.ts +111 -0
  135. package/dist/order-minimums.d.ts.map +1 -0
  136. package/dist/order-minimums.js +196 -0
  137. package/dist/order-minimums.js.map +1 -0
  138. package/dist/orders.d.ts +206 -2
  139. package/dist/orders.d.ts.map +1 -1
  140. package/dist/orders.js +106 -5
  141. package/dist/orders.js.map +1 -1
  142. package/dist/page-builder-props.d.ts +1401 -0
  143. package/dist/page-builder-props.d.ts.map +1 -0
  144. package/dist/page-builder-props.js +266 -0
  145. package/dist/page-builder-props.js.map +1 -0
  146. package/dist/page-builder-values.d.ts +95 -0
  147. package/dist/page-builder-values.d.ts.map +1 -0
  148. package/dist/page-builder-values.js +164 -0
  149. package/dist/page-builder-values.js.map +1 -0
  150. package/dist/payment-methods.d.ts.map +1 -1
  151. package/dist/payment-methods.js +2 -1
  152. package/dist/payment-methods.js.map +1 -1
  153. package/dist/pim-connector.d.ts +1 -1
  154. package/dist/platform-language.d.ts +9 -0
  155. package/dist/platform-language.d.ts.map +1 -1
  156. package/dist/platform-language.js +14 -0
  157. package/dist/platform-language.js.map +1 -1
  158. package/dist/price-book-decimal.d.ts +84 -0
  159. package/dist/price-book-decimal.d.ts.map +1 -0
  160. package/dist/price-book-decimal.js +175 -0
  161. package/dist/price-book-decimal.js.map +1 -0
  162. package/dist/price-books.d.ts +2206 -0
  163. package/dist/price-books.d.ts.map +1 -0
  164. package/dist/price-books.js +777 -0
  165. package/dist/price-books.js.map +1 -0
  166. package/dist/price-lists.d.ts +309 -614
  167. package/dist/price-lists.d.ts.map +1 -1
  168. package/dist/price-lists.js +113 -453
  169. package/dist/price-lists.js.map +1 -1
  170. package/dist/product-feeds.d.ts +195 -54
  171. package/dist/product-feeds.d.ts.map +1 -1
  172. package/dist/product-feeds.js +36 -1
  173. package/dist/product-feeds.js.map +1 -1
  174. package/dist/product-scopes.d.ts +628 -0
  175. package/dist/product-scopes.d.ts.map +1 -0
  176. package/dist/product-scopes.js +365 -0
  177. package/dist/product-scopes.js.map +1 -0
  178. package/dist/product-summary-text.d.ts +23 -0
  179. package/dist/product-summary-text.d.ts.map +1 -0
  180. package/dist/product-summary-text.js +64 -0
  181. package/dist/product-summary-text.js.map +1 -0
  182. package/dist/product-url-keys.d.ts +204 -0
  183. package/dist/product-url-keys.d.ts.map +1 -0
  184. package/dist/product-url-keys.js +166 -0
  185. package/dist/product-url-keys.js.map +1 -0
  186. package/dist/product-value-resolver.d.ts +6 -0
  187. package/dist/product-value-resolver.d.ts.map +1 -1
  188. package/dist/product-value-resolver.js +6 -1
  189. package/dist/product-value-resolver.js.map +1 -1
  190. package/dist/projects.d.ts +2355 -0
  191. package/dist/projects.d.ts.map +1 -0
  192. package/dist/projects.js +837 -0
  193. package/dist/projects.js.map +1 -0
  194. package/dist/promotions.d.ts +2 -2
  195. package/dist/promotions.d.ts.map +1 -1
  196. package/dist/promotions.js +8 -2
  197. package/dist/promotions.js.map +1 -1
  198. package/dist/prompt-actions.d.ts +19 -1
  199. package/dist/prompt-actions.d.ts.map +1 -1
  200. package/dist/prompt-actions.js +31 -2
  201. package/dist/prompt-actions.js.map +1 -1
  202. package/dist/quick-order.d.ts +39 -1
  203. package/dist/quick-order.d.ts.map +1 -1
  204. package/dist/quick-order.js +44 -1
  205. package/dist/quick-order.js.map +1 -1
  206. package/dist/quote-requests.d.ts +305 -1
  207. package/dist/quote-requests.d.ts.map +1 -1
  208. package/dist/quote-requests.js +173 -5
  209. package/dist/quote-requests.js.map +1 -1
  210. package/dist/record-references.d.ts +252 -0
  211. package/dist/record-references.d.ts.map +1 -0
  212. package/dist/record-references.js +179 -0
  213. package/dist/record-references.js.map +1 -0
  214. package/dist/record-rich-text.d.ts +66 -0
  215. package/dist/record-rich-text.d.ts.map +1 -0
  216. package/dist/record-rich-text.js +303 -0
  217. package/dist/record-rich-text.js.map +1 -0
  218. package/dist/returns.d.ts +81 -2
  219. package/dist/returns.d.ts.map +1 -1
  220. package/dist/returns.js +39 -4
  221. package/dist/returns.js.map +1 -1
  222. package/dist/sales-channels.d.ts +53 -7
  223. package/dist/sales-channels.d.ts.map +1 -1
  224. package/dist/sales-channels.js +40 -4
  225. package/dist/sales-channels.js.map +1 -1
  226. package/dist/saved-list-views.d.ts +28 -0
  227. package/dist/saved-list-views.d.ts.map +1 -1
  228. package/dist/saved-list-views.js +14 -1
  229. package/dist/saved-list-views.js.map +1 -1
  230. package/dist/scoped-translations.d.ts +48 -0
  231. package/dist/scoped-translations.d.ts.map +1 -0
  232. package/dist/scoped-translations.js +78 -0
  233. package/dist/scoped-translations.js.map +1 -0
  234. package/dist/search.d.ts +73 -5
  235. package/dist/search.d.ts.map +1 -1
  236. package/dist/search.js +4 -0
  237. package/dist/search.js.map +1 -1
  238. package/dist/seo.d.ts +64 -5
  239. package/dist/seo.d.ts.map +1 -1
  240. package/dist/seo.js +31 -4
  241. package/dist/seo.js.map +1 -1
  242. package/dist/settings.d.ts +32 -3
  243. package/dist/settings.d.ts.map +1 -1
  244. package/dist/settings.js +37 -3
  245. package/dist/settings.js.map +1 -1
  246. package/dist/shipping-methods.d.ts.map +1 -1
  247. package/dist/shipping-methods.js +2 -1
  248. package/dist/shipping-methods.js.map +1 -1
  249. package/dist/shopping-lists.d.ts +24 -0
  250. package/dist/shopping-lists.d.ts.map +1 -1
  251. package/dist/shopping-lists.js +20 -1
  252. package/dist/shopping-lists.js.map +1 -1
  253. package/dist/storefront-cache-tags.d.ts +29 -0
  254. package/dist/storefront-cache-tags.d.ts.map +1 -1
  255. package/dist/storefront-cache-tags.js +24 -0
  256. package/dist/storefront-cache-tags.js.map +1 -1
  257. package/dist/storefront-language-path.d.ts +77 -0
  258. package/dist/storefront-language-path.d.ts.map +1 -0
  259. package/dist/storefront-language-path.js +123 -0
  260. package/dist/storefront-language-path.js.map +1 -0
  261. package/dist/storefront-value-overrides.d.ts +67 -0
  262. package/dist/storefront-value-overrides.d.ts.map +1 -0
  263. package/dist/storefront-value-overrides.js +93 -0
  264. package/dist/storefront-value-overrides.js.map +1 -0
  265. package/dist/tasks.d.ts +2842 -0
  266. package/dist/tasks.d.ts.map +1 -0
  267. package/dist/tasks.js +901 -0
  268. package/dist/tasks.js.map +1 -0
  269. package/dist/transactional-emails.d.ts +7 -4
  270. package/dist/transactional-emails.d.ts.map +1 -1
  271. package/dist/transactional-emails.js +13 -0
  272. package/dist/transactional-emails.js.map +1 -1
  273. package/package.json +2 -2
@@ -1,494 +1,70 @@
1
1
  import { z } from 'zod';
2
- export declare const ruleCriterionTypeSchema: z.ZodEnum<{
3
- currency: "currency";
4
- category: "category";
5
- organization: "organization";
6
- salesChannel: "salesChannel";
7
- customerGroup: "customerGroup";
8
- }>;
9
- export type RuleCriterionType = z.infer<typeof ruleCriterionTypeSchema>;
10
- export type RuleAllNode = {
11
- kind: 'all';
12
- };
13
- export type RuleCriterionNode = {
14
- kind: 'criterion';
15
- type: RuleCriterionType;
16
- values: string[];
17
- };
18
- export type RuleGroupNode = {
19
- kind: 'group';
20
- op: 'AND' | 'OR';
21
- children: ApplicationRule[];
22
- };
23
- export type ApplicationRule = RuleAllNode | RuleCriterionNode | RuleGroupNode;
24
- export declare const applicationRuleSchema: z.ZodType<ApplicationRule, unknown, z.core.$ZodTypeInternals<ApplicationRule, unknown>>;
25
- export declare const priceListTypeSchema: z.ZodEnum<{
26
- base: "base";
27
- sale: "sale";
28
- }>;
29
- export type PriceListType = z.infer<typeof priceListTypeSchema>;
30
- export declare const priceListStatusSchema: z.ZodEnum<{
31
- expired: "expired";
32
- draft: "draft";
33
- active: "active";
34
- scheduled: "scheduled";
35
- }>;
36
- export type PriceListStatus = z.infer<typeof priceListStatusSchema>;
37
- export declare const priceListEngineSchema: z.ZodObject<{
38
- id: z.ZodString;
39
- name: z.ZodString;
40
- type: z.ZodEnum<{
41
- base: "base";
42
- sale: "sale";
43
- }>;
44
- status: z.ZodEnum<{
45
- expired: "expired";
46
- draft: "draft";
47
- active: "active";
48
- scheduled: "scheduled";
49
- }>;
50
- startsAt: z.ZodNullable<z.ZodString>;
51
- endsAt: z.ZodNullable<z.ZodString>;
52
- applicationRule: z.ZodType<ApplicationRule, unknown, z.core.$ZodTypeInternals<ApplicationRule, unknown>>;
53
- isSystem: z.ZodBoolean;
54
- modifiedAt: z.ZodString;
55
- createdAt: z.ZodString;
56
- }, z.core.$strip>;
57
- export type PriceListEngine = z.infer<typeof priceListEngineSchema>;
58
- export declare const createPriceListEngineRequestSchema: z.ZodObject<{
59
- name: z.ZodString;
60
- type: z.ZodEnum<{
61
- base: "base";
62
- sale: "sale";
63
- }>;
64
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
- applicationRule: z.ZodOptional<z.ZodType<ApplicationRule, unknown, z.core.$ZodTypeInternals<ApplicationRule, unknown>>>;
67
- }, z.core.$strip>;
68
- export declare const patchPriceListEngineRequestSchema: z.ZodObject<{
69
- name: z.ZodOptional<z.ZodString>;
70
- type: z.ZodOptional<z.ZodEnum<{
71
- base: "base";
72
- sale: "sale";
73
- }>>;
74
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
- applicationRule: z.ZodOptional<z.ZodType<ApplicationRule, unknown, z.core.$ZodTypeInternals<ApplicationRule, unknown>>>;
77
- }, z.core.$strip>;
78
- export declare const priceListBracketSchema: z.ZodObject<{
79
- priceListId: z.ZodString;
80
- productId: z.ZodString;
81
- currencyCode: z.ZodString;
82
- minQuantity: z.ZodNumber;
83
- maxQuantity: z.ZodNullable<z.ZodNumber>;
84
- amount: z.ZodString;
85
- }, z.core.$strip>;
86
- export type PriceListBracket = z.infer<typeof priceListBracketSchema>;
87
- export declare const replaceBracketsRequestSchema: z.ZodObject<{
88
- bracketsByCurrency: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
89
- minQuantity: z.ZodNumber;
90
- maxQuantity: z.ZodNullable<z.ZodNumber>;
91
- amount: z.ZodString;
92
- }, z.core.$strip>>>;
93
- }, z.core.$strip>;
94
- export declare const productAssignmentSchema: z.ZodObject<{
95
- priceListId: z.ZodString;
96
- productId: z.ZodString;
97
- bracketsByCurrency: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
98
- priceListId: z.ZodString;
99
- productId: z.ZodString;
100
- currencyCode: z.ZodString;
101
- minQuantity: z.ZodNumber;
102
- maxQuantity: z.ZodNullable<z.ZodNumber>;
103
- amount: z.ZodString;
104
- }, z.core.$strip>>>;
105
- }, z.core.$strip>;
106
- export type ProductAssignment = z.infer<typeof productAssignmentSchema>;
107
- export declare const replaceProductsRequestSchema: z.ZodObject<{
108
- productIds: z.ZodArray<z.ZodString>;
109
- }, z.core.$strip>;
110
- /** At most this many entries per price list (spec FR-007) — a product decision. */
111
- export declare const PRICE_MATRIX_MAX_ENTRIES_PER_LIST = 5000;
112
- export declare const priceMatrixPriceTypeSchema: z.ZodEnum<{
113
- fixed: "fixed";
114
- discount_percent: "discount_percent";
115
- }>;
116
- export type PriceMatrixPriceType = z.infer<typeof priceMatrixPriceTypeSchema>;
117
- /** Derived from which selection coordinates are set; never stored. */
118
- export declare const priceMatrixSelectionKindSchema: z.ZodEnum<{
119
- all: "all";
120
- category: "category";
121
- product: "product";
122
- attribute: "attribute";
123
- category_attribute: "category_attribute";
124
- }>;
125
- export type PriceMatrixSelectionKind = z.infer<typeof priceMatrixSelectionKindSchema>;
126
- export declare const priceMatrixAttributeSchema: z.ZodObject<{
127
- key: z.ZodString;
128
- value: z.ZodString;
129
- }, z.core.$strip>;
130
- export type PriceMatrixAttribute = z.infer<typeof priceMatrixAttributeSchema>;
131
- export declare const priceMatrixPriceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
132
- type: z.ZodLiteral<"fixed">;
133
- amount: z.ZodString;
134
- currencyCode: z.ZodString;
135
- }, z.core.$strip>, z.ZodObject<{
136
- type: z.ZodLiteral<"discount_percent">;
137
- percent: z.ZodString;
138
- }, z.core.$strip>], "type">;
139
- export type PriceMatrixPrice = z.infer<typeof priceMatrixPriceSchema>;
140
- /** The coordinates of an entry, after defaults — what the shape rules read. */
141
- export interface PriceMatrixEntryShape {
142
- productId: string | null;
143
- categoryId: string | null;
144
- attribute: PriceMatrixAttribute | null;
145
- organizationId: string | null;
146
- minQuantity: number;
147
- maxQuantity: number | null;
148
- price: PriceMatrixPrice;
149
- }
150
- /** `selectionKind` of an entry, from which selection coordinates are set. */
151
- export declare function priceMatrixSelectionKind(entry: {
152
- productId: string | null;
153
- categoryId: string | null;
154
- attribute: {
155
- key: string;
156
- value: string;
157
- } | null;
158
- }): PriceMatrixSelectionKind;
159
- /**
160
- * The cross-field rules of an entry — the CHECK constraints of
161
- * `price_list_matrix_entries` that a single field cannot express (data-model
162
- * §1). One function so the create schema and the service's merge-then-validate
163
- * of a PATCH apply exactly the same rules.
164
- */
165
- export declare function priceMatrixEntryShapeIssues(entry: PriceMatrixEntryShape): Array<{
166
- path: Array<string>;
167
- message: string;
168
- }>;
169
- /** Body of `POST /api/v1/admin/price-lists-engine/:id/matrix`. */
170
- export declare const priceMatrixEntryInputSchema: z.ZodObject<{
171
- productId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
172
- categoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
173
- attribute: z.ZodDefault<z.ZodNullable<z.ZodObject<{
174
- key: z.ZodString;
175
- value: z.ZodString;
176
- }, z.core.$strip>>>;
177
- organizationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
178
- minQuantity: z.ZodNumber;
179
- maxQuantity: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
180
- price: z.ZodDiscriminatedUnion<[z.ZodObject<{
181
- type: z.ZodLiteral<"fixed">;
182
- amount: z.ZodString;
183
- currencyCode: z.ZodString;
184
- }, z.core.$strip>, z.ZodObject<{
185
- type: z.ZodLiteral<"discount_percent">;
186
- percent: z.ZodString;
187
- }, z.core.$strip>], "type">;
188
- }, z.core.$strip>;
189
- export type PriceMatrixEntryInput = z.infer<typeof priceMatrixEntryInputSchema>;
190
- /**
191
- * Body of `PATCH …/matrix/:entryId` — every field optional, at least one
192
- * present. The cross-field rules run on the merged entry in the service.
193
- */
194
- export declare const priceMatrixEntryPatchSchema: z.ZodObject<{
195
- productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
- categoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
- attribute: z.ZodOptional<z.ZodNullable<z.ZodObject<{
198
- key: z.ZodString;
199
- value: z.ZodString;
200
- }, z.core.$strip>>>;
201
- organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
202
- minQuantity: z.ZodOptional<z.ZodNumber>;
203
- maxQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
204
- price: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
205
- type: z.ZodLiteral<"fixed">;
206
- amount: z.ZodString;
207
- currencyCode: z.ZodString;
208
- }, z.core.$strip>, z.ZodObject<{
209
- type: z.ZodLiteral<"discount_percent">;
210
- percent: z.ZodString;
211
- }, z.core.$strip>], "type">>;
212
- }, z.core.$strip>;
213
- export type PriceMatrixEntryPatch = z.infer<typeof priceMatrixEntryPatchSchema>;
214
- /** Query of `GET …/matrix`. `organizationId = 'none'` lists not organization-specific entries. */
215
- export declare const priceMatrixListQuerySchema: z.ZodObject<{
216
- page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
217
- pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
218
- selectionKind: z.ZodOptional<z.ZodEnum<{
219
- all: "all";
220
- category: "category";
221
- product: "product";
222
- attribute: "attribute";
223
- category_attribute: "category_attribute";
224
- }>>;
225
- organizationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"none">]>>;
226
- productId: z.ZodOptional<z.ZodString>;
227
- categoryId: z.ZodOptional<z.ZodString>;
228
- }, z.core.$strip>;
229
- export type PriceMatrixListQuery = z.infer<typeof priceMatrixListQuerySchema>;
230
- /** Why an attribute entry does not price anything right now (spec FR-010). */
231
- export declare const priceMatrixInactiveReasonSchema: z.ZodEnum<{
232
- attribute_not_flagged: "attribute_not_flagged";
233
- attribute_not_found: "attribute_not_found";
234
- attribute_language_scoped: "attribute_language_scoped";
235
- attribute_channel_scoped: "attribute_channel_scoped";
236
- attribute_value_type: "attribute_value_type";
237
- }>;
238
- export type PriceMatrixInactiveReason = z.infer<typeof priceMatrixInactiveReasonSchema>;
239
- export declare const priceMatrixEntrySchema: z.ZodObject<{
240
- id: z.ZodString;
241
- priceListId: z.ZodString;
242
- selectionKind: z.ZodEnum<{
243
- all: "all";
244
- category: "category";
245
- product: "product";
246
- attribute: "attribute";
247
- category_attribute: "category_attribute";
248
- }>;
249
- productId: z.ZodNullable<z.ZodString>;
250
- categoryId: z.ZodNullable<z.ZodString>;
251
- attribute: z.ZodNullable<z.ZodObject<{
252
- key: z.ZodString;
253
- value: z.ZodString;
254
- }, z.core.$strip>>;
255
- organizationId: z.ZodNullable<z.ZodString>;
256
- minQuantity: z.ZodNumber;
257
- maxQuantity: z.ZodNullable<z.ZodNumber>;
258
- price: z.ZodDiscriminatedUnion<[z.ZodObject<{
259
- type: z.ZodLiteral<"fixed">;
260
- amount: z.ZodString;
261
- currencyCode: z.ZodString;
262
- }, z.core.$strip>, z.ZodObject<{
263
- type: z.ZodLiteral<"discount_percent">;
264
- percent: z.ZodString;
265
- }, z.core.$strip>], "type">;
266
- active: z.ZodBoolean;
267
- inactiveReason: z.ZodNullable<z.ZodEnum<{
268
- attribute_not_flagged: "attribute_not_flagged";
269
- attribute_not_found: "attribute_not_found";
270
- attribute_language_scoped: "attribute_language_scoped";
271
- attribute_channel_scoped: "attribute_channel_scoped";
272
- attribute_value_type: "attribute_value_type";
273
- }>>;
274
- targetDeleted: z.ZodBoolean;
275
- labels: z.ZodObject<{
276
- product: z.ZodNullable<z.ZodObject<{
277
- sku: z.ZodString;
278
- name: z.ZodString;
279
- }, z.core.$strip>>;
280
- category: z.ZodNullable<z.ZodString>;
281
- attribute: z.ZodNullable<z.ZodObject<{
282
- label: z.ZodString;
283
- valueLabel: z.ZodString;
284
- }, z.core.$strip>>;
285
- organization: z.ZodNullable<z.ZodString>;
286
- }, z.core.$strip>;
287
- createdAt: z.ZodString;
288
- updatedAt: z.ZodString;
289
- }, z.core.$strip>;
290
- export type PriceMatrixEntry = z.infer<typeof priceMatrixEntrySchema>;
291
- export declare const priceMatrixListResponseSchema: z.ZodObject<{
292
- data: z.ZodObject<{
293
- items: z.ZodArray<z.ZodObject<{
294
- id: z.ZodString;
295
- priceListId: z.ZodString;
296
- selectionKind: z.ZodEnum<{
297
- all: "all";
298
- category: "category";
299
- product: "product";
300
- attribute: "attribute";
301
- category_attribute: "category_attribute";
302
- }>;
303
- productId: z.ZodNullable<z.ZodString>;
304
- categoryId: z.ZodNullable<z.ZodString>;
305
- attribute: z.ZodNullable<z.ZodObject<{
306
- key: z.ZodString;
307
- value: z.ZodString;
308
- }, z.core.$strip>>;
309
- organizationId: z.ZodNullable<z.ZodString>;
310
- minQuantity: z.ZodNumber;
311
- maxQuantity: z.ZodNullable<z.ZodNumber>;
312
- price: z.ZodDiscriminatedUnion<[z.ZodObject<{
313
- type: z.ZodLiteral<"fixed">;
314
- amount: z.ZodString;
315
- currencyCode: z.ZodString;
316
- }, z.core.$strip>, z.ZodObject<{
317
- type: z.ZodLiteral<"discount_percent">;
318
- percent: z.ZodString;
319
- }, z.core.$strip>], "type">;
320
- active: z.ZodBoolean;
321
- inactiveReason: z.ZodNullable<z.ZodEnum<{
322
- attribute_not_flagged: "attribute_not_flagged";
323
- attribute_not_found: "attribute_not_found";
324
- attribute_language_scoped: "attribute_language_scoped";
325
- attribute_channel_scoped: "attribute_channel_scoped";
326
- attribute_value_type: "attribute_value_type";
327
- }>>;
328
- targetDeleted: z.ZodBoolean;
329
- labels: z.ZodObject<{
330
- product: z.ZodNullable<z.ZodObject<{
331
- sku: z.ZodString;
332
- name: z.ZodString;
333
- }, z.core.$strip>>;
334
- category: z.ZodNullable<z.ZodString>;
335
- attribute: z.ZodNullable<z.ZodObject<{
336
- label: z.ZodString;
337
- valueLabel: z.ZodString;
338
- }, z.core.$strip>>;
339
- organization: z.ZodNullable<z.ZodString>;
340
- }, z.core.$strip>;
341
- createdAt: z.ZodString;
342
- updatedAt: z.ZodString;
343
- }, z.core.$strip>>;
344
- total: z.ZodNumber;
345
- page: z.ZodNumber;
346
- pageSize: z.ZodNumber;
347
- limit: z.ZodNumber;
348
- }, z.core.$strip>;
349
- }, z.core.$strip>;
350
- export type PriceMatrixListResponse = z.infer<typeof priceMatrixListResponseSchema>;
351
- export declare const priceMatrixEntryResponseSchema: z.ZodObject<{
352
- data: z.ZodObject<{
353
- id: z.ZodString;
354
- priceListId: z.ZodString;
355
- selectionKind: z.ZodEnum<{
356
- all: "all";
357
- category: "category";
358
- product: "product";
359
- attribute: "attribute";
360
- category_attribute: "category_attribute";
361
- }>;
362
- productId: z.ZodNullable<z.ZodString>;
363
- categoryId: z.ZodNullable<z.ZodString>;
364
- attribute: z.ZodNullable<z.ZodObject<{
365
- key: z.ZodString;
366
- value: z.ZodString;
367
- }, z.core.$strip>>;
368
- organizationId: z.ZodNullable<z.ZodString>;
369
- minQuantity: z.ZodNumber;
370
- maxQuantity: z.ZodNullable<z.ZodNumber>;
371
- price: z.ZodDiscriminatedUnion<[z.ZodObject<{
372
- type: z.ZodLiteral<"fixed">;
373
- amount: z.ZodString;
374
- currencyCode: z.ZodString;
375
- }, z.core.$strip>, z.ZodObject<{
376
- type: z.ZodLiteral<"discount_percent">;
377
- percent: z.ZodString;
378
- }, z.core.$strip>], "type">;
379
- active: z.ZodBoolean;
380
- inactiveReason: z.ZodNullable<z.ZodEnum<{
381
- attribute_not_flagged: "attribute_not_flagged";
382
- attribute_not_found: "attribute_not_found";
383
- attribute_language_scoped: "attribute_language_scoped";
384
- attribute_channel_scoped: "attribute_channel_scoped";
385
- attribute_value_type: "attribute_value_type";
386
- }>>;
387
- targetDeleted: z.ZodBoolean;
388
- labels: z.ZodObject<{
389
- product: z.ZodNullable<z.ZodObject<{
390
- sku: z.ZodString;
391
- name: z.ZodString;
392
- }, z.core.$strip>>;
393
- category: z.ZodNullable<z.ZodString>;
394
- attribute: z.ZodNullable<z.ZodObject<{
395
- label: z.ZodString;
396
- valueLabel: z.ZodString;
397
- }, z.core.$strip>>;
398
- organization: z.ZodNullable<z.ZodString>;
399
- }, z.core.$strip>;
400
- createdAt: z.ZodString;
401
- updatedAt: z.ZodString;
402
- }, z.core.$strip>;
403
- }, z.core.$strip>;
404
- /** One item of `GET /api/v1/admin/pricing/rule-targets/attributes`. */
405
- export declare const priceMatrixAttributeTargetSchema: z.ZodObject<{
406
- key: z.ZodString;
407
- label: z.ZodString;
408
- valueType: z.ZodEnum<{
409
- boolean: "boolean";
410
- enum: "enum";
411
- select: "select";
412
- multiselect: "multiselect";
413
- }>;
414
- options: z.ZodArray<z.ZodObject<{
415
- value: z.ZodString;
416
- label: z.ZodString;
417
- }, z.core.$strip>>;
418
- }, z.core.$strip>;
419
- export type PriceMatrixAttributeTarget = z.infer<typeof priceMatrixAttributeTargetSchema>;
420
- /** Route params of every `/api/v1/admin/price-lists-engine/:id/...` route. */
421
- export declare const priceListIdParamsSchema: z.ZodObject<{
422
- id: z.ZodString;
423
- }, z.core.$strip>;
424
- export type PriceListIdParams = z.infer<typeof priceListIdParamsSchema>;
425
- /**
426
- * Body of `POST /api/v1/admin/price-lists-engine/:id/products/bulk-add`: add
427
- * the products to the list's roster in one audited write. Additive — products
428
- * already on the roster keep their brackets. At least one id, at most
429
- * {@link ADMIN_PRODUCT_SELECTION_MAX}.
430
- */
431
- export declare const bulkAddPriceListProductsRequestSchema: z.ZodObject<{
432
- productIds: z.ZodArray<z.ZodString>;
433
- }, z.core.$strip>;
434
- export type BulkAddPriceListProductsRequest = z.infer<typeof bulkAddPriceListProductsRequestSchema>;
435
- /** Why a product of a bulk add was not added. `product_not_found`: unknown or deleted. */
436
- export declare const bulkAddPriceListProductFailureReasonSchema: z.ZodEnum<{
437
- product_not_found: "product_not_found";
438
- }>;
439
- export type BulkAddPriceListProductFailureReason = z.infer<typeof bulkAddPriceListProductFailureReasonSchema>;
440
- /**
441
- * Per-product outcome of a bulk add, over the de-duplicated ids: `added` now
442
- * on the roster, `unchanged` already on it (a retry is safe), `failed` with a
443
- * reason.
444
- */
445
- export declare const bulkAddPriceListProductsResultSchema: z.ZodObject<{
446
- added: z.ZodArray<z.ZodString>;
447
- unchanged: z.ZodArray<z.ZodString>;
448
- failed: z.ZodArray<z.ZodObject<{
449
- productId: z.ZodString;
450
- reason: z.ZodEnum<{
451
- product_not_found: "product_not_found";
452
- }>;
453
- }, z.core.$strip>>;
454
- }, z.core.$strip>;
455
- export type BulkAddPriceListProductsResult = z.infer<typeof bulkAddPriceListProductsResultSchema>;
456
- export declare const bulkAddPriceListProductsResponseSchema: z.ZodObject<{
457
- data: z.ZodObject<{
458
- added: z.ZodArray<z.ZodString>;
459
- unchanged: z.ZodArray<z.ZodString>;
460
- failed: z.ZodArray<z.ZodObject<{
461
- productId: z.ZodString;
462
- reason: z.ZodEnum<{
463
- product_not_found: "product_not_found";
464
- }>;
465
- }, z.core.$strip>>;
466
- }, z.core.$strip>;
467
- }, z.core.$strip>;
468
- export type BulkAddPriceListProductsResponse = z.infer<typeof bulkAddPriceListProductsResponseSchema>;
2
+ import type { ProductResolvedPrice } from './catalog.js';
3
+ import { type PriceSource } from './price-books.js';
469
4
  export declare const displayModeSchema: z.ZodEnum<{
470
- both: "both";
471
5
  none: "none";
6
+ both: "both";
472
7
  gross_only: "gross_only";
473
8
  net_only: "net_only";
474
9
  }>;
475
10
  export type DisplayMode = z.infer<typeof displayModeSchema>;
11
+ /**
12
+ * Issue #491 — whether a resolved display mode withholds every amount from the
13
+ * viewer it was resolved for.
14
+ *
15
+ * `none` is "price on request": the shop does not show this viewer a price, and
16
+ * the server does not send one. `price_lists` applies it where it maps a
17
+ * resolution onto the published listing and engine shapes
18
+ * (`ListingPriceDetail`, `ListingPrice`, the resolved-price endpoint), so every
19
+ * catalogue surface gets no amount and `displayMode: 'none'`. A **line** answer
20
+ * ({@link LinePriceResult}) keeps its amount, because it is what a charging
21
+ * consumer refuses as quote-only; a consumer that publishes a line amount to a
22
+ * viewer asks this function first rather than re-stating the rule.
23
+ */
24
+ export declare function displayModeWithholdsAmounts(mode: DisplayMode): boolean;
25
+ /**
26
+ * Feature 160 (FR-029, owner ruling 2026-10-23) — why a price book pinned to a
27
+ * product feed publishes no prices now. A feed is fetched by a provider, which
28
+ * is nobody's buyer, so a pinned book publishes only while it would price an
29
+ * anonymous buyer on the feed's channel: `active` or `scheduled` and inside its
30
+ * schedule window (`outside_schedule`, else `not_active`), bound to that
31
+ * channel with the channel offering its currency (`not_on_channel`; a base book
32
+ * is channel-independent), and for everyone (`audience_restricted`). A book in
33
+ * another currency than the feed's (`currency_mismatch`) or one that does not
34
+ * exist (`not_found`) prices nothing either.
35
+ */
36
+ export declare const pinnedPriceBookUnpublishableReasonSchema: z.ZodEnum<{
37
+ not_found: "not_found";
38
+ currency_mismatch: "currency_mismatch";
39
+ not_active: "not_active";
40
+ outside_schedule: "outside_schedule";
41
+ not_on_channel: "not_on_channel";
42
+ audience_restricted: "audience_restricted";
43
+ }>;
44
+ export type PinnedPriceBookUnpublishableReason = z.infer<typeof pinnedPriceBookUnpublishableReasonSchema>;
45
+ /** Whether a pinned price book publishes prices now, and why not. */
46
+ export type PinnedPriceBookPublishability = {
47
+ publishable: true;
48
+ } | {
49
+ publishable: false;
50
+ reason: PinnedPriceBookUnpublishableReason;
51
+ };
476
52
  export declare const displayModeOverrideScopeSchema: z.ZodEnum<{
477
- category: "category";
478
53
  product: "product";
54
+ category: "category";
479
55
  organization: "organization";
480
56
  }>;
481
57
  export type DisplayModeOverrideScope = z.infer<typeof displayModeOverrideScopeSchema>;
482
58
  export declare const displayModeOverrideSchema: z.ZodObject<{
483
59
  scope: z.ZodEnum<{
484
- category: "category";
485
60
  product: "product";
61
+ category: "category";
486
62
  organization: "organization";
487
63
  }>;
488
64
  targetId: z.ZodString;
489
65
  mode: z.ZodEnum<{
490
- both: "both";
491
66
  none: "none";
67
+ both: "both";
492
68
  gross_only: "gross_only";
493
69
  net_only: "net_only";
494
70
  }>;
@@ -497,54 +73,79 @@ export declare const displayModeOverrideSchema: z.ZodObject<{
497
73
  export type DisplayModeOverride = z.infer<typeof displayModeOverrideSchema>;
498
74
  export declare const upsertDisplayModeOverrideRequestSchema: z.ZodObject<{
499
75
  mode: z.ZodUnion<[z.ZodEnum<{
500
- both: "both";
501
76
  none: "none";
77
+ both: "both";
502
78
  gross_only: "gross_only";
503
79
  net_only: "net_only";
504
80
  }>, z.ZodLiteral<"inherit">]>;
505
81
  }, z.core.$strip>;
82
+ /**
83
+ * `GET /api/v1/storefront/products/:id/resolved-price`. A product no price book
84
+ * prices for the buyer (FR-018) is **unpriced**: `baseListId`, `basePrice` and
85
+ * `quantityBracket` are all `null` together — never an empty-string id.
86
+ *
87
+ * Issue #491 — a product whose display mode resolves to `none` for the viewer
88
+ * answers the same way: no book, no amount, no bracket, no sale, `source` and
89
+ * `compareAt` `null` and no `listPrice`, with `displayMode: 'none'` so the page
90
+ * can tell "price on request" from "no price".
91
+ */
506
92
  export declare const resolvedPriceEngineSchema: z.ZodObject<{
507
- baseListId: z.ZodString;
508
- basePrice: z.ZodObject<{
509
- amount: z.ZodNumber;
93
+ baseListId: z.ZodNullable<z.ZodString>;
94
+ basePrice: z.ZodNullable<z.ZodObject<{
95
+ amount: z.ZodString;
510
96
  currency: z.ZodString;
511
- }, z.core.$strip>;
97
+ }, z.core.$strip>>;
512
98
  saleListId: z.ZodNullable<z.ZodString>;
513
99
  salePrice: z.ZodNullable<z.ZodObject<{
514
- amount: z.ZodNumber;
100
+ amount: z.ZodString;
515
101
  currency: z.ZodString;
516
102
  }, z.core.$strip>>;
517
103
  displayMode: z.ZodEnum<{
518
- both: "both";
519
104
  none: "none";
105
+ both: "both";
520
106
  gross_only: "gross_only";
521
107
  net_only: "net_only";
522
108
  }>;
523
109
  currencyCode: z.ZodString;
524
- quantityBracket: z.ZodObject<{
110
+ quantityBracket: z.ZodNullable<z.ZodObject<{
525
111
  minQuantity: z.ZodNumber;
526
112
  maxQuantity: z.ZodNullable<z.ZodNumber>;
527
- }, z.core.$strip>;
113
+ }, z.core.$strip>>;
114
+ source: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
115
+ base: "base";
116
+ buyer: "buyer";
117
+ catalogue: "catalogue";
118
+ sale: "sale";
119
+ }>>>;
120
+ compareAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ listPrice: z.ZodOptional<z.ZodObject<{
122
+ amount: z.ZodString;
123
+ currency: z.ZodString;
124
+ }, z.core.$strip>>;
528
125
  }, z.core.$strip>;
529
126
  export type ResolvedPriceEngine = z.infer<typeof resolvedPriceEngineSchema>;
530
127
  /**
531
128
  * What a catalogue listing may show as a product's price — issue #132.
532
129
  *
533
- * There is always one default price list, so the first arm is the path a
534
- * listing normally takes. The product ruling names the whole chain and this
535
- * union is that chain, one arm each:
130
+ * Two arms:
131
+ *
132
+ * `price_list` — a price book priced this product for this buyer (the base
133
+ * book, an everyone book of the channel, a buyer book or a
134
+ * sale; `priceSource` names the tier);
135
+ * `none` — nothing prices it, or the viewer's display mode is `none`
136
+ * (issue #491: the amount is withheld on the server), and the
137
+ * listing renders no price.
536
138
  *
537
- * `price_list` — an applicable list priced this product for this buyer;
538
- * `product` — no list applied, so the price assigned directly to the
539
- * Product stands in (the legacy `defaultPrice` attribute);
540
- * `none` — neither exists, and the listing renders no price.
139
+ * Feature 160 removed the third arm, `product` — the price assigned directly
140
+ * to the Product (the legacy `defaultPrice` attribute): a product has no price
141
+ * of its own any more (FR-042).
541
142
  *
542
143
  * The `none` arm carries **no `amount` field**, following the `ResolvedTax`
543
144
  * precedent (issue #124): a listing showing nothing and a listing offering a
544
145
  * free product are different pages, so a caller has to narrow on `source`
545
146
  * before it can read a figure. A product priced at zero comes back as
546
- * `{ source: 'price_list' | 'product', amount: '0.00' }` and renders as zero —
547
- * `amount` is never a falsy sentinel for absence.
147
+ * `{ source: 'price_list', amount: '0.00' }` and renders as zero — `amount` is
148
+ * never a falsy sentinel for absence.
548
149
  *
549
150
  * As with `ResolvedTax`, "the `price_lists` module is absent" is deliberately
550
151
  * not an arm: absence is not a value, and the port gate throws
@@ -556,10 +157,15 @@ export declare const listingPriceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
556
157
  currency: z.ZodString;
557
158
  priceListId: z.ZodString;
558
159
  isSale: z.ZodBoolean;
559
- }, z.core.$strip>, z.ZodObject<{
560
- source: z.ZodLiteral<"product">;
561
- amount: z.ZodString;
562
- currency: z.ZodString;
160
+ priceSource: z.ZodOptional<z.ZodEnum<{
161
+ base: "base";
162
+ buyer: "buyer";
163
+ catalogue: "catalogue";
164
+ sale: "sale";
165
+ }>>;
166
+ compareAtAmount: z.ZodOptional<z.ZodString>;
167
+ variesByVariant: z.ZodOptional<z.ZodBoolean>;
168
+ maxAmount: z.ZodOptional<z.ZodString>;
563
169
  }, z.core.$strip>, z.ZodObject<{
564
170
  source: z.ZodLiteral<"none">;
565
171
  }, z.core.$strip>], "source">;
@@ -629,18 +235,91 @@ export interface ListingPriceProduct {
629
235
  * same reasoning {@link LinePricePort} states for a cart line.
630
236
  */
631
237
  export interface ListingPricePort {
632
- resolveListingPrices(input: {
633
- products: readonly ListingPriceProduct[];
634
- context: {
635
- salesChannel: {
636
- id: string;
637
- defaultCurrency: string;
638
- };
639
- currencyCode?: string;
640
- /** The buying organisation, when the viewer has one. */
641
- organization?: PriceOrganization | null;
238
+ resolveListingPrices(input: ListingPriceInput): Promise<Map<string, ListingPrice>>;
239
+ }
240
+ /** The input both listing slices take. */
241
+ export interface ListingPriceInput {
242
+ products: readonly ListingPriceProduct[];
243
+ context: {
244
+ salesChannel: {
245
+ id: string;
246
+ defaultCurrency: string;
642
247
  };
643
- }): Promise<Map<string, ListingPrice>>;
248
+ currencyCode?: string;
249
+ /** The buying organisation, when the viewer has one. */
250
+ organization?: PriceOrganization | null;
251
+ /**
252
+ * D-287 P0 — the signed-in customer account, when the viewer is one. The
253
+ * engine resolves the account's own customer group, which overrides the
254
+ * organisation's (feature 040 R6) — see {@link PricingBuyerContext}.
255
+ */
256
+ customerAccountId?: string | null;
257
+ };
258
+ }
259
+ /**
260
+ * What a storefront surface renders for one product, from **one** resolution:
261
+ * the listing chain's answer (`price`, what `ProductSummary.price` is built
262
+ * from) and the base / sale / display-mode split a product page, a home-page
263
+ * card and a typeahead suggestion show (D-287 P0).
264
+ *
265
+ * Issue #491 — under `displayMode: 'none'` it carries **no amount**: `price` is
266
+ * the `none` arm, `basePrice` and `salePrice` are `null`, `listPrice` is absent
267
+ * and every `tiers` entry is `null`. The engine resolved them and withholds them
268
+ * here, once, so no consumer can forward them by mistake.
269
+ */
270
+ export interface ListingPriceDetail extends ProductResolvedPrice {
271
+ price: ListingPrice;
272
+ /**
273
+ * Feature 160 (G9 of `specs/161-price-book-editor/`) — the catalogue price
274
+ * beside a lower buyer price: present only while `pricing.show_list_price`
275
+ * is on and the channel's everyone price is above the price charged.
276
+ */
277
+ listPrice?: {
278
+ amount: string;
279
+ currency: string;
280
+ };
281
+ /**
282
+ * Feature 160 (D-287 P1) — the amount of each tier of the price-book
283
+ * resolution that produced `price`, where the tier priced anything. Absent on
284
+ * an answer of the pre-160 engine.
285
+ */
286
+ tiers?: {
287
+ base: {
288
+ amount: string;
289
+ currency: string;
290
+ } | null;
291
+ catalogue: {
292
+ amount: string;
293
+ currency: string;
294
+ } | null;
295
+ buyer: {
296
+ amount: string;
297
+ currency: string;
298
+ } | null;
299
+ sale: {
300
+ amount: string;
301
+ currency: string;
302
+ } | null;
303
+ };
304
+ }
305
+ /**
306
+ * Container name: `pricingService`. Owner: `price_lists`.
307
+ *
308
+ * `ListingPricePort`'s sibling for a surface that renders the base / sale /
309
+ * display-mode split as well as the price — the product detail, the catalogue
310
+ * cards behind the home page, the typeahead. One call answers both, so such a
311
+ * surface resolves its products once rather than once for `price` and again
312
+ * through `resolveEngine` per product (D-287 P0,
313
+ * `specs/pricing/read-paths-and-performance.md` §2.1, §2.3).
314
+ *
315
+ * A separate slice rather than a widened `ListingPricePort`, for the reason
316
+ * `OrgLinePricePort` states: every consumer types a structural stub of the
317
+ * port it names, and a caller that needs both asks for both by name.
318
+ *
319
+ * **Owner off:** fails closed, like `ListingPricePort`.
320
+ */
321
+ export interface ListingPriceDetailPort {
322
+ resolveListingPriceDetails(input: ListingPriceInput): Promise<Map<string, ListingPriceDetail>>;
644
323
  }
645
324
  /**
646
325
  * The buying organisation, as a price resolution reads it: the id, which is a
@@ -762,6 +441,31 @@ export interface ListingPriceViewerContext {
762
441
  organization?: PriceOrganization | null;
763
442
  /** Feature 040 — a customer's direct group overrides the organisation's. */
764
443
  customerGroupId?: string | null;
444
+ /** D-287 P0 — the customer account whose own group to resolve; see {@link PricingBuyerContext}. */
445
+ customerAccountId?: string | null;
446
+ }
447
+ /**
448
+ * D-287 P0 — **the** customer-group rule, for every pricing path:
449
+ *
450
+ * effective group = customer.customerGroupId ?? organization.customerGroupId ?? null
451
+ *
452
+ * A caller says who the buyer is — the organisation, and the customer account
453
+ * when the buyer is a signed-in customer — and the engine applies the rule.
454
+ * Listings, the product page and the cart used to pass the organisation alone,
455
+ * so a customer whose own group overrides the organisation's (feature 040 R6)
456
+ * was priced on the organisation's group there while quotes and the admin order
457
+ * preview, which resolved the account themselves, honoured it: the same buyer,
458
+ * different winning lists (`specs/pricing/read-paths-and-performance.md` §2.2).
459
+ *
460
+ * `customerGroupId`, when set, is a group the caller already resolved for the
461
+ * customer and wins. The account is read only when it belongs to the
462
+ * organisation named beside it; otherwise its group is ignored, never another
463
+ * tenant's terms.
464
+ */
465
+ export interface PricingBuyerContext {
466
+ organization?: PriceOrganization | null;
467
+ customerGroupId?: string | null;
468
+ customerAccountId?: string | null;
765
469
  }
766
470
  /**
767
471
  * `?currency=` on a storefront catalogue read (issue #249): the currency the
@@ -853,8 +557,23 @@ export interface ListingPriceOrderChunk {
853
557
  * chunks rather than per chunk.
854
558
  */
855
559
  sourceRowsRead: number;
560
+ /**
561
+ * Feature 160 (`specs/160-pricing-model-v2/contracts/price-surface.md` §3) —
562
+ * `true` when no price order exists yet for the viewer's channel and currency
563
+ * (no surface built) and none is built for the request: the caller serves its
564
+ * default order, cards priced live, until the worker has built one.
565
+ */
566
+ unordered?: boolean;
856
567
  }
857
- /** What a resolved line price is, once the whole chain has run. */
568
+ /**
569
+ * What a resolved line price is, once the whole chain has run.
570
+ *
571
+ * A line keeps its amount under `displayMode: 'none'` (issue #491): it is the
572
+ * charging path, and every charging consumer refuses such a line as quote-only
573
+ * by the mode beside the amount. A consumer that **publishes** a line amount to
574
+ * a viewer — the external catalogue API — withholds it first, through
575
+ * {@link displayModeWithholdsAmounts}.
576
+ */
858
577
  export interface LinePriceResult {
859
578
  /** Decimal string — it lands verbatim on the cart line and then the order. */
860
579
  amount: string;
@@ -863,6 +582,13 @@ export interface LinePriceResult {
863
582
  isSale: boolean;
864
583
  bracketStartQuantity: number;
865
584
  displayMode: DisplayMode;
585
+ /**
586
+ * Feature 160 (D-287 P1) — which tier priced the line (FR-030). Absent on an
587
+ * answer of the pre-160 engine; `isSale` is `source === 'sale'` when set.
588
+ */
589
+ source?: PriceSource;
590
+ /** Feature 160 — the buyer price a charged sale undercut (FR-015), else absent. */
591
+ compareAt?: string | null;
866
592
  }
867
593
  /**
868
594
  * Container name: `pricingService`. Owner: `price_lists`.
@@ -894,6 +620,8 @@ export interface LinePricePort {
894
620
  organization?: PriceOrganization | null;
895
621
  /** Feature 040 — a customer's direct group overrides the org's. */
896
622
  customerGroupId?: string | null;
623
+ /** D-287 P0 — see {@link PricingBuyerContext}. */
624
+ customerAccountId?: string | null;
897
625
  salesChannel: {
898
626
  id: string;
899
627
  defaultCurrency: string;
@@ -902,6 +630,43 @@ export interface LinePricePort {
902
630
  };
903
631
  }): Promise<LinePriceResult | null>;
904
632
  }
633
+ /** One line of a batched line resolution: a caller-chosen key, a product, a quantity. */
634
+ export interface LinePriceRequest {
635
+ /** Echoed back as the answer's map key; unique per call. */
636
+ key: string;
637
+ product: ListingPriceProduct;
638
+ variantId?: string | null;
639
+ quantity: number;
640
+ }
641
+ /**
642
+ * Container name: `pricingService`. Owner: `price_lists`.
643
+ *
644
+ * `LinePricePort` for many lines at once — a cart read, a placement drift
645
+ * check, a quote's reference prices, an external bulk price request. One call
646
+ * prices every line at its own quantity for one buyer, in a number of
647
+ * statements that does not grow with the lines, and answers exactly what
648
+ * calling `resolveLinePrice` once per line answers (D-287 P0; the identity is
649
+ * `backend/test/integration/price_lists/line-prices-batch.test.ts`).
650
+ *
651
+ * Every requested key gets an entry; `null` is "nothing applies", as for the
652
+ * single call. The same product may appear on several lines, at the same or
653
+ * different quantities.
654
+ *
655
+ * A separate slice so a stub of `LinePricePort` keeps compiling.
656
+ * **Owner off:** fails closed, like `LinePricePort`.
657
+ */
658
+ export interface LinePricesPort {
659
+ resolveLinePrices(input: {
660
+ lines: readonly LinePriceRequest[];
661
+ context: PricingBuyerContext & {
662
+ salesChannel: {
663
+ id: string;
664
+ defaultCurrency: string;
665
+ };
666
+ currencyCode?: string;
667
+ };
668
+ }): Promise<Map<string, LinePriceResult | null>>;
669
+ }
905
670
  /**
906
671
  * Container name: `productDisplayModePort`. Owner: `price_lists`.
907
672
  *
@@ -944,7 +709,7 @@ export interface ProductDisplayModePort {
944
709
  * A caller that needs both asks for both by name.
945
710
  *
946
711
  * It had to be published somewhere for feature 075's `catalog` cut, because
947
- * `listBracketMinQuantities` was declared **only** on
712
+ * `listBracketMinQuantities` (`listTierStarts` since feature 160) was declared **only** on
948
713
  * `price_lists/services/pricing-service.interface.ts` — and that file is
949
714
  * deliberately not in this package, because it is the target of the
950
715
  * feature-057 overlay decoration and moving it would move the contract gate.
@@ -953,6 +718,9 @@ export interface ProductDisplayModePort {
953
718
  * `price_lists` still satisfies it (D-77's rejected alternative, same
954
719
  * reasoning). `PricingServiceContract` is a superset and satisfies this
955
720
  * structurally, so no implementation changed.
721
+ *
722
+ * D-287 P0 left it as it was — a stub of it still compiles — and the external
723
+ * namespace, which now prices in batches, names `OrgLinePricePort & LinePricesPort`.
956
724
  */
957
725
  export interface OrgLinePricePort extends LinePricePort {
958
726
  /**
@@ -961,7 +729,7 @@ export interface OrgLinePricePort extends LinePricePort {
961
729
  * `resolveLinePrice` at each one to build the buying organisation's effective
962
730
  * tier ladder without re-implementing resolution.
963
731
  */
964
- listBracketMinQuantities(productId: string, currencyCode: string): Promise<number[]>;
732
+ listTierStarts(productId: string, currencyCode: string, variantId?: string | null): Promise<number[]>;
965
733
  }
966
734
  /** One line of a {@link BuyerLinePriceQuery}. */
967
735
  export interface BuyerLinePriceLine {
@@ -1034,31 +802,31 @@ export declare const PRICING_SETTING_CODES: {
1034
802
  readonly DEFAULT_DISPLAY_MODE: "pricing.default_display_mode";
1035
803
  readonly UNAUTHENTICATED_DISPLAY_MODE: "pricing.unauthenticated_display_mode";
1036
804
  };
1037
- /** A price list as a module outside `price_lists` sees it. */
805
+ /**
806
+ * A price book as a module outside `price_lists` sees it (feature 160: every
807
+ * price list is a price book; the base books are the `isSystem` ones).
808
+ */
1038
809
  export interface PriceListRecord {
1039
810
  id: string;
1040
- code: string;
1041
811
  name: string;
1042
- currency: string;
1043
- isDefault: boolean;
812
+ currencyCode: string;
1044
813
  priority: number;
1045
- type: 'base' | 'sale';
814
+ type: 'regular' | 'sale';
1046
815
  status: 'draft' | 'active' | 'scheduled' | 'expired';
816
+ audienceKind: 'everyone' | 'customer_groups' | 'organizations';
1047
817
  startsAt: Date | null;
1048
818
  endsAt: Date | null;
1049
- applicationRule: ApplicationRule;
1050
819
  isSystem: boolean;
1051
- modifiedAt: Date;
1052
820
  createdAt: Date;
1053
821
  updatedAt: Date;
1054
822
  }
1055
823
  /**
1056
824
  * Container name: `priceListReadPort`. Owner: `price_lists`.
1057
825
  *
1058
- * `organizations` resolves which lists apply to an org, `product_feeds` reads
1059
- * the list a feed prices from. Both read the row; neither should own the
1060
- * question of what "active" means, which is why `listActive` is here rather
1061
- * than a status filter in each caller.
826
+ * `organizations` reads the books that apply to an org, `product_feeds` reads
827
+ * the book a feed prices from. Both read the row; neither should own the
828
+ * question of what "applies" means, which is why `listForOrganization` is here
829
+ * rather than a status filter in each caller.
1062
830
  *
1063
831
  * **Owner off:** the seam fails closed — resolving this port throws
1064
832
  * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
@@ -1069,106 +837,33 @@ export interface PriceListRecord {
1069
837
  export interface PriceListReadPort {
1070
838
  findById(id: string): Promise<PriceListRecord | null>;
1071
839
  findByIds(ids: readonly string[]): Promise<PriceListRecord[]>;
1072
- findByCode(code: string): Promise<PriceListRecord | null>;
1073
- /** Every list, ordered by priority then code. */
840
+ /** Every book, ordered by priority desc then name. */
1074
841
  listAll(): Promise<PriceListRecord[]>;
1075
- /** Only `status === 'active'`, ordered by priority then code. */
842
+ /** Only `status === 'active'`, ordered by priority desc then name. */
1076
843
  listActive(): Promise<PriceListRecord[]>;
1077
- }
1078
- /**
1079
- * One quantity bracket of a product's price on a list.
1080
- *
1081
- * `amount` is a decimal **string** — the storage shape on
1082
- * `price_list_price_brackets`. A `number` cannot round-trip a price, and this
1083
- * value comes in from a PIM import and goes out to a checkout.
1084
- */
1085
- export interface PriceBracketInput {
1086
- minQuantity: number;
1087
- maxQuantity: number | null;
1088
- amount: string;
1089
- }
1090
- /** One list's brackets for a product, as the admin summary renders them. */
1091
- export interface PriceListBracketSummary {
1092
- list: {
1093
- id: string;
1094
- name: string;
1095
- type: 'base' | 'sale';
1096
- status: 'draft' | 'active' | 'scheduled' | 'expired';
1097
- modifiedAt: Date;
1098
- };
1099
- summary: Array<{
1100
- currencyCode: string;
1101
- summary: string;
1102
- }>;
1103
- deepLinkPath: string;
1104
- }
1105
- /**
1106
- * Container name: `priceListAdminPort`. Owner: `price_lists`.
1107
- *
1108
- * `pim_ergonode` writes prices as part of an import run: it resolves the list,
1109
- * adds the product to it if it is not there, replaces the brackets, and reads
1110
- * back the summary its field-protection rules compare against. That is the
1111
- * whole of what it needs, and publishing more would be publishing the class.
1112
- *
1113
- * **Owner off:** the seam fails closed — resolving this port throws
1114
- * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
1115
- * half-executes. Whether `price_lists` has an off state at all is its manifest's
1116
- * `activation` to say, not this line's: a module declaring
1117
- * `nonDeactivatable` never enters one.
1118
- */
1119
- export interface PriceListAdminPort {
1120
- getById(id: string): Promise<PriceListRecord>;
1121
- listProducts(priceListId: string): Promise<Array<{
1122
- productId: string;
1123
- bracketsByCurrency: Record<string, PriceBracketInput[]>;
1124
- }>>;
1125
- addProduct(priceListId: string, productId: string): Promise<void>;
1126
- replaceBrackets(priceListId: string, productId: string, bracketsByCurrency: Record<string, readonly PriceBracketInput[]>): Promise<Record<string, PriceBracketInput[]>>;
1127
- summarizeBracketsForProduct(productId: string): Promise<PriceListBracketSummary[]>;
1128
- }
1129
- /** What a rule is evaluated against. */
1130
- export interface PriceListResolutionContext {
1131
- organizationId: string | null;
1132
844
  /**
1133
- * Feature 056 — the acting org's inheritance chain, nearest-first
1134
- * (`[orgId, ...ancestorIds]`). When present, the `organization` criterion
1135
- * matches ANY org in the chain, and the resolver ranks by nearness so a list
1136
- * naming a nearer org outranks one naming a farther ancestor (R5). When
1137
- * absent, it defaults to `[organizationId]` (flat behaviour, byte-for-byte).
845
+ * Feature 160 (FR-032) — the price books that apply to an organization now:
846
+ * those whose audience set holds the organization (`organization`, depth 0)
847
+ * or an ancestor of it (`ancestor`, its depth in the chain), and those whose
848
+ * audience set holds its customer group (`customer_group`). The caller
849
+ * passes the chain (nearest first) and the group, which are the
850
+ * organization's own facts. Ordered by priority desc, then name.
1138
851
  */
1139
- organizationChain?: readonly string[];
1140
- customerGroupId: string | null;
1141
- salesChannelId: string;
1142
- currencyCode: string;
1143
- productCategoryIds: ReadonlySet<string>;
852
+ listForOrganization(input: {
853
+ organizationChain: readonly string[];
854
+ customerGroupId: string | null;
855
+ }): Promise<OrganizationPriceBookRecord[]>;
1144
856
  }
1145
- export interface PriceListRuleEvaluation {
1146
- matched: boolean;
1147
- explicitOn: ReadonlySet<RuleCriterionType>;
1148
- /**
1149
- * Feature 056 — index of the NEAREST org (in the resolution chain) that this
1150
- * rule explicitly names, or `undefined` when the rule names no org in the
1151
- * chain. Lower = nearer = higher price-list priority within the
1152
- * `organization` level (R5). A direct-org match (flat) is rank 0.
1153
- */
1154
- organizationRank?: number;
857
+ /** One book of {@link PriceListReadPort.listForOrganization}. */
858
+ export interface OrganizationPriceBookRecord {
859
+ id: string;
860
+ name: string;
861
+ type: 'regular' | 'sale';
862
+ currencyCode: string;
863
+ priority: number;
864
+ status: 'scheduled' | 'active';
865
+ reason: 'organization' | 'ancestor' | 'customer_group';
866
+ /** Chain depth of the nearest member; `null` for a customer-group book. */
867
+ depth: number | null;
1155
868
  }
1156
- /**
1157
- * Pure rule evaluator (feature 011 / FR-022, FR-023, FR-026, FR-029).
1158
- *
1159
- * Walks the discriminated-union AST and returns:
1160
- * - `matched`: the overall AST truth value against the resolution context.
1161
- * - `explicitOn`: the criterion types that contributed to the match AND had
1162
- * non-empty value lists. The resolver's priority chain consults this to
1163
- * award the per-step boost (FR-026 steps 1..4).
1164
- *
1165
- * Notes:
1166
- * - The `category` criterion is product-driven (FR-029): it matches when the
1167
- * product belongs to any category named in the rule's value list.
1168
- * - The `currency` criterion never appears in the priority chain even when
1169
- * explicit; it is purely a matching criterion.
1170
- * - `{ kind: 'all' }` and any criterion with `values: []` are treated as
1171
- * always-true and contribute nothing to `explicitOn` (FR-022).
1172
- */
1173
- export declare function evaluateApplicationRule(rule: ApplicationRule, ctx: PriceListResolutionContext): PriceListRuleEvaluation;
1174
869
  //# sourceMappingURL=price-lists.d.ts.map