@endora-commerce/contracts 0.106.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.
- package/dist/admin-contributions.d.ts +11 -6
- package/dist/admin-contributions.d.ts.map +1 -1
- package/dist/admin-contributions.js +9 -6
- package/dist/admin-contributions.js.map +1 -1
- package/dist/admin-feedback.d.ts +61 -0
- package/dist/admin-feedback.d.ts.map +1 -0
- package/dist/admin-feedback.js +71 -0
- package/dist/admin-feedback.js.map +1 -0
- package/dist/admin-name.d.ts +21 -0
- package/dist/admin-name.d.ts.map +1 -0
- package/dist/admin-name.js +30 -0
- package/dist/admin-name.js.map +1 -0
- package/dist/admin-roles.d.ts +32 -2
- package/dist/admin-roles.d.ts.map +1 -1
- package/dist/admin-roles.js +21 -1
- package/dist/admin-roles.js.map +1 -1
- package/dist/admin-search.d.ts +655 -0
- package/dist/admin-search.d.ts.map +1 -0
- package/dist/admin-search.js +179 -0
- package/dist/admin-search.js.map +1 -0
- package/dist/analytics.d.ts +5 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +8 -0
- package/dist/analytics.js.map +1 -1
- package/dist/api-keys.d.ts +6 -0
- package/dist/api-keys.d.ts.map +1 -1
- package/dist/api-keys.js +5 -0
- package/dist/api-keys.js.map +1 -1
- package/dist/assets-library.d.ts +102 -0
- package/dist/assets-library.d.ts.map +1 -1
- package/dist/assets-library.js +89 -0
- package/dist/assets-library.js.map +1 -1
- package/dist/auth.d.ts +20 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +20 -0
- package/dist/auth.js.map +1 -1
- package/dist/blog.d.ts +1 -1
- package/dist/carts.d.ts +218 -7
- package/dist/carts.d.ts.map +1 -1
- package/dist/carts.js +29 -0
- package/dist/carts.js.map +1 -1
- package/dist/catalog.d.ts +299 -14
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +136 -2
- package/dist/catalog.js.map +1 -1
- package/dist/cms.d.ts +183 -3
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +132 -1
- package/dist/cms.js.map +1 -1
- package/dist/common.d.ts +4 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +14 -0
- package/dist/common.js.map +1 -1
- package/dist/comparisons.d.ts +80 -0
- package/dist/comparisons.d.ts.map +1 -1
- package/dist/comparisons.js +24 -0
- package/dist/comparisons.js.map +1 -1
- package/dist/credentials.d.ts +23 -0
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +24 -0
- package/dist/credentials.js.map +1 -1
- package/dist/credit-limits.d.ts.map +1 -1
- package/dist/credit-limits.js +3 -2
- package/dist/credit-limits.js.map +1 -1
- package/dist/crm-rich-text.d.ts +64 -0
- package/dist/crm-rich-text.d.ts.map +1 -0
- package/dist/crm-rich-text.js +303 -0
- package/dist/crm-rich-text.js.map +1 -0
- package/dist/crm.d.ts +92 -2
- package/dist/crm.d.ts.map +1 -1
- package/dist/crm.js +49 -34
- package/dist/crm.js.map +1 -1
- package/dist/custom-fields.d.ts +417 -4
- package/dist/custom-fields.d.ts.map +1 -1
- package/dist/custom-fields.js +319 -10
- package/dist/custom-fields.js.map +1 -1
- package/dist/customer-accounts.d.ts +92 -2
- package/dist/customer-accounts.d.ts.map +1 -1
- package/dist/document-templates.d.ts +1368 -0
- package/dist/document-templates.d.ts.map +1 -0
- package/dist/document-templates.js +569 -0
- package/dist/document-templates.js.map +1 -0
- package/dist/document-values.d.ts +159 -0
- package/dist/document-values.d.ts.map +1 -0
- package/dist/document-values.js +220 -0
- package/dist/document-values.js.map +1 -0
- package/dist/errors.d.ts +122 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +172 -0
- package/dist/errors.js.map +1 -1
- package/dist/import-export.d.ts +11 -0
- package/dist/import-export.d.ts.map +1 -1
- package/dist/import-export.js +9 -0
- package/dist/import-export.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/invoice-ledger.d.ts +6 -6
- package/dist/invoices.d.ts +88 -0
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +19 -4
- package/dist/invoices.js.map +1 -1
- package/dist/line-groups.d.ts +80 -0
- package/dist/line-groups.d.ts.map +1 -0
- package/dist/line-groups.js +130 -0
- package/dist/line-groups.js.map +1 -0
- package/dist/localized-name.d.ts +20 -0
- package/dist/localized-name.d.ts.map +1 -0
- package/dist/localized-name.js +45 -0
- package/dist/localized-name.js.map +1 -0
- package/dist/mfa.d.ts +20 -0
- package/dist/mfa.d.ts.map +1 -1
- package/dist/modules.d.ts +20 -10
- package/dist/modules.d.ts.map +1 -1
- package/dist/money-decimal.d.ts +162 -0
- package/dist/money-decimal.d.ts.map +1 -0
- package/dist/money-decimal.js +365 -0
- package/dist/money-decimal.js.map +1 -0
- package/dist/money-input.d.ts +64 -0
- package/dist/money-input.d.ts.map +1 -0
- package/dist/money-input.js +111 -0
- package/dist/money-input.js.map +1 -0
- package/dist/newsletter.d.ts +2 -0
- package/dist/newsletter.d.ts.map +1 -1
- package/dist/newsletter.js +4 -0
- package/dist/newsletter.js.map +1 -1
- package/dist/order-minimums.d.ts +111 -0
- package/dist/order-minimums.d.ts.map +1 -0
- package/dist/order-minimums.js +196 -0
- package/dist/order-minimums.js.map +1 -0
- package/dist/orders.d.ts +212 -2
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +124 -21
- package/dist/orders.js.map +1 -1
- package/dist/organizations.d.ts +78 -0
- package/dist/organizations.d.ts.map +1 -1
- package/dist/organizations.js +54 -0
- package/dist/organizations.js.map +1 -1
- package/dist/payment-methods.d.ts +2 -2
- package/dist/payment-methods.d.ts.map +1 -1
- package/dist/payment-methods.js +2 -1
- package/dist/payment-methods.js.map +1 -1
- package/dist/price-book-decimal.d.ts +84 -0
- package/dist/price-book-decimal.d.ts.map +1 -0
- package/dist/price-book-decimal.js +175 -0
- package/dist/price-book-decimal.js.map +1 -0
- package/dist/price-books.d.ts +2206 -0
- package/dist/price-books.d.ts.map +1 -0
- package/dist/price-books.js +777 -0
- package/dist/price-books.js.map +1 -0
- package/dist/price-lists.d.ts +398 -248
- package/dist/price-lists.d.ts.map +1 -1
- package/dist/price-lists.js +136 -244
- package/dist/price-lists.js.map +1 -1
- package/dist/product-feeds.d.ts +102 -21
- package/dist/product-feeds.d.ts.map +1 -1
- package/dist/product-feeds.js +18 -1
- package/dist/product-feeds.js.map +1 -1
- package/dist/product-value-resolver.d.ts +6 -0
- package/dist/product-value-resolver.d.ts.map +1 -1
- package/dist/product-value-resolver.js +6 -1
- package/dist/product-value-resolver.js.map +1 -1
- package/dist/promotions.d.ts +2 -2
- package/dist/promotions.d.ts.map +1 -1
- package/dist/promotions.js +8 -2
- package/dist/promotions.js.map +1 -1
- package/dist/prompt-actions.d.ts +25 -6
- package/dist/prompt-actions.d.ts.map +1 -1
- package/dist/prompt-actions.js +17 -1
- package/dist/prompt-actions.js.map +1 -1
- package/dist/pwa.d.ts +25 -0
- package/dist/pwa.d.ts.map +1 -1
- package/dist/pwa.js +38 -0
- package/dist/pwa.js.map +1 -1
- package/dist/quick-order.d.ts +39 -0
- package/dist/quick-order.d.ts.map +1 -1
- package/dist/quick-order.js +43 -0
- package/dist/quick-order.js.map +1 -1
- package/dist/quote-requests.d.ts +903 -9
- package/dist/quote-requests.d.ts.map +1 -1
- package/dist/quote-requests.js +515 -8
- package/dist/quote-requests.js.map +1 -1
- package/dist/returns.d.ts +55 -2
- package/dist/returns.d.ts.map +1 -1
- package/dist/returns.js +39 -4
- package/dist/returns.js.map +1 -1
- package/dist/sales-channels.d.ts +48 -0
- package/dist/sales-channels.d.ts.map +1 -1
- package/dist/sales-channels.js +42 -0
- package/dist/sales-channels.js.map +1 -1
- package/dist/saved-list-views.d.ts +140 -0
- package/dist/saved-list-views.d.ts.map +1 -0
- package/dist/saved-list-views.js +108 -0
- package/dist/saved-list-views.js.map +1 -0
- package/dist/search.d.ts +66 -0
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +4 -0
- package/dist/search.js.map +1 -1
- package/dist/seo.d.ts +2 -0
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +11 -0
- package/dist/seo.js.map +1 -1
- package/dist/shipping-methods.d.ts +2 -2
- package/dist/shipping-methods.d.ts.map +1 -1
- package/dist/shipping-methods.js +2 -1
- package/dist/shipping-methods.js.map +1 -1
- package/dist/shopping-lists.d.ts +24 -0
- package/dist/shopping-lists.d.ts.map +1 -1
- package/dist/shopping-lists.js +20 -1
- package/dist/shopping-lists.js.map +1 -1
- package/dist/storefront-value-overrides.d.ts +67 -0
- package/dist/storefront-value-overrides.d.ts.map +1 -0
- package/dist/storefront-value-overrides.js +93 -0
- package/dist/storefront-value-overrides.js.map +1 -0
- package/package.json +1 -1
package/dist/price-lists.d.ts
CHANGED
|
@@ -1,112 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
draft: "draft";
|
|
32
|
-
active: "active";
|
|
33
|
-
expired: "expired";
|
|
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
|
-
draft: "draft";
|
|
46
|
-
active: "active";
|
|
47
|
-
expired: "expired";
|
|
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>;
|
|
2
|
+
import type { ProductResolvedPrice } from './catalog.js';
|
|
3
|
+
import { type PriceSource } from './price-books.js';
|
|
110
4
|
export declare const displayModeSchema: z.ZodEnum<{
|
|
111
5
|
both: "both";
|
|
112
6
|
none: "none";
|
|
@@ -114,6 +8,33 @@ export declare const displayModeSchema: z.ZodEnum<{
|
|
|
114
8
|
net_only: "net_only";
|
|
115
9
|
}>;
|
|
116
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
|
+
};
|
|
117
38
|
export declare const displayModeOverrideScopeSchema: z.ZodEnum<{
|
|
118
39
|
category: "category";
|
|
119
40
|
product: "product";
|
|
@@ -144,15 +65,20 @@ export declare const upsertDisplayModeOverrideRequestSchema: z.ZodObject<{
|
|
|
144
65
|
net_only: "net_only";
|
|
145
66
|
}>, z.ZodLiteral<"inherit">]>;
|
|
146
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
|
+
*/
|
|
147
73
|
export declare const resolvedPriceEngineSchema: z.ZodObject<{
|
|
148
|
-
baseListId: z.ZodString
|
|
149
|
-
basePrice: z.ZodObject<{
|
|
150
|
-
amount: z.
|
|
74
|
+
baseListId: z.ZodNullable<z.ZodString>;
|
|
75
|
+
basePrice: z.ZodNullable<z.ZodObject<{
|
|
76
|
+
amount: z.ZodString;
|
|
151
77
|
currency: z.ZodString;
|
|
152
|
-
}, z.core.$strip
|
|
78
|
+
}, z.core.$strip>>;
|
|
153
79
|
saleListId: z.ZodNullable<z.ZodString>;
|
|
154
80
|
salePrice: z.ZodNullable<z.ZodObject<{
|
|
155
|
-
amount: z.
|
|
81
|
+
amount: z.ZodString;
|
|
156
82
|
currency: z.ZodString;
|
|
157
83
|
}, z.core.$strip>>;
|
|
158
84
|
displayMode: z.ZodEnum<{
|
|
@@ -162,30 +88,43 @@ export declare const resolvedPriceEngineSchema: z.ZodObject<{
|
|
|
162
88
|
net_only: "net_only";
|
|
163
89
|
}>;
|
|
164
90
|
currencyCode: z.ZodString;
|
|
165
|
-
quantityBracket: z.ZodObject<{
|
|
91
|
+
quantityBracket: z.ZodNullable<z.ZodObject<{
|
|
166
92
|
minQuantity: z.ZodNumber;
|
|
167
93
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
168
|
-
}, 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>>;
|
|
169
106
|
}, z.core.$strip>;
|
|
170
107
|
export type ResolvedPriceEngine = z.infer<typeof resolvedPriceEngineSchema>;
|
|
171
108
|
/**
|
|
172
109
|
* What a catalogue listing may show as a product's price — issue #132.
|
|
173
110
|
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
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.
|
|
177
117
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* `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).
|
|
182
121
|
*
|
|
183
122
|
* The `none` arm carries **no `amount` field**, following the `ResolvedTax`
|
|
184
123
|
* precedent (issue #124): a listing showing nothing and a listing offering a
|
|
185
124
|
* free product are different pages, so a caller has to narrow on `source`
|
|
186
125
|
* before it can read a figure. A product priced at zero comes back as
|
|
187
|
-
* `{ source: 'price_list'
|
|
188
|
-
*
|
|
126
|
+
* `{ source: 'price_list', amount: '0.00' }` and renders as zero — `amount` is
|
|
127
|
+
* never a falsy sentinel for absence.
|
|
189
128
|
*
|
|
190
129
|
* As with `ResolvedTax`, "the `price_lists` module is absent" is deliberately
|
|
191
130
|
* not an arm: absence is not a value, and the port gate throws
|
|
@@ -197,10 +136,15 @@ export declare const listingPriceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
197
136
|
currency: z.ZodString;
|
|
198
137
|
priceListId: z.ZodString;
|
|
199
138
|
isSale: z.ZodBoolean;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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>;
|
|
204
148
|
}, z.core.$strip>, z.ZodObject<{
|
|
205
149
|
source: z.ZodLiteral<"none">;
|
|
206
150
|
}, z.core.$strip>], "source">;
|
|
@@ -270,18 +214,86 @@ export interface ListingPriceProduct {
|
|
|
270
214
|
* same reasoning {@link LinePricePort} states for a cart line.
|
|
271
215
|
*/
|
|
272
216
|
export interface ListingPricePort {
|
|
273
|
-
resolveListingPrices(input:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
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;
|
|
283
226
|
};
|
|
284
|
-
|
|
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>>;
|
|
285
297
|
}
|
|
286
298
|
/**
|
|
287
299
|
* The buying organisation, as a price resolution reads it: the id, which is a
|
|
@@ -403,7 +415,68 @@ export interface ListingPriceViewerContext {
|
|
|
403
415
|
organization?: PriceOrganization | null;
|
|
404
416
|
/** Feature 040 — a customer's direct group overrides the organisation's. */
|
|
405
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;
|
|
406
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* `?currency=` on a storefront catalogue read (issue #249): the currency the
|
|
446
|
+
* shopper selected, as an ISO 4217 code in any case, answered in upper case.
|
|
447
|
+
*
|
|
448
|
+
* A malformed value is the caller's bug and is refused. A well-formed one the
|
|
449
|
+
* sales channel does not offer is not — see {@link resolveListingCurrency}.
|
|
450
|
+
*/
|
|
451
|
+
export declare const listingCurrencyQuerySchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
452
|
+
/**
|
|
453
|
+
* The currency a catalogue read is priced in: the requested one when the sales
|
|
454
|
+
* channel offers it, otherwise the channel's default.
|
|
455
|
+
*
|
|
456
|
+
* Falling back rather than refusing is deliberate. The request comes from a
|
|
457
|
+
* shopper's stored preference, which outlives a channel dropping a currency;
|
|
458
|
+
* refusing would turn a stale cookie into a catalogue that will not render,
|
|
459
|
+
* while the default is a price the channel genuinely quotes — and every price
|
|
460
|
+
* on the wire names its currency, so the fallback is visible rather than a
|
|
461
|
+
* silent relabelling.
|
|
462
|
+
*/
|
|
463
|
+
export declare function resolveListingCurrency(requested: string | undefined, channel: {
|
|
464
|
+
defaultCurrency: string;
|
|
465
|
+
currencies: readonly string[];
|
|
466
|
+
}): string;
|
|
467
|
+
/**
|
|
468
|
+
* The channel half of a {@link ListingPriceViewerContext}, for a read priced in
|
|
469
|
+
* `currency` — the one place `catalog` and `search` turn the resolved currency
|
|
470
|
+
* into the ports' `currencyCode`.
|
|
471
|
+
*
|
|
472
|
+
* The channel's default stays implicit: a read in the default currency asks the
|
|
473
|
+
* port exactly what it asked before `currencyCode` was ever passed, and lands
|
|
474
|
+
* on the same pricing-cache entries.
|
|
475
|
+
*/
|
|
476
|
+
export declare function listingPriceChannelContext(channel: {
|
|
477
|
+
id: string;
|
|
478
|
+
defaultCurrency: string;
|
|
479
|
+
}, currency: string | undefined): Pick<ListingPriceViewerContext, 'salesChannel' | 'currencyCode'>;
|
|
407
480
|
export interface ListingPriceOrderQuery {
|
|
408
481
|
context: ListingPriceViewerContext;
|
|
409
482
|
direction: 'asc' | 'desc';
|
|
@@ -458,6 +531,13 @@ export interface ListingPriceOrderChunk {
|
|
|
458
531
|
* chunks rather than per chunk.
|
|
459
532
|
*/
|
|
460
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;
|
|
461
541
|
}
|
|
462
542
|
/** What a resolved line price is, once the whole chain has run. */
|
|
463
543
|
export interface LinePriceResult {
|
|
@@ -468,6 +548,13 @@ export interface LinePriceResult {
|
|
|
468
548
|
isSale: boolean;
|
|
469
549
|
bracketStartQuantity: number;
|
|
470
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;
|
|
471
558
|
}
|
|
472
559
|
/**
|
|
473
560
|
* Container name: `pricingService`. Owner: `price_lists`.
|
|
@@ -499,6 +586,8 @@ export interface LinePricePort {
|
|
|
499
586
|
organization?: PriceOrganization | null;
|
|
500
587
|
/** Feature 040 — a customer's direct group overrides the org's. */
|
|
501
588
|
customerGroupId?: string | null;
|
|
589
|
+
/** D-287 P0 — see {@link PricingBuyerContext}. */
|
|
590
|
+
customerAccountId?: string | null;
|
|
502
591
|
salesChannel: {
|
|
503
592
|
id: string;
|
|
504
593
|
defaultCurrency: string;
|
|
@@ -507,6 +596,70 @@ export interface LinePricePort {
|
|
|
507
596
|
};
|
|
508
597
|
}): Promise<LinePriceResult | null>;
|
|
509
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
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Container name: `productDisplayModePort`. Owner: `price_lists`.
|
|
638
|
+
*
|
|
639
|
+
* Whether — and how — a product's price is shown to one viewer, resolved
|
|
640
|
+
* **without** a price: the Product → Category → Organization → Settings chain
|
|
641
|
+
* the storefront's `GET /pricing/display-mode/:productId` answers with. `none`
|
|
642
|
+
* means the product is sold on request only.
|
|
643
|
+
*
|
|
644
|
+
* Published for `carts` (issue #236). A cart line read the display mode off the
|
|
645
|
+
* resolved list price, so a product no price list holds — priced from the
|
|
646
|
+
* catalogue attribute — resolved nothing, and a product sold on request only
|
|
647
|
+
* was added. `LinePricePort.resolveLinePrice` answers `null` there by design,
|
|
648
|
+
* and widening that answer would break every structural stub of it; a caller
|
|
649
|
+
* that needs the mode on its own asks for it by name.
|
|
650
|
+
*
|
|
651
|
+
* **Owner off:** the seam fails closed, like `LinePricePort`'s — resolving the
|
|
652
|
+
* port throws `ModuleDisabledError`. A cart that cannot ask must not assume the
|
|
653
|
+
* product is purchasable.
|
|
654
|
+
*/
|
|
655
|
+
export interface ProductDisplayModePort {
|
|
656
|
+
resolveDisplayMode(input: {
|
|
657
|
+
productId: string;
|
|
658
|
+
organizationId: string | null;
|
|
659
|
+
salesChannelId: string;
|
|
660
|
+
customerKind: 'guest' | 'signed_in';
|
|
661
|
+
}): Promise<DisplayMode>;
|
|
662
|
+
}
|
|
510
663
|
/**
|
|
511
664
|
* Container name: `pricingService`. Owner: `price_lists`.
|
|
512
665
|
*
|
|
@@ -522,7 +675,7 @@ export interface LinePricePort {
|
|
|
522
675
|
* A caller that needs both asks for both by name.
|
|
523
676
|
*
|
|
524
677
|
* It had to be published somewhere for feature 075's `catalog` cut, because
|
|
525
|
-
* `listBracketMinQuantities` was declared **only** on
|
|
678
|
+
* `listBracketMinQuantities` (`listTierStarts` since feature 160) was declared **only** on
|
|
526
679
|
* `price_lists/services/pricing-service.interface.ts` — and that file is
|
|
527
680
|
* deliberately not in this package, because it is the target of the
|
|
528
681
|
* feature-057 overlay decoration and moving it would move the contract gate.
|
|
@@ -531,6 +684,9 @@ export interface LinePricePort {
|
|
|
531
684
|
* `price_lists` still satisfies it (D-77's rejected alternative, same
|
|
532
685
|
* reasoning). `PricingServiceContract` is a superset and satisfies this
|
|
533
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`.
|
|
534
690
|
*/
|
|
535
691
|
export interface OrgLinePricePort extends LinePricePort {
|
|
536
692
|
/**
|
|
@@ -539,37 +695,104 @@ export interface OrgLinePricePort extends LinePricePort {
|
|
|
539
695
|
* `resolveLinePrice` at each one to build the buying organisation's effective
|
|
540
696
|
* tier ladder without re-implementing resolution.
|
|
541
697
|
*/
|
|
542
|
-
|
|
698
|
+
listTierStarts(productId: string, currencyCode: string, variantId?: string | null): Promise<number[]>;
|
|
699
|
+
}
|
|
700
|
+
/** One line of a {@link BuyerLinePriceQuery}. */
|
|
701
|
+
export interface BuyerLinePriceLine {
|
|
702
|
+
/** Caller's correlation key, echoed back. */
|
|
703
|
+
key: string;
|
|
704
|
+
productId: string;
|
|
705
|
+
variantId?: string | null;
|
|
706
|
+
/**
|
|
707
|
+
* In base pieces, the unit every quote line's quantity is in. The caller
|
|
708
|
+
* never multiplies by a packaging unit's base quantity.
|
|
709
|
+
*/
|
|
710
|
+
quantity: number;
|
|
711
|
+
}
|
|
712
|
+
/** "What does this buyer pay for these lines on this channel, now?" */
|
|
713
|
+
export interface BuyerLinePriceQuery {
|
|
714
|
+
buyer: {
|
|
715
|
+
customerAccountId: string | null;
|
|
716
|
+
organizationId: string | null;
|
|
717
|
+
};
|
|
718
|
+
/** `null` = the system-default channel (requests raised before channel attribution). */
|
|
719
|
+
salesChannelId: string | null;
|
|
720
|
+
/** Absent = the channel's default currency. */
|
|
721
|
+
currencyCode?: string;
|
|
722
|
+
lines: readonly BuyerLinePriceLine[];
|
|
723
|
+
}
|
|
724
|
+
/** The answer for one line, keyed by the caller's `key`. */
|
|
725
|
+
export interface BuyerLinePriceAnswer {
|
|
726
|
+
key: string;
|
|
727
|
+
/** `null` = nothing applies ("no price"), the resolver's own documented answer. */
|
|
728
|
+
price: {
|
|
729
|
+
amount: string;
|
|
730
|
+
currency: string;
|
|
731
|
+
isSale: boolean;
|
|
732
|
+
priceListId: string;
|
|
733
|
+
} | null;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Container name: `buyerLinePricePort`. Owner: `price_lists`.
|
|
737
|
+
*
|
|
738
|
+
* The net unit price a buyer would pay for each line on a normal order, on a
|
|
739
|
+
* given channel, now — the question the admin resolved-price probe answers for
|
|
740
|
+
* one product, asked for many. One implementation serves both, so a quote's
|
|
741
|
+
* "price at request" and its "current price" are the same question at two
|
|
742
|
+
* moments (feature 146). Customer group precedence: the account's
|
|
743
|
+
* `customerGroupId`, else the organization's.
|
|
744
|
+
*
|
|
745
|
+
* A product that does not exist answers `price: null` for its line rather than
|
|
746
|
+
* throwing; an unknown `salesChannelId` throws `HttpError(400, VALIDATION_FAILED)`.
|
|
747
|
+
* The implementation resolves in bounded chunks, and callers send lines in
|
|
748
|
+
* chunks.
|
|
749
|
+
*
|
|
750
|
+
* **No authority check**: the caller passes the owner of a quote request it
|
|
751
|
+
* has already authorised. The HTTP probe, which serves arbitrary admin input,
|
|
752
|
+
* carries the sales-representative scope check itself. When both
|
|
753
|
+
* `buyer.customerAccountId` and `buyer.organizationId` are given, the account
|
|
754
|
+
* must belong to that organization, else `HttpError(400, VALIDATION_FAILED)`.
|
|
755
|
+
*
|
|
756
|
+
* A separate port rather than a widening of {@link LinePricePort}, for the
|
|
757
|
+
* reason {@link OrgLinePricePort} states: widening would break every
|
|
758
|
+
* structural stub of the old one.
|
|
759
|
+
*
|
|
760
|
+
* **Owner off:** `price_lists` is `nonDeactivatable`; the gate is still the
|
|
761
|
+
* registration, so a change to that throws `ModuleDisabledError` at the call
|
|
762
|
+
* site.
|
|
763
|
+
*/
|
|
764
|
+
export interface BuyerLinePricePort {
|
|
765
|
+
resolveForBuyer(query: BuyerLinePriceQuery): Promise<BuyerLinePriceAnswer[]>;
|
|
543
766
|
}
|
|
544
767
|
export declare const PRICING_SETTING_CODES: {
|
|
545
768
|
readonly DEFAULT_DISPLAY_MODE: "pricing.default_display_mode";
|
|
546
769
|
readonly UNAUTHENTICATED_DISPLAY_MODE: "pricing.unauthenticated_display_mode";
|
|
547
770
|
};
|
|
548
|
-
/**
|
|
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
|
+
*/
|
|
549
775
|
export interface PriceListRecord {
|
|
550
776
|
id: string;
|
|
551
|
-
code: string;
|
|
552
777
|
name: string;
|
|
553
|
-
|
|
554
|
-
isDefault: boolean;
|
|
778
|
+
currencyCode: string;
|
|
555
779
|
priority: number;
|
|
556
|
-
type: '
|
|
780
|
+
type: 'regular' | 'sale';
|
|
557
781
|
status: 'draft' | 'active' | 'scheduled' | 'expired';
|
|
782
|
+
audienceKind: 'everyone' | 'customer_groups' | 'organizations';
|
|
558
783
|
startsAt: Date | null;
|
|
559
784
|
endsAt: Date | null;
|
|
560
|
-
applicationRule: ApplicationRule;
|
|
561
785
|
isSystem: boolean;
|
|
562
|
-
modifiedAt: Date;
|
|
563
786
|
createdAt: Date;
|
|
564
787
|
updatedAt: Date;
|
|
565
788
|
}
|
|
566
789
|
/**
|
|
567
790
|
* Container name: `priceListReadPort`. Owner: `price_lists`.
|
|
568
791
|
*
|
|
569
|
-
* `organizations`
|
|
570
|
-
* the
|
|
571
|
-
* question of what "
|
|
572
|
-
* 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.
|
|
573
796
|
*
|
|
574
797
|
* **Owner off:** the seam fails closed — resolving this port throws
|
|
575
798
|
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
@@ -580,106 +803,33 @@ export interface PriceListRecord {
|
|
|
580
803
|
export interface PriceListReadPort {
|
|
581
804
|
findById(id: string): Promise<PriceListRecord | null>;
|
|
582
805
|
findByIds(ids: readonly string[]): Promise<PriceListRecord[]>;
|
|
583
|
-
|
|
584
|
-
/** Every list, ordered by priority then code. */
|
|
806
|
+
/** Every book, ordered by priority desc then name. */
|
|
585
807
|
listAll(): Promise<PriceListRecord[]>;
|
|
586
|
-
/** Only `status === 'active'`, ordered by priority then
|
|
808
|
+
/** Only `status === 'active'`, ordered by priority desc then name. */
|
|
587
809
|
listActive(): Promise<PriceListRecord[]>;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* One quantity bracket of a product's price on a list.
|
|
591
|
-
*
|
|
592
|
-
* `amount` is a decimal **string** — the storage shape on
|
|
593
|
-
* `price_list_price_brackets`. A `number` cannot round-trip a price, and this
|
|
594
|
-
* value comes in from a PIM import and goes out to a checkout.
|
|
595
|
-
*/
|
|
596
|
-
export interface PriceBracketInput {
|
|
597
|
-
minQuantity: number;
|
|
598
|
-
maxQuantity: number | null;
|
|
599
|
-
amount: string;
|
|
600
|
-
}
|
|
601
|
-
/** One list's brackets for a product, as the admin summary renders them. */
|
|
602
|
-
export interface PriceListBracketSummary {
|
|
603
|
-
list: {
|
|
604
|
-
id: string;
|
|
605
|
-
name: string;
|
|
606
|
-
type: 'base' | 'sale';
|
|
607
|
-
status: 'draft' | 'active' | 'scheduled' | 'expired';
|
|
608
|
-
modifiedAt: Date;
|
|
609
|
-
};
|
|
610
|
-
summary: Array<{
|
|
611
|
-
currencyCode: string;
|
|
612
|
-
summary: string;
|
|
613
|
-
}>;
|
|
614
|
-
deepLinkPath: string;
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Container name: `priceListAdminPort`. Owner: `price_lists`.
|
|
618
|
-
*
|
|
619
|
-
* `pim_ergonode` writes prices as part of an import run: it resolves the list,
|
|
620
|
-
* adds the product to it if it is not there, replaces the brackets, and reads
|
|
621
|
-
* back the summary its field-protection rules compare against. That is the
|
|
622
|
-
* whole of what it needs, and publishing more would be publishing the class.
|
|
623
|
-
*
|
|
624
|
-
* **Owner off:** the seam fails closed — resolving this port throws
|
|
625
|
-
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
626
|
-
* half-executes. Whether `price_lists` has an off state at all is its manifest's
|
|
627
|
-
* `activation` to say, not this line's: a module declaring
|
|
628
|
-
* `nonDeactivatable` never enters one.
|
|
629
|
-
*/
|
|
630
|
-
export interface PriceListAdminPort {
|
|
631
|
-
getById(id: string): Promise<PriceListRecord>;
|
|
632
|
-
listProducts(priceListId: string): Promise<Array<{
|
|
633
|
-
productId: string;
|
|
634
|
-
bracketsByCurrency: Record<string, PriceBracketInput[]>;
|
|
635
|
-
}>>;
|
|
636
|
-
addProduct(priceListId: string, productId: string): Promise<void>;
|
|
637
|
-
replaceBrackets(priceListId: string, productId: string, bracketsByCurrency: Record<string, readonly PriceBracketInput[]>): Promise<Record<string, PriceBracketInput[]>>;
|
|
638
|
-
summarizeBracketsForProduct(productId: string): Promise<PriceListBracketSummary[]>;
|
|
639
|
-
}
|
|
640
|
-
/** What a rule is evaluated against. */
|
|
641
|
-
export interface PriceListResolutionContext {
|
|
642
|
-
organizationId: string | null;
|
|
643
810
|
/**
|
|
644
|
-
* Feature
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
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.
|
|
649
817
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
productCategoryIds: ReadonlySet<string>;
|
|
818
|
+
listForOrganization(input: {
|
|
819
|
+
organizationChain: readonly string[];
|
|
820
|
+
customerGroupId: string | null;
|
|
821
|
+
}): Promise<OrganizationPriceBookRecord[]>;
|
|
655
822
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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;
|
|
666
834
|
}
|
|
667
|
-
/**
|
|
668
|
-
* Pure rule evaluator (feature 011 / FR-022, FR-023, FR-026, FR-029).
|
|
669
|
-
*
|
|
670
|
-
* Walks the discriminated-union AST and returns:
|
|
671
|
-
* - `matched`: the overall AST truth value against the resolution context.
|
|
672
|
-
* - `explicitOn`: the criterion types that contributed to the match AND had
|
|
673
|
-
* non-empty value lists. The resolver's priority chain consults this to
|
|
674
|
-
* award the per-step boost (FR-026 steps 1..4).
|
|
675
|
-
*
|
|
676
|
-
* Notes:
|
|
677
|
-
* - The `category` criterion is product-driven (FR-029): it matches when the
|
|
678
|
-
* product belongs to any category named in the rule's value list.
|
|
679
|
-
* - The `currency` criterion never appears in the priority chain even when
|
|
680
|
-
* explicit; it is purely a matching criterion.
|
|
681
|
-
* - `{ kind: 'all' }` and any criterion with `values: []` are treated as
|
|
682
|
-
* always-true and contribute nothing to `explicitOn` (FR-022).
|
|
683
|
-
*/
|
|
684
|
-
export declare function evaluateApplicationRule(rule: ApplicationRule, ctx: PriceListResolutionContext): PriceListRuleEvaluation;
|
|
685
835
|
//# sourceMappingURL=price-lists.d.ts.map
|