@flowselections/floriday-voorraad 1.0.52 → 1.0.54
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-lib/components/voorraad/ArtikelWizard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ArtikelWizard.js +2 -1
- package/dist-lib/components/voorraad/InventoryStatusBadge.d.ts.map +1 -1
- package/dist-lib/components/voorraad/InventoryStatusBadge.js +1 -1
- package/dist-lib/components/voorraad/ProductStructureCard.d.ts +8 -0
- package/dist-lib/components/voorraad/ProductStructureCard.d.ts.map +1 -0
- package/dist-lib/components/voorraad/ProductStructureCard.js +145 -0
- package/dist-lib/components/voorraad/StockPushMonitor.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockPushMonitor.js +8 -0
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.js +5 -1
- package/dist-lib/hooks/useInventorySettings.d.ts +1 -0
- package/dist-lib/hooks/useInventorySettings.d.ts.map +1 -1
- package/dist-lib/hooks/useInventorySettings.js +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +373 -1
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/base-supply-reader.server.d.ts +11 -0
- package/dist-lib/lib/base-supply-reader.server.d.ts.map +1 -1
- package/dist-lib/lib/base-supply-reader.server.js +51 -0
- package/dist-lib/lib/product-types.d.ts +14 -0
- package/dist-lib/lib/product-types.d.ts.map +1 -0
- package/dist-lib/lib/product-types.js +54 -0
- package/dist-lib/lib/stock-modes.d.ts.map +1 -1
- package/dist-lib/lib/stock-modes.js +6 -0
- package/package.json +1 -1
|
@@ -25,4 +25,15 @@ export declare function readBaseSupplyWeeks(weeks: Array<{
|
|
|
25
25
|
year: number;
|
|
26
26
|
week: number;
|
|
27
27
|
}>): Promise<ReaderOutput>;
|
|
28
|
+
export type AvailabilityOutput = {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
httpStatus: number | null;
|
|
31
|
+
rows: number;
|
|
32
|
+
error: string | null;
|
|
33
|
+
rateLimited: boolean;
|
|
34
|
+
retryAfterMs: number | null;
|
|
35
|
+
map: Map<string, boolean>;
|
|
36
|
+
};
|
|
37
|
+
/** Eén leesverzoek GET /trade-items/availabilities via floriday-get. */
|
|
38
|
+
export declare function readAvailabilities(): Promise<AvailabilityOutput>;
|
|
28
39
|
//# sourceMappingURL=base-supply-reader.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-supply-reader.server.d.ts","sourceRoot":"","sources":["../../src/lib/base-supply-reader.server.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnE,IAAI,EAAE,KAAK,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACnF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACxE,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACxE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;CACpE,CAAC;AAwCF,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,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AC;IAC3E,WAAW,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3B,CAAC;AAEF,wEAAwE;AACxE,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CA4CtE"}
|
|
@@ -113,3 +113,54 @@ export async function readBaseSupplyWeeks(weeks) {
|
|
|
113
113
|
}
|
|
114
114
|
return { endpoint, environment, httpStatus: lastHttp, results, error: routeError, missingScope };
|
|
115
115
|
}
|
|
116
|
+
/** Eén leesverzoek GET /trade-items/availabilities via floriday-get. */
|
|
117
|
+
export async function readAvailabilities() {
|
|
118
|
+
const central = await import("./centralSecrets.server");
|
|
119
|
+
const endpoint = `${(await central.getShellHost()).replace(/\/$/, "")}${PATH}`;
|
|
120
|
+
const secret = await central.getFloridayGatewaySecret();
|
|
121
|
+
const call = async () => {
|
|
122
|
+
const raw = JSON.stringify({ requests: [{ path: "/trade-items/availabilities" }] });
|
|
123
|
+
const ts = Date.now().toString();
|
|
124
|
+
const sig = await hmacHex(secret, `${ts}.${raw}`);
|
|
125
|
+
const res = await fetch(endpoint, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: { "Content-Type": "application/json", "x-floriday-timestamp": ts,
|
|
128
|
+
"x-floriday-signature": `sha256=${sig}`, "x-floriday-caller": "voorraad" },
|
|
129
|
+
body: raw,
|
|
130
|
+
});
|
|
131
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
132
|
+
const json = ct.includes("application/json") ? await res.json().catch(() => null) : null;
|
|
133
|
+
return { res, json };
|
|
134
|
+
};
|
|
135
|
+
let rateLimited = false;
|
|
136
|
+
let retryAfterMs = null;
|
|
137
|
+
let a = await call();
|
|
138
|
+
let item = a.json?.results?.[0];
|
|
139
|
+
if (a.res.status === 429 || item?.status === 429) {
|
|
140
|
+
rateLimited = true;
|
|
141
|
+
retryAfterMs = Number(item?.retryAfterMs ?? MIN_INTERVAL_MS) || MIN_INTERVAL_MS;
|
|
142
|
+
await sleep(Math.max(MIN_INTERVAL_MS, Math.min(retryAfterMs, MAX_RETRY_WAIT_MS)));
|
|
143
|
+
a = await call();
|
|
144
|
+
item = a.json?.results?.[0];
|
|
145
|
+
}
|
|
146
|
+
const fail = (error, status) => ({ ok: false, httpStatus: status, rows: 0, error, rateLimited, retryAfterMs, map: new Map() });
|
|
147
|
+
if (!a.json)
|
|
148
|
+
return fail(`geen JSON-antwoord van ${endpoint} (status ${a.res.status})`, a.res.status);
|
|
149
|
+
if (!item)
|
|
150
|
+
return fail(String(a.json?.error ?? "geen resultaat in antwoord"), a.res.status);
|
|
151
|
+
if (!item.ok)
|
|
152
|
+
return fail(typeof item.error === "string" ? item.error : JSON.stringify(item.error ?? "onbekende fout"), item.status ?? a.res.status);
|
|
153
|
+
const d = item.data;
|
|
154
|
+
const list = Array.isArray(d) ? d : Array.isArray(d?.results) ? d.results : Array.isArray(d?.items) ? d.items : null;
|
|
155
|
+
if (!list)
|
|
156
|
+
return fail("onbekende antwoordvorm van availabilities", item.status ?? 200);
|
|
157
|
+
const map = new Map();
|
|
158
|
+
for (const r of list) {
|
|
159
|
+
if (!r?.tradeItemId)
|
|
160
|
+
continue;
|
|
161
|
+
const v = r.isAvailable ?? r.available;
|
|
162
|
+
if (typeof v === "boolean")
|
|
163
|
+
map.set(String(r.tradeItemId), v);
|
|
164
|
+
}
|
|
165
|
+
return { ok: true, httpStatus: item.status ?? 200, rows: list.length, error: null, rateLimited, retryAfterMs, map };
|
|
166
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Eén gedeelde set labels en uitleg per producttype (NORMAL / GROUP / SET). */
|
|
2
|
+
export type StructureType = "NORMAL" | "GROUP" | "SET" | "UNKNOWN";
|
|
3
|
+
export declare const PRODUCT_TYPE_LABELS: Record<StructureType, string>;
|
|
4
|
+
export declare const PRODUCT_TYPE_HELP: Record<StructureType, string>;
|
|
5
|
+
export declare const PRODUCT_TYPE_CLASSES: Record<StructureType, string>;
|
|
6
|
+
export declare function toStructureType(v: string | null | undefined, fallback?: string | null): StructureType;
|
|
7
|
+
/** Echte reden waarom de Floriday-stand (nog) niet is doorgegeven, of null als het doorgegeven is. */
|
|
8
|
+
export declare function floridayPendingReason(input: {
|
|
9
|
+
actionReason?: string | null;
|
|
10
|
+
lastQueueStatus?: string | null;
|
|
11
|
+
lastSkipReason?: string | null;
|
|
12
|
+
lastError?: string | null;
|
|
13
|
+
}): string | null;
|
|
14
|
+
//# sourceMappingURL=product-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-types.d.ts","sourceRoot":"","sources":["../../src/lib/product-types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAK7D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAM3D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAK9D,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,aAAa,CAMrG;AAED,sGAAsG;AACtG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,MAAM,GAAG,IAAI,CAsBhB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const PRODUCT_TYPE_LABELS = {
|
|
2
|
+
NORMAL: "Artikel",
|
|
3
|
+
GROUP: "Productgroep",
|
|
4
|
+
SET: "Samenstelling",
|
|
5
|
+
UNKNOWN: "Onbekend type",
|
|
6
|
+
};
|
|
7
|
+
export const PRODUCT_TYPE_HELP = {
|
|
8
|
+
NORMAL: "Eén op één in Floriday, met eigen voorraad.",
|
|
9
|
+
GROUP: "Meerdere (bijna) gelijke artikelen die in Floriday als één artikel staan. De voorraad is de som van de leden; de leden staan niet los in Floriday.",
|
|
10
|
+
SET: "Set uit losse artikelen. De voorraad wordt berekend uit de onderdelen; de onderdelen blijven ook los te koop.",
|
|
11
|
+
UNKNOWN: "Het type kon niet worden bepaald.",
|
|
12
|
+
};
|
|
13
|
+
export const PRODUCT_TYPE_CLASSES = {
|
|
14
|
+
NORMAL: "",
|
|
15
|
+
GROUP: "bg-indigo-500/15 text-indigo-700 border-indigo-500/30",
|
|
16
|
+
SET: "bg-emerald-500/15 text-emerald-700 border-emerald-500/30",
|
|
17
|
+
UNKNOWN: "bg-muted text-muted-foreground border-border",
|
|
18
|
+
};
|
|
19
|
+
export function toStructureType(v, fallback) {
|
|
20
|
+
const s = (v ?? "").toUpperCase();
|
|
21
|
+
if (s === "NORMAL" || s === "GROUP" || s === "SET")
|
|
22
|
+
return s;
|
|
23
|
+
if (fallback === "productgroep")
|
|
24
|
+
return "GROUP";
|
|
25
|
+
if (fallback === "samenstelling")
|
|
26
|
+
return "SET";
|
|
27
|
+
return v ? "UNKNOWN" : "NORMAL";
|
|
28
|
+
}
|
|
29
|
+
/** Echte reden waarom de Floriday-stand (nog) niet is doorgegeven, of null als het doorgegeven is. */
|
|
30
|
+
export function floridayPendingReason(input) {
|
|
31
|
+
const { actionReason, lastQueueStatus, lastSkipReason, lastError } = input;
|
|
32
|
+
if (actionReason === "GROUP_MEMBER_OFF")
|
|
33
|
+
return "Lid van een productgroep: staat bewust niet los in Floriday";
|
|
34
|
+
if (actionReason === "SET_AWAITS_LOGISTICS")
|
|
35
|
+
return "Samenstelling: berekend, maar nog niet naar Floriday tot de Logistieke engine de onderdelen reserveert";
|
|
36
|
+
if (actionReason)
|
|
37
|
+
return `Actie nodig: ${actionReason}`;
|
|
38
|
+
switch (lastQueueStatus) {
|
|
39
|
+
case "sent":
|
|
40
|
+
case "superseded":
|
|
41
|
+
case undefined:
|
|
42
|
+
case null:
|
|
43
|
+
return null;
|
|
44
|
+
case "skipped_no_price":
|
|
45
|
+
return lastSkipReason || "Prijs ontbreekt, nog niet verzonden";
|
|
46
|
+
case "skipped_no_warehouse":
|
|
47
|
+
return lastSkipReason || "Geen voorkeursmagazijn; kies er een op de Connectie-pagina";
|
|
48
|
+
case "pending":
|
|
49
|
+
case "processing":
|
|
50
|
+
return "Wordt doorgegeven aan Floriday";
|
|
51
|
+
default:
|
|
52
|
+
return lastError || `Status: ${lastQueueStatus}`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stock-modes.d.ts","sourceRoot":"","sources":["../../src/lib/stock-modes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,0EAA2E,CAAC;AACpG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stock-modes.d.ts","sourceRoot":"","sources":["../../src/lib/stock-modes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,0EAA2E,CAAC;AACpG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASvD,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGtF"}
|
|
@@ -13,6 +13,12 @@ export const MODE_LABELS = {
|
|
|
13
13
|
export const ACTION_REASON_LABELS = {
|
|
14
14
|
NO_PACKING: "Verpakking ontbreekt (aantal per fust)",
|
|
15
15
|
NO_STOCK_ROW: "Geen voorraadregel gevonden",
|
|
16
|
+
GROUP_MEMBER_OFF: "Lid van een productgroep: niet los in Floriday, de groep wordt gepubliceerd",
|
|
17
|
+
SET_AWAITS_LOGISTICS: "Samenstelling: berekend, nog niet naar Floriday tot de Logistieke engine onderdelen reserveert",
|
|
18
|
+
CYCLE: "Lus in de samenstelling",
|
|
19
|
+
DEPTH_EXCEEDED: "Samenstelling te diep genest (maximaal 3)",
|
|
20
|
+
CONFLICTING_TYPE: "Tegenstrijdig producttype",
|
|
21
|
+
MEMBER_IN_MULTIPLE_GROUPS: "Lid zit in meer dan één actieve groep",
|
|
16
22
|
};
|
|
17
23
|
/** "Gepubliceerd: 288 (12 verpakkingen van 24)" */
|
|
18
24
|
export function publishedLabel(qty, packing) {
|