@flowselections/floriday-verkoop-module 1.0.11 → 1.0.13
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/verkoop/AutoFulfillmentStatusCard.d.ts +4 -0
- package/dist-lib/components/verkoop/AutoFulfillmentStatusCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/AutoFulfillmentStatusCard.js +95 -0
- package/dist-lib/components/verkoop/CartAssignmentWizard.d.ts +6 -0
- package/dist-lib/components/verkoop/CartAssignmentWizard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/CartAssignmentWizard.js +194 -0
- package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/CreateOrderPage.js +230 -192
- package/dist-lib/components/verkoop/OrderAfleverbrievenCard.d.ts +4 -0
- package/dist-lib/components/verkoop/OrderAfleverbrievenCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/OrderAfleverbrievenCard.js +44 -0
- package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts +5 -0
- package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/OrderKarindelingCard.js +160 -0
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +6 -3
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -4
- package/dist-lib/components/verkoop/SearchableSelect.d.ts +19 -0
- package/dist-lib/components/verkoop/SearchableSelect.d.ts.map +1 -0
- package/dist-lib/components/verkoop/SearchableSelect.js +21 -0
- package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/VerkoopOrdersPage.js +39 -3
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +1381 -86
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +1381 -86
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +1381 -86
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +1402 -79
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/cart-lock.functions.d.ts +11225 -0
- package/dist-lib/lib/cart-lock.functions.d.ts.map +1 -0
- package/dist-lib/lib/cart-lock.functions.js +47 -0
- package/dist-lib/lib/cart-planner.d.ts +38 -0
- package/dist-lib/lib/cart-planner.d.ts.map +1 -0
- package/dist-lib/lib/cart-planner.js +217 -0
- package/dist-lib/lib/cart-replan.functions.d.ts +22467 -0
- package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -0
- package/dist-lib/lib/cart-replan.functions.js +203 -0
- package/dist-lib/lib/create-order.functions.d.ts +100967 -0
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -0
- package/dist-lib/lib/create-order.functions.js +343 -0
- package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts +33640 -0
- package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday-auto-fulfillment.functions.js +65 -0
- package/dist-lib/lib/floriday-auto-fulfillment.server.d.ts +21 -0
- package/dist-lib/lib/floriday-auto-fulfillment.server.d.ts.map +1 -0
- package/dist-lib/lib/floriday-auto-fulfillment.server.js +352 -0
- package/dist-lib/lib/floriday-logistic-labels.functions.d.ts +11220 -0
- package/dist-lib/lib/floriday-logistic-labels.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday-logistic-labels.functions.js +171 -0
- package/dist-lib/lib/floriday-public.functions.d.ts +9067 -16
- package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-public.functions.js +45 -47
- package/dist-lib/lib/floriday-writes.functions.d.ts +6475 -0
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-mapping.d.ts +2 -0
- package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-mapping.js +46 -20
- package/dist-lib/lib/salesorders.functions.d.ts +4273 -388
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.js +8 -0
- package/dist-lib/lib/tradeitems.functions.d.ts +1381 -86
- package/dist-lib/lib/tradeitems.functions.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.d.ts +1 -0
- package/dist-lib/lib/useSalesOrdersQuery.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.js +130 -41
- package/package.json +1 -1
|
@@ -55,6 +55,38 @@ export const getFlorydayCachedList = createServerFn({ method: "POST" })
|
|
|
55
55
|
const { data: rows, error } = await q;
|
|
56
56
|
if (error)
|
|
57
57
|
throw new Error(`${table} lezen faalde: ${error.message}`);
|
|
58
|
+
if (table === "floriday_salesorders_cache") {
|
|
59
|
+
const ids = (rows ?? [])
|
|
60
|
+
.map((r) => String(r?.floriday_id ?? r?.data?.salesOrderId ?? ""))
|
|
61
|
+
.filter((id) => id.length > 0);
|
|
62
|
+
if (ids.length > 0) {
|
|
63
|
+
const mapped = [];
|
|
64
|
+
const idSet = new Set(ids);
|
|
65
|
+
for (let from = 0; from < 10000; from += 1000) {
|
|
66
|
+
const { data: chunkRows, error: mapError } = await context.supabase
|
|
67
|
+
.from("floriday_order_number_map")
|
|
68
|
+
.select("floriday_id, order_number")
|
|
69
|
+
.range(from, from + 999);
|
|
70
|
+
if (mapError)
|
|
71
|
+
throw new Error(`floriday_order_number_map lezen faalde: ${mapError.message}`);
|
|
72
|
+
const batch = chunkRows ?? [];
|
|
73
|
+
mapped.push(...batch.filter((m) => idSet.has(String(m.floriday_id))));
|
|
74
|
+
if (batch.length < 1000)
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
const orderNumbers = new Map((mapped ?? []).map((m) => [String(m.floriday_id), String(m.order_number ?? "")]));
|
|
78
|
+
return {
|
|
79
|
+
entity: data.entity,
|
|
80
|
+
rows: (rows ?? []).map((r) => {
|
|
81
|
+
const floridayId = String(r?.floriday_id ?? r?.data?.salesOrderId ?? "");
|
|
82
|
+
const orderNumber = orderNumbers.get(floridayId) ?? null;
|
|
83
|
+
return orderNumber
|
|
84
|
+
? { ...r, order_number: orderNumber, data: { ...(r.data ?? {}), orderNumber } }
|
|
85
|
+
: r;
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
58
90
|
return { entity: data.entity, rows: rows ?? [] };
|
|
59
91
|
});
|
|
60
92
|
const CodeListSchema = z.object({
|
|
@@ -159,52 +191,18 @@ export const getFlorydayResourceSchema = createServerFn({ method: "POST" })
|
|
|
159
191
|
throw new Error(`resource-schema lezen faalde: ${error.message}`);
|
|
160
192
|
return rows?.[0] ?? null;
|
|
161
193
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
// Voor de FlorydaySyncHealthBanner — leest sync-state voor de actieve connectie
|
|
167
|
-
// van de gevraagde environment en geeft per resource laatste sync-info terug.
|
|
168
|
-
export const getFlorydaySyncHealth = createServerFn({ method: "POST" })
|
|
194
|
+
// Actieve Floriday-omgeving zoals ingesteld in de Authenticatie-module
|
|
195
|
+
// (`floriday_settings.active_environment`). Fallback → "staging".
|
|
196
|
+
export const getActiveFloridayEnvironment = createServerFn({ method: "GET" })
|
|
169
197
|
.middleware([requireSupabaseAuth])
|
|
170
|
-
.
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
.
|
|
175
|
-
.
|
|
176
|
-
.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (!connectionId) {
|
|
181
|
-
return { connectionId: null, resources: [] };
|
|
182
|
-
}
|
|
183
|
-
// Map resource → entity_type used in floriday_sync_state.
|
|
184
|
-
const RES_TO_ENTITY = {
|
|
185
|
-
"sales-orders": "salesorders",
|
|
186
|
-
"trade-items": "tradeitems",
|
|
187
|
-
"customer-organizations": "customers",
|
|
188
|
-
"fulfillment-orders": "fulfillment-orders",
|
|
189
|
-
};
|
|
190
|
-
const { data: rows } = await context.supabase
|
|
191
|
-
.from("floriday_sync_state")
|
|
192
|
-
.select("entity_type, last_sequence_number, last_synced_at, last_success_at, last_error")
|
|
193
|
-
.eq("connection_id", connectionId);
|
|
194
|
-
const stateByEntity = new Map((rows ?? []).map((r) => [String(r.entity_type), r]));
|
|
195
|
-
return {
|
|
196
|
-
connectionId,
|
|
197
|
-
resources: data.resources.map((res) => {
|
|
198
|
-
const entity = RES_TO_ENTITY[res] ?? res;
|
|
199
|
-
const s = stateByEntity.get(entity) ?? null;
|
|
200
|
-
return {
|
|
201
|
-
resource: res,
|
|
202
|
-
entityType: entity,
|
|
203
|
-
lastSyncedAt: s?.last_synced_at ?? null,
|
|
204
|
-
lastSuccessAt: s?.last_success_at ?? null,
|
|
205
|
-
lastSequenceNumber: s?.last_sequence_number ?? null,
|
|
206
|
-
lastError: s?.last_error ?? null,
|
|
207
|
-
};
|
|
208
|
-
}),
|
|
209
|
-
};
|
|
198
|
+
.handler(async () => {
|
|
199
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
200
|
+
const { data } = await supabaseAdmin
|
|
201
|
+
.from("floriday_settings")
|
|
202
|
+
.select("active_environment")
|
|
203
|
+
.eq("id", 1)
|
|
204
|
+
.maybeSingle();
|
|
205
|
+
const raw = String(data?.active_environment ?? "staging");
|
|
206
|
+
const env = raw === "production" || raw === "prod" || raw === "live" ? "live" : "staging";
|
|
207
|
+
return { environment: env };
|
|
210
208
|
});
|