@flowselections/floriday-voorraad 1.0.22 → 1.0.26
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/assets/floriday-logo.png.asset.json +4 -4
- package/dist-lib/components/voorraad/ArtikelWizard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ArtikelWizard.js +655 -93
- package/dist-lib/components/voorraad/FloridayInfoCard.d.ts +12 -0
- package/dist-lib/components/voorraad/FloridayInfoCard.d.ts.map +1 -0
- package/dist-lib/components/voorraad/FloridayInfoCard.js +85 -0
- package/dist-lib/components/voorraad/StepSamenstelling.d.ts +10 -0
- package/dist-lib/components/voorraad/StepSamenstelling.d.ts.map +1 -0
- package/dist-lib/components/voorraad/StepSamenstelling.js +333 -0
- package/dist-lib/components/voorraad/VoorraadPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadPage.js +14 -3
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.js +8 -1
- package/dist-lib/hooks/useFloridayPriceGroups.d.ts +20 -0
- package/dist-lib/hooks/useFloridayPriceGroups.d.ts.map +1 -0
- package/dist-lib/hooks/useFloridayPriceGroups.js +55 -0
- package/dist-lib/hooks/useFloridayVbnRequired.d.ts +5 -0
- package/dist-lib/hooks/useFloridayVbnRequired.d.ts.map +1 -0
- package/dist-lib/hooks/useFloridayVbnRequired.js +16 -0
- package/dist-lib/hooks/useLocalTradeItems.d.ts.map +1 -1
- package/dist-lib/hooks/useLocalTradeItems.js +14 -0
- package/dist-lib/hooks/useTradeItemSpec.d.ts.map +1 -1
- package/dist-lib/hooks/useTradeItemSpec.js +48 -1
- package/dist-lib/hooks/useVoorraadData.d.ts.map +1 -1
- package/dist-lib/hooks/useVoorraadData.js +36 -5
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +2388 -345
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +2388 -345
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +2388 -345
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +2437 -343
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +11 -9
- package/dist-lib/lib/centralSecrets.server.d.ts +21 -0
- package/dist-lib/lib/centralSecrets.server.d.ts.map +1 -0
- package/dist-lib/lib/centralSecrets.server.js +111 -0
- package/dist-lib/lib/floricode-required-features.functions.d.ts +2388 -345
- package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-client.d.ts +4 -0
- package/dist-lib/lib/floriday-client.d.ts.map +1 -1
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts +2388 -345
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.functions.d.ts +10860 -645
- package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.server.js +34 -9
- package/dist-lib/lib/floriday-info.d.ts +54 -0
- package/dist-lib/lib/floriday-info.d.ts.map +1 -0
- package/dist-lib/lib/floriday-info.js +114 -0
- package/dist-lib/lib/floriday-payload.d.ts +21 -3
- package/dist-lib/lib/floriday-payload.d.ts.map +1 -1
- package/dist-lib/lib/floriday-payload.js +167 -34
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts +27769 -0
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday-vbn-required.functions.js +85 -0
- package/dist-lib/lib/floriday-warehouse.functions.d.ts +6602 -473
- package/dist-lib/lib/floriday-warehouse.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +4681 -594
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.js +36 -1
- package/dist-lib/lib/trade-item-prices.d.ts +43 -0
- package/dist-lib/lib/trade-item-prices.d.ts.map +1 -0
- package/dist-lib/lib/trade-item-prices.js +229 -0
- package/package.json +3 -3
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export const Constants = {
|
|
2
2
|
public: {
|
|
3
3
|
Enums: {
|
|
4
|
-
app_role: [
|
|
5
|
-
"admin",
|
|
6
|
-
"manager",
|
|
7
|
-
"warehouse",
|
|
8
|
-
"sales",
|
|
9
|
-
"developer",
|
|
10
|
-
"receptie",
|
|
11
|
-
"monteur",
|
|
12
|
-
],
|
|
4
|
+
app_role: ["admin", "planner", "monteur", "administratie", "ai_admin"],
|
|
13
5
|
exact_env: ["staging", "live"],
|
|
14
6
|
exact_push_status: ["pending", "sent", "error"],
|
|
7
|
+
itk_customer_segment: ["Business", "Private"],
|
|
8
|
+
itk_dynamic_field_type: ["text", "select", "date", "checkbox"],
|
|
9
|
+
planning_item_status: [
|
|
10
|
+
"gepland",
|
|
11
|
+
"bezig",
|
|
12
|
+
"afgerond",
|
|
13
|
+
"geannuleerd",
|
|
14
|
+
"concept",
|
|
15
|
+
"vrijgegeven",
|
|
16
|
+
],
|
|
15
17
|
quote_status: [
|
|
16
18
|
"concept",
|
|
17
19
|
"verzonden",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only client voor de centrale Auth-module.
|
|
3
|
+
*
|
|
4
|
+
* Twee endpoints:
|
|
5
|
+
* GET {CENTRAL_AUTH_URL}/api/shell-host
|
|
6
|
+
* POST {CENTRAL_AUTH_URL}/api/secret/floriday_gateway_secret
|
|
7
|
+
*
|
|
8
|
+
* Beide met header `Authorization: Bearer {CENTRAL_AUTH_SECRET}`.
|
|
9
|
+
*
|
|
10
|
+
* Cache-regels:
|
|
11
|
+
* - 60s positieve TTL per key
|
|
12
|
+
* - single-flight: parallelle aanroepen delen één in-flight promise
|
|
13
|
+
* - fouten worden NOOIT gecached (mislukte promise wordt gewist)
|
|
14
|
+
* - waarden worden NOOIT gelogd, ook niet in errors
|
|
15
|
+
*
|
|
16
|
+
* Strikt server-side; NIET importeren vanuit client-componenten of routes
|
|
17
|
+
* die in de client-bundel eindigen.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getShellHost(): Promise<string>;
|
|
20
|
+
export declare function getFloridayGatewaySecret(): Promise<string>;
|
|
21
|
+
//# sourceMappingURL=centralSecrets.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"centralSecrets.server.d.ts","sourceRoot":"","sources":["../../src/lib/centralSecrets.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwDH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAsBpD;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CA+BhE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only client voor de centrale Auth-module.
|
|
3
|
+
*
|
|
4
|
+
* Twee endpoints:
|
|
5
|
+
* GET {CENTRAL_AUTH_URL}/api/shell-host
|
|
6
|
+
* POST {CENTRAL_AUTH_URL}/api/secret/floriday_gateway_secret
|
|
7
|
+
*
|
|
8
|
+
* Beide met header `Authorization: Bearer {CENTRAL_AUTH_SECRET}`.
|
|
9
|
+
*
|
|
10
|
+
* Cache-regels:
|
|
11
|
+
* - 60s positieve TTL per key
|
|
12
|
+
* - single-flight: parallelle aanroepen delen één in-flight promise
|
|
13
|
+
* - fouten worden NOOIT gecached (mislukte promise wordt gewist)
|
|
14
|
+
* - waarden worden NOOIT gelogd, ook niet in errors
|
|
15
|
+
*
|
|
16
|
+
* Strikt server-side; NIET importeren vanuit client-componenten of routes
|
|
17
|
+
* die in de client-bundel eindigen.
|
|
18
|
+
*/
|
|
19
|
+
const TTL_MS = 60000;
|
|
20
|
+
const valueCache = new Map();
|
|
21
|
+
const inflight = new Map();
|
|
22
|
+
function getCentralConfig() {
|
|
23
|
+
const url = process.env.CENTRAL_AUTH_URL;
|
|
24
|
+
const secret = process.env.CENTRAL_AUTH_SECRET;
|
|
25
|
+
if (!url || !secret) {
|
|
26
|
+
throw new Error("CENTRAL_AUTH_URL / CENTRAL_AUTH_SECRET ontbreken — centrale Auth-module niet bereikbaar.");
|
|
27
|
+
}
|
|
28
|
+
return { url: url.replace(/\/$/, ""), secret };
|
|
29
|
+
}
|
|
30
|
+
function normalizeOrigin(raw) {
|
|
31
|
+
const trimmed = raw.trim().replace(/\/$/, "");
|
|
32
|
+
// Valideer dat het een geldige http(s) origin is; gooi zonder waarde te lekken.
|
|
33
|
+
try {
|
|
34
|
+
const u = new URL(trimmed);
|
|
35
|
+
return `${u.protocol}//${u.host}`;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
throw new Error("central: ongeldige shell_host in centrale respons");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function fetchAndCache(key, fetcher) {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
const cached = valueCache.get(key);
|
|
44
|
+
if (cached && cached.expiresAt > now)
|
|
45
|
+
return cached.value;
|
|
46
|
+
const existing = inflight.get(key);
|
|
47
|
+
if (existing)
|
|
48
|
+
return existing;
|
|
49
|
+
const p = (async () => {
|
|
50
|
+
try {
|
|
51
|
+
const value = await fetcher();
|
|
52
|
+
valueCache.set(key, { value, expiresAt: Date.now() + TTL_MS });
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
inflight.delete(key);
|
|
57
|
+
}
|
|
58
|
+
})();
|
|
59
|
+
inflight.set(key, p);
|
|
60
|
+
return p;
|
|
61
|
+
}
|
|
62
|
+
export async function getShellHost() {
|
|
63
|
+
return fetchAndCache("shell_host", async () => {
|
|
64
|
+
const { url, secret } = getCentralConfig();
|
|
65
|
+
const res = await fetch(`${url}/api/shell-host`, {
|
|
66
|
+
method: "GET",
|
|
67
|
+
headers: { Authorization: `Bearer ${secret}` },
|
|
68
|
+
});
|
|
69
|
+
if (!res.ok) {
|
|
70
|
+
throw new Error(`central /api/shell-host → HTTP ${res.status}`);
|
|
71
|
+
}
|
|
72
|
+
let parsed;
|
|
73
|
+
try {
|
|
74
|
+
parsed = await res.json();
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new Error("central /api/shell-host → geen JSON-body");
|
|
78
|
+
}
|
|
79
|
+
const host = parsed?.shell_host;
|
|
80
|
+
if (typeof host !== "string" || !host) {
|
|
81
|
+
throw new Error("central /api/shell-host → shell_host ontbreekt in respons");
|
|
82
|
+
}
|
|
83
|
+
return normalizeOrigin(host);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export async function getFloridayGatewaySecret() {
|
|
87
|
+
return fetchAndCache("floriday_gateway_secret", async () => {
|
|
88
|
+
const { url, secret } = getCentralConfig();
|
|
89
|
+
const res = await fetch(`${url}/api/secret/floriday_gateway_secret`, {
|
|
90
|
+
method: "POST",
|
|
91
|
+
headers: { Authorization: `Bearer ${secret}` },
|
|
92
|
+
});
|
|
93
|
+
if (!res.ok) {
|
|
94
|
+
throw new Error(`central /api/secret/floriday_gateway_secret → HTTP ${res.status}`);
|
|
95
|
+
}
|
|
96
|
+
let parsed;
|
|
97
|
+
try {
|
|
98
|
+
parsed = await res.json();
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
throw new Error("central /api/secret/floriday_gateway_secret → geen JSON-body");
|
|
102
|
+
}
|
|
103
|
+
const value = typeof parsed === "string"
|
|
104
|
+
? parsed
|
|
105
|
+
: parsed?.value ?? parsed?.secret ?? parsed?.floriday_gateway_secret;
|
|
106
|
+
if (typeof value !== "string" || !value) {
|
|
107
|
+
throw new Error("central /api/secret/floriday_gateway_secret → secret ontbreekt in respons");
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
});
|
|
111
|
+
}
|