@endora-commerce/contracts 0.107.0 → 0.108.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 (141) hide show
  1. package/dist/admin-feedback.d.ts +61 -0
  2. package/dist/admin-feedback.d.ts.map +1 -0
  3. package/dist/admin-feedback.js +71 -0
  4. package/dist/admin-feedback.js.map +1 -0
  5. package/dist/admin-name.d.ts +21 -0
  6. package/dist/admin-name.d.ts.map +1 -0
  7. package/dist/admin-name.js +30 -0
  8. package/dist/admin-name.js.map +1 -0
  9. package/dist/carts.d.ts +197 -1
  10. package/dist/carts.d.ts.map +1 -1
  11. package/dist/carts.js +29 -0
  12. package/dist/carts.js.map +1 -1
  13. package/dist/catalog.d.ts +243 -10
  14. package/dist/catalog.d.ts.map +1 -1
  15. package/dist/catalog.js +107 -4
  16. package/dist/catalog.js.map +1 -1
  17. package/dist/common.d.ts +4 -0
  18. package/dist/common.d.ts.map +1 -1
  19. package/dist/common.js +14 -0
  20. package/dist/common.js.map +1 -1
  21. package/dist/comparisons.d.ts +7 -0
  22. package/dist/comparisons.d.ts.map +1 -1
  23. package/dist/comparisons.js +2 -0
  24. package/dist/comparisons.js.map +1 -1
  25. package/dist/credit-limits.d.ts.map +1 -1
  26. package/dist/credit-limits.js +3 -2
  27. package/dist/credit-limits.js.map +1 -1
  28. package/dist/crm-rich-text.d.ts +64 -0
  29. package/dist/crm-rich-text.d.ts.map +1 -0
  30. package/dist/crm-rich-text.js +303 -0
  31. package/dist/crm-rich-text.js.map +1 -0
  32. package/dist/crm.d.ts +91 -1
  33. package/dist/crm.d.ts.map +1 -1
  34. package/dist/crm.js +49 -34
  35. package/dist/crm.js.map +1 -1
  36. package/dist/custom-fields.d.ts +414 -1
  37. package/dist/custom-fields.d.ts.map +1 -1
  38. package/dist/custom-fields.js +319 -10
  39. package/dist/custom-fields.js.map +1 -1
  40. package/dist/document-templates.d.ts +184 -8
  41. package/dist/document-templates.d.ts.map +1 -1
  42. package/dist/document-templates.js +98 -1
  43. package/dist/document-templates.js.map +1 -1
  44. package/dist/document-values.d.ts +4 -1
  45. package/dist/document-values.d.ts.map +1 -1
  46. package/dist/document-values.js +18 -6
  47. package/dist/document-values.js.map +1 -1
  48. package/dist/errors.d.ts +37 -8
  49. package/dist/errors.d.ts.map +1 -1
  50. package/dist/errors.js +66 -8
  51. package/dist/errors.js.map +1 -1
  52. package/dist/index.d.ts +11 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +16 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/invoices.d.ts.map +1 -1
  57. package/dist/invoices.js +7 -4
  58. package/dist/invoices.js.map +1 -1
  59. package/dist/line-groups.d.ts +80 -0
  60. package/dist/line-groups.d.ts.map +1 -0
  61. package/dist/line-groups.js +130 -0
  62. package/dist/line-groups.js.map +1 -0
  63. package/dist/localized-name.d.ts +20 -0
  64. package/dist/localized-name.d.ts.map +1 -0
  65. package/dist/localized-name.js +45 -0
  66. package/dist/localized-name.js.map +1 -0
  67. package/dist/money-decimal.d.ts +162 -0
  68. package/dist/money-decimal.d.ts.map +1 -0
  69. package/dist/money-decimal.js +365 -0
  70. package/dist/money-decimal.js.map +1 -0
  71. package/dist/money-input.d.ts +64 -0
  72. package/dist/money-input.d.ts.map +1 -0
  73. package/dist/money-input.js +111 -0
  74. package/dist/money-input.js.map +1 -0
  75. package/dist/order-minimums.d.ts +111 -0
  76. package/dist/order-minimums.d.ts.map +1 -0
  77. package/dist/order-minimums.js +196 -0
  78. package/dist/order-minimums.js.map +1 -0
  79. package/dist/orders.d.ts +181 -2
  80. package/dist/orders.d.ts.map +1 -1
  81. package/dist/orders.js +92 -5
  82. package/dist/orders.js.map +1 -1
  83. package/dist/payment-methods.d.ts.map +1 -1
  84. package/dist/payment-methods.js +2 -1
  85. package/dist/payment-methods.js.map +1 -1
  86. package/dist/price-book-decimal.d.ts +84 -0
  87. package/dist/price-book-decimal.d.ts.map +1 -0
  88. package/dist/price-book-decimal.js +175 -0
  89. package/dist/price-book-decimal.js.map +1 -0
  90. package/dist/price-books.d.ts +2206 -0
  91. package/dist/price-books.d.ts.map +1 -0
  92. package/dist/price-books.js +777 -0
  93. package/dist/price-books.js.map +1 -0
  94. package/dist/price-lists.d.ts +268 -607
  95. package/dist/price-lists.d.ts.map +1 -1
  96. package/dist/price-lists.js +92 -455
  97. package/dist/price-lists.js.map +1 -1
  98. package/dist/product-feeds.d.ts +89 -8
  99. package/dist/product-feeds.d.ts.map +1 -1
  100. package/dist/product-feeds.js +18 -1
  101. package/dist/product-feeds.js.map +1 -1
  102. package/dist/product-value-resolver.d.ts +6 -0
  103. package/dist/product-value-resolver.d.ts.map +1 -1
  104. package/dist/product-value-resolver.js +6 -1
  105. package/dist/product-value-resolver.js.map +1 -1
  106. package/dist/promotions.d.ts +2 -2
  107. package/dist/promotions.d.ts.map +1 -1
  108. package/dist/promotions.js +8 -2
  109. package/dist/promotions.js.map +1 -1
  110. package/dist/quick-order.d.ts +39 -0
  111. package/dist/quick-order.d.ts.map +1 -1
  112. package/dist/quick-order.js +43 -0
  113. package/dist/quick-order.js.map +1 -1
  114. package/dist/quote-requests.d.ts +270 -1
  115. package/dist/quote-requests.d.ts.map +1 -1
  116. package/dist/quote-requests.js +150 -6
  117. package/dist/quote-requests.js.map +1 -1
  118. package/dist/returns.d.ts +55 -2
  119. package/dist/returns.d.ts.map +1 -1
  120. package/dist/returns.js +39 -4
  121. package/dist/returns.js.map +1 -1
  122. package/dist/sales-channels.d.ts +2 -0
  123. package/dist/sales-channels.d.ts.map +1 -1
  124. package/dist/sales-channels.js +2 -0
  125. package/dist/sales-channels.js.map +1 -1
  126. package/dist/search.d.ts +60 -0
  127. package/dist/search.d.ts.map +1 -1
  128. package/dist/search.js +4 -0
  129. package/dist/search.js.map +1 -1
  130. package/dist/shipping-methods.d.ts.map +1 -1
  131. package/dist/shipping-methods.js +2 -1
  132. package/dist/shipping-methods.js.map +1 -1
  133. package/dist/shopping-lists.d.ts +24 -0
  134. package/dist/shopping-lists.d.ts.map +1 -1
  135. package/dist/shopping-lists.js +20 -1
  136. package/dist/shopping-lists.js.map +1 -1
  137. package/dist/storefront-value-overrides.d.ts +67 -0
  138. package/dist/storefront-value-overrides.d.ts.map +1 -0
  139. package/dist/storefront-value-overrides.js +93 -0
  140. package/dist/storefront-value-overrides.js.map +1 -0
  141. package/package.json +1 -1
@@ -1,471 +1,6 @@
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
5
  both: "both";
471
6
  none: "none";
@@ -473,6 +8,33 @@ export declare const displayModeSchema: z.ZodEnum<{
473
8
  net_only: "net_only";
474
9
  }>;
475
10
  export type DisplayMode = z.infer<typeof displayModeSchema>;
11
+ /**
12
+ * Feature 160 (FR-029, owner ruling 2026-10-23) — why a price book pinned to a
13
+ * product feed publishes no prices now. A feed is fetched by a provider, which
14
+ * is nobody's buyer, so a pinned book publishes only while it would price an
15
+ * anonymous buyer on the feed's channel: `active` or `scheduled` and inside its
16
+ * schedule window (`outside_schedule`, else `not_active`), bound to that
17
+ * channel with the channel offering its currency (`not_on_channel`; a base book
18
+ * is channel-independent), and for everyone (`audience_restricted`). A book in
19
+ * another currency than the feed's (`currency_mismatch`) or one that does not
20
+ * exist (`not_found`) prices nothing either.
21
+ */
22
+ export declare const pinnedPriceBookUnpublishableReasonSchema: z.ZodEnum<{
23
+ not_found: "not_found";
24
+ currency_mismatch: "currency_mismatch";
25
+ not_active: "not_active";
26
+ outside_schedule: "outside_schedule";
27
+ not_on_channel: "not_on_channel";
28
+ audience_restricted: "audience_restricted";
29
+ }>;
30
+ export type PinnedPriceBookUnpublishableReason = z.infer<typeof pinnedPriceBookUnpublishableReasonSchema>;
31
+ /** Whether a pinned price book publishes prices now, and why not. */
32
+ export type PinnedPriceBookPublishability = {
33
+ publishable: true;
34
+ } | {
35
+ publishable: false;
36
+ reason: PinnedPriceBookUnpublishableReason;
37
+ };
476
38
  export declare const displayModeOverrideScopeSchema: z.ZodEnum<{
477
39
  category: "category";
478
40
  product: "product";
@@ -503,15 +65,20 @@ export declare const upsertDisplayModeOverrideRequestSchema: z.ZodObject<{
503
65
  net_only: "net_only";
504
66
  }>, z.ZodLiteral<"inherit">]>;
505
67
  }, z.core.$strip>;
68
+ /**
69
+ * `GET /api/v1/storefront/products/:id/resolved-price`. A product no price book
70
+ * prices for the buyer (FR-018) is **unpriced**: `baseListId`, `basePrice` and
71
+ * `quantityBracket` are all `null` together — never an empty-string id.
72
+ */
506
73
  export declare const resolvedPriceEngineSchema: z.ZodObject<{
507
- baseListId: z.ZodString;
508
- basePrice: z.ZodObject<{
509
- amount: z.ZodNumber;
74
+ baseListId: z.ZodNullable<z.ZodString>;
75
+ basePrice: z.ZodNullable<z.ZodObject<{
76
+ amount: z.ZodString;
510
77
  currency: z.ZodString;
511
- }, z.core.$strip>;
78
+ }, z.core.$strip>>;
512
79
  saleListId: z.ZodNullable<z.ZodString>;
513
80
  salePrice: z.ZodNullable<z.ZodObject<{
514
- amount: z.ZodNumber;
81
+ amount: z.ZodString;
515
82
  currency: z.ZodString;
516
83
  }, z.core.$strip>>;
517
84
  displayMode: z.ZodEnum<{
@@ -521,30 +88,43 @@ export declare const resolvedPriceEngineSchema: z.ZodObject<{
521
88
  net_only: "net_only";
522
89
  }>;
523
90
  currencyCode: z.ZodString;
524
- quantityBracket: z.ZodObject<{
91
+ quantityBracket: z.ZodNullable<z.ZodObject<{
525
92
  minQuantity: z.ZodNumber;
526
93
  maxQuantity: z.ZodNullable<z.ZodNumber>;
527
- }, z.core.$strip>;
94
+ }, z.core.$strip>>;
95
+ source: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
96
+ buyer: "buyer";
97
+ base: "base";
98
+ catalogue: "catalogue";
99
+ sale: "sale";
100
+ }>>>;
101
+ compareAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ listPrice: z.ZodOptional<z.ZodObject<{
103
+ amount: z.ZodString;
104
+ currency: z.ZodString;
105
+ }, z.core.$strip>>;
528
106
  }, z.core.$strip>;
529
107
  export type ResolvedPriceEngine = z.infer<typeof resolvedPriceEngineSchema>;
530
108
  /**
531
109
  * What a catalogue listing may show as a product's price — issue #132.
532
110
  *
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:
111
+ * Two arms:
112
+ *
113
+ * `price_list` — a price book priced this product for this buyer (the base
114
+ * book, an everyone book of the channel, a buyer book or a
115
+ * sale; `priceSource` names the tier);
116
+ * `none` — nothing prices it, and the listing renders no price.
536
117
  *
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.
118
+ * Feature 160 removed the third arm, `product` — the price assigned directly
119
+ * to the Product (the legacy `defaultPrice` attribute): a product has no price
120
+ * of its own any more (FR-042).
541
121
  *
542
122
  * The `none` arm carries **no `amount` field**, following the `ResolvedTax`
543
123
  * precedent (issue #124): a listing showing nothing and a listing offering a
544
124
  * free product are different pages, so a caller has to narrow on `source`
545
125
  * 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.
126
+ * `{ source: 'price_list', amount: '0.00' }` and renders as zero — `amount` is
127
+ * never a falsy sentinel for absence.
548
128
  *
549
129
  * As with `ResolvedTax`, "the `price_lists` module is absent" is deliberately
550
130
  * not an arm: absence is not a value, and the port gate throws
@@ -556,10 +136,15 @@ export declare const listingPriceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
556
136
  currency: z.ZodString;
557
137
  priceListId: z.ZodString;
558
138
  isSale: z.ZodBoolean;
559
- }, z.core.$strip>, z.ZodObject<{
560
- source: z.ZodLiteral<"product">;
561
- amount: z.ZodString;
562
- currency: z.ZodString;
139
+ priceSource: z.ZodOptional<z.ZodEnum<{
140
+ buyer: "buyer";
141
+ base: "base";
142
+ catalogue: "catalogue";
143
+ sale: "sale";
144
+ }>>;
145
+ compareAtAmount: z.ZodOptional<z.ZodString>;
146
+ variesByVariant: z.ZodOptional<z.ZodBoolean>;
147
+ maxAmount: z.ZodOptional<z.ZodString>;
563
148
  }, z.core.$strip>, z.ZodObject<{
564
149
  source: z.ZodLiteral<"none">;
565
150
  }, z.core.$strip>], "source">;
@@ -629,18 +214,86 @@ export interface ListingPriceProduct {
629
214
  * same reasoning {@link LinePricePort} states for a cart line.
630
215
  */
631
216
  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;
217
+ resolveListingPrices(input: ListingPriceInput): Promise<Map<string, ListingPrice>>;
218
+ }
219
+ /** The input both listing slices take. */
220
+ export interface ListingPriceInput {
221
+ products: readonly ListingPriceProduct[];
222
+ context: {
223
+ salesChannel: {
224
+ id: string;
225
+ defaultCurrency: string;
642
226
  };
643
- }): Promise<Map<string, ListingPrice>>;
227
+ currencyCode?: string;
228
+ /** The buying organisation, when the viewer has one. */
229
+ organization?: PriceOrganization | null;
230
+ /**
231
+ * D-287 P0 — the signed-in customer account, when the viewer is one. The
232
+ * engine resolves the account's own customer group, which overrides the
233
+ * organisation's (feature 040 R6) — see {@link PricingBuyerContext}.
234
+ */
235
+ customerAccountId?: string | null;
236
+ };
237
+ }
238
+ /**
239
+ * What a storefront surface renders for one product, from **one** resolution:
240
+ * the listing chain's answer (`price`, what `ProductSummary.price` is built
241
+ * from) and the base / sale / display-mode split a product page, a home-page
242
+ * card and a typeahead suggestion show (D-287 P0).
243
+ */
244
+ export interface ListingPriceDetail extends ProductResolvedPrice {
245
+ price: ListingPrice;
246
+ /**
247
+ * Feature 160 (G9 of `specs/161-price-book-editor/`) — the catalogue price
248
+ * beside a lower buyer price: present only while `pricing.show_list_price`
249
+ * is on and the channel's everyone price is above the price charged.
250
+ */
251
+ listPrice?: {
252
+ amount: string;
253
+ currency: string;
254
+ };
255
+ /**
256
+ * Feature 160 (D-287 P1) — the amount of each tier of the price-book
257
+ * resolution that produced `price`, where the tier priced anything. Absent on
258
+ * an answer of the pre-160 engine.
259
+ */
260
+ tiers?: {
261
+ base: {
262
+ amount: string;
263
+ currency: string;
264
+ } | null;
265
+ catalogue: {
266
+ amount: string;
267
+ currency: string;
268
+ } | null;
269
+ buyer: {
270
+ amount: string;
271
+ currency: string;
272
+ } | null;
273
+ sale: {
274
+ amount: string;
275
+ currency: string;
276
+ } | null;
277
+ };
278
+ }
279
+ /**
280
+ * Container name: `pricingService`. Owner: `price_lists`.
281
+ *
282
+ * `ListingPricePort`'s sibling for a surface that renders the base / sale /
283
+ * display-mode split as well as the price — the product detail, the catalogue
284
+ * cards behind the home page, the typeahead. One call answers both, so such a
285
+ * surface resolves its products once rather than once for `price` and again
286
+ * through `resolveEngine` per product (D-287 P0,
287
+ * `specs/pricing/read-paths-and-performance.md` §2.1, §2.3).
288
+ *
289
+ * A separate slice rather than a widened `ListingPricePort`, for the reason
290
+ * `OrgLinePricePort` states: every consumer types a structural stub of the
291
+ * port it names, and a caller that needs both asks for both by name.
292
+ *
293
+ * **Owner off:** fails closed, like `ListingPricePort`.
294
+ */
295
+ export interface ListingPriceDetailPort {
296
+ resolveListingPriceDetails(input: ListingPriceInput): Promise<Map<string, ListingPriceDetail>>;
644
297
  }
645
298
  /**
646
299
  * The buying organisation, as a price resolution reads it: the id, which is a
@@ -762,6 +415,31 @@ export interface ListingPriceViewerContext {
762
415
  organization?: PriceOrganization | null;
763
416
  /** Feature 040 — a customer's direct group overrides the organisation's. */
764
417
  customerGroupId?: string | null;
418
+ /** D-287 P0 — the customer account whose own group to resolve; see {@link PricingBuyerContext}. */
419
+ customerAccountId?: string | null;
420
+ }
421
+ /**
422
+ * D-287 P0 — **the** customer-group rule, for every pricing path:
423
+ *
424
+ * effective group = customer.customerGroupId ?? organization.customerGroupId ?? null
425
+ *
426
+ * A caller says who the buyer is — the organisation, and the customer account
427
+ * when the buyer is a signed-in customer — and the engine applies the rule.
428
+ * Listings, the product page and the cart used to pass the organisation alone,
429
+ * so a customer whose own group overrides the organisation's (feature 040 R6)
430
+ * was priced on the organisation's group there while quotes and the admin order
431
+ * preview, which resolved the account themselves, honoured it: the same buyer,
432
+ * different winning lists (`specs/pricing/read-paths-and-performance.md` §2.2).
433
+ *
434
+ * `customerGroupId`, when set, is a group the caller already resolved for the
435
+ * customer and wins. The account is read only when it belongs to the
436
+ * organisation named beside it; otherwise its group is ignored, never another
437
+ * tenant's terms.
438
+ */
439
+ export interface PricingBuyerContext {
440
+ organization?: PriceOrganization | null;
441
+ customerGroupId?: string | null;
442
+ customerAccountId?: string | null;
765
443
  }
766
444
  /**
767
445
  * `?currency=` on a storefront catalogue read (issue #249): the currency the
@@ -853,6 +531,13 @@ export interface ListingPriceOrderChunk {
853
531
  * chunks rather than per chunk.
854
532
  */
855
533
  sourceRowsRead: number;
534
+ /**
535
+ * Feature 160 (`specs/160-pricing-model-v2/contracts/price-surface.md` §3) —
536
+ * `true` when no price order exists yet for the viewer's channel and currency
537
+ * (no surface built) and none is built for the request: the caller serves its
538
+ * default order, cards priced live, until the worker has built one.
539
+ */
540
+ unordered?: boolean;
856
541
  }
857
542
  /** What a resolved line price is, once the whole chain has run. */
858
543
  export interface LinePriceResult {
@@ -863,6 +548,13 @@ export interface LinePriceResult {
863
548
  isSale: boolean;
864
549
  bracketStartQuantity: number;
865
550
  displayMode: DisplayMode;
551
+ /**
552
+ * Feature 160 (D-287 P1) — which tier priced the line (FR-030). Absent on an
553
+ * answer of the pre-160 engine; `isSale` is `source === 'sale'` when set.
554
+ */
555
+ source?: PriceSource;
556
+ /** Feature 160 — the buyer price a charged sale undercut (FR-015), else absent. */
557
+ compareAt?: string | null;
866
558
  }
867
559
  /**
868
560
  * Container name: `pricingService`. Owner: `price_lists`.
@@ -894,6 +586,8 @@ export interface LinePricePort {
894
586
  organization?: PriceOrganization | null;
895
587
  /** Feature 040 — a customer's direct group overrides the org's. */
896
588
  customerGroupId?: string | null;
589
+ /** D-287 P0 — see {@link PricingBuyerContext}. */
590
+ customerAccountId?: string | null;
897
591
  salesChannel: {
898
592
  id: string;
899
593
  defaultCurrency: string;
@@ -902,6 +596,43 @@ export interface LinePricePort {
902
596
  };
903
597
  }): Promise<LinePriceResult | null>;
904
598
  }
599
+ /** One line of a batched line resolution: a caller-chosen key, a product, a quantity. */
600
+ export interface LinePriceRequest {
601
+ /** Echoed back as the answer's map key; unique per call. */
602
+ key: string;
603
+ product: ListingPriceProduct;
604
+ variantId?: string | null;
605
+ quantity: number;
606
+ }
607
+ /**
608
+ * Container name: `pricingService`. Owner: `price_lists`.
609
+ *
610
+ * `LinePricePort` for many lines at once — a cart read, a placement drift
611
+ * check, a quote's reference prices, an external bulk price request. One call
612
+ * prices every line at its own quantity for one buyer, in a number of
613
+ * statements that does not grow with the lines, and answers exactly what
614
+ * calling `resolveLinePrice` once per line answers (D-287 P0; the identity is
615
+ * `backend/test/integration/price_lists/line-prices-batch.test.ts`).
616
+ *
617
+ * Every requested key gets an entry; `null` is "nothing applies", as for the
618
+ * single call. The same product may appear on several lines, at the same or
619
+ * different quantities.
620
+ *
621
+ * A separate slice so a stub of `LinePricePort` keeps compiling.
622
+ * **Owner off:** fails closed, like `LinePricePort`.
623
+ */
624
+ export interface LinePricesPort {
625
+ resolveLinePrices(input: {
626
+ lines: readonly LinePriceRequest[];
627
+ context: PricingBuyerContext & {
628
+ salesChannel: {
629
+ id: string;
630
+ defaultCurrency: string;
631
+ };
632
+ currencyCode?: string;
633
+ };
634
+ }): Promise<Map<string, LinePriceResult | null>>;
635
+ }
905
636
  /**
906
637
  * Container name: `productDisplayModePort`. Owner: `price_lists`.
907
638
  *
@@ -944,7 +675,7 @@ export interface ProductDisplayModePort {
944
675
  * A caller that needs both asks for both by name.
945
676
  *
946
677
  * It had to be published somewhere for feature 075's `catalog` cut, because
947
- * `listBracketMinQuantities` was declared **only** on
678
+ * `listBracketMinQuantities` (`listTierStarts` since feature 160) was declared **only** on
948
679
  * `price_lists/services/pricing-service.interface.ts` — and that file is
949
680
  * deliberately not in this package, because it is the target of the
950
681
  * feature-057 overlay decoration and moving it would move the contract gate.
@@ -953,6 +684,9 @@ export interface ProductDisplayModePort {
953
684
  * `price_lists` still satisfies it (D-77's rejected alternative, same
954
685
  * reasoning). `PricingServiceContract` is a superset and satisfies this
955
686
  * structurally, so no implementation changed.
687
+ *
688
+ * D-287 P0 left it as it was — a stub of it still compiles — and the external
689
+ * namespace, which now prices in batches, names `OrgLinePricePort & LinePricesPort`.
956
690
  */
957
691
  export interface OrgLinePricePort extends LinePricePort {
958
692
  /**
@@ -961,7 +695,7 @@ export interface OrgLinePricePort extends LinePricePort {
961
695
  * `resolveLinePrice` at each one to build the buying organisation's effective
962
696
  * tier ladder without re-implementing resolution.
963
697
  */
964
- listBracketMinQuantities(productId: string, currencyCode: string): Promise<number[]>;
698
+ listTierStarts(productId: string, currencyCode: string, variantId?: string | null): Promise<number[]>;
965
699
  }
966
700
  /** One line of a {@link BuyerLinePriceQuery}. */
967
701
  export interface BuyerLinePriceLine {
@@ -1034,31 +768,31 @@ export declare const PRICING_SETTING_CODES: {
1034
768
  readonly DEFAULT_DISPLAY_MODE: "pricing.default_display_mode";
1035
769
  readonly UNAUTHENTICATED_DISPLAY_MODE: "pricing.unauthenticated_display_mode";
1036
770
  };
1037
- /** A price list as a module outside `price_lists` sees it. */
771
+ /**
772
+ * A price book as a module outside `price_lists` sees it (feature 160: every
773
+ * price list is a price book; the base books are the `isSystem` ones).
774
+ */
1038
775
  export interface PriceListRecord {
1039
776
  id: string;
1040
- code: string;
1041
777
  name: string;
1042
- currency: string;
1043
- isDefault: boolean;
778
+ currencyCode: string;
1044
779
  priority: number;
1045
- type: 'base' | 'sale';
780
+ type: 'regular' | 'sale';
1046
781
  status: 'draft' | 'active' | 'scheduled' | 'expired';
782
+ audienceKind: 'everyone' | 'customer_groups' | 'organizations';
1047
783
  startsAt: Date | null;
1048
784
  endsAt: Date | null;
1049
- applicationRule: ApplicationRule;
1050
785
  isSystem: boolean;
1051
- modifiedAt: Date;
1052
786
  createdAt: Date;
1053
787
  updatedAt: Date;
1054
788
  }
1055
789
  /**
1056
790
  * Container name: `priceListReadPort`. Owner: `price_lists`.
1057
791
  *
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.
792
+ * `organizations` reads the books that apply to an org, `product_feeds` reads
793
+ * the book a feed prices from. Both read the row; neither should own the
794
+ * question of what "applies" means, which is why `listForOrganization` is here
795
+ * rather than a status filter in each caller.
1062
796
  *
1063
797
  * **Owner off:** the seam fails closed — resolving this port throws
1064
798
  * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
@@ -1069,106 +803,33 @@ export interface PriceListRecord {
1069
803
  export interface PriceListReadPort {
1070
804
  findById(id: string): Promise<PriceListRecord | null>;
1071
805
  findByIds(ids: readonly string[]): Promise<PriceListRecord[]>;
1072
- findByCode(code: string): Promise<PriceListRecord | null>;
1073
- /** Every list, ordered by priority then code. */
806
+ /** Every book, ordered by priority desc then name. */
1074
807
  listAll(): Promise<PriceListRecord[]>;
1075
- /** Only `status === 'active'`, ordered by priority then code. */
808
+ /** Only `status === 'active'`, ordered by priority desc then name. */
1076
809
  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
810
  /**
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).
811
+ * Feature 160 (FR-032) — the price books that apply to an organization now:
812
+ * those whose audience set holds the organization (`organization`, depth 0)
813
+ * or an ancestor of it (`ancestor`, its depth in the chain), and those whose
814
+ * audience set holds its customer group (`customer_group`). The caller
815
+ * passes the chain (nearest first) and the group, which are the
816
+ * organization's own facts. Ordered by priority desc, then name.
1138
817
  */
1139
- organizationChain?: readonly string[];
1140
- customerGroupId: string | null;
1141
- salesChannelId: string;
1142
- currencyCode: string;
1143
- productCategoryIds: ReadonlySet<string>;
818
+ listForOrganization(input: {
819
+ organizationChain: readonly string[];
820
+ customerGroupId: string | null;
821
+ }): Promise<OrganizationPriceBookRecord[]>;
1144
822
  }
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;
823
+ /** One book of {@link PriceListReadPort.listForOrganization}. */
824
+ export interface OrganizationPriceBookRecord {
825
+ id: string;
826
+ name: string;
827
+ type: 'regular' | 'sale';
828
+ currencyCode: string;
829
+ priority: number;
830
+ status: 'scheduled' | 'active';
831
+ reason: 'organization' | 'ancestor' | 'customer_group';
832
+ /** Chain depth of the nearest member; `null` for a customer-group book. */
833
+ depth: number | null;
1155
834
  }
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
835
  //# sourceMappingURL=price-lists.d.ts.map