@kevludwig/eve-lexware-office 0.1.0 → 0.1.1
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.
|
@@ -93,7 +93,12 @@ export declare function runPurchasePreflight(input: PurchaseInput, options?: {
|
|
|
93
93
|
category: PostingCategory | null;
|
|
94
94
|
groupCategories: Array<PostingCategory | null> | null;
|
|
95
95
|
}>;
|
|
96
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Per-group categories when a group names one, otherwise the single pick.
|
|
98
|
+
* Group categories face the same deviation check against the vendor's usual
|
|
99
|
+
* ones as the single pick — otherwise a category moved into a group would
|
|
100
|
+
* skip it.
|
|
101
|
+
*/
|
|
97
102
|
export declare function resolveCategories(input: PurchaseInput, contactId: string | undefined, signal?: AbortSignal): Promise<{
|
|
98
103
|
category: PostingCategory | null;
|
|
99
104
|
groupCategories: Array<PostingCategory | null> | null;
|
|
@@ -178,6 +178,10 @@ async function resolveCategories(input, contactId, signal) {
|
|
|
178
178
|
...await pickCategory(input, contactId, signal),
|
|
179
179
|
groupCategories: null
|
|
180
180
|
};
|
|
181
|
+
let usual = [];
|
|
182
|
+
if (contactId) try {
|
|
183
|
+
usual = (await findVendorCategoryHistory(client(), contactId, { signal })).categories;
|
|
184
|
+
} catch {}
|
|
181
185
|
const warnings = [];
|
|
182
186
|
const resolved = [];
|
|
183
187
|
for (const [index, group] of groups.entries()) {
|
|
@@ -201,6 +205,14 @@ async function resolveCategories(input, contactId, signal) {
|
|
|
201
205
|
resolved.push(null);
|
|
202
206
|
}
|
|
203
207
|
}
|
|
208
|
+
if (usual.length > 0) {
|
|
209
|
+
const deviating = new Set(resolved.flatMap((match) => match && !usual.some((category) => category.id === match.id) ? [match.name] : []));
|
|
210
|
+
for (const name of deviating) warnings.push({
|
|
211
|
+
kind: "category-deviation",
|
|
212
|
+
chosen: name,
|
|
213
|
+
usual: usual.map((category) => category.name).join(", ")
|
|
214
|
+
});
|
|
215
|
+
}
|
|
204
216
|
return {
|
|
205
217
|
category: null,
|
|
206
218
|
groupCategories: resolved,
|