@flowselections/floriday-klanten-module 1.0.50 → 1.0.53
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/CustomerAvatar.js +1 -1
- package/dist-lib/components/klanten/BewerkKlant.js +1 -1
- package/dist-lib/components/klanten/BewerkKlantRoute.js +1 -1
- package/dist-lib/components/klanten/BulkStickerUploadDialog.js +1 -1
- package/dist-lib/components/klanten/CustomerAnalyticsTab.js +2 -2
- package/dist-lib/components/klanten/CustomerAssortmentTab.js +4 -4
- package/dist-lib/components/klanten/DeliveryLocationsTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/DeliveryLocationsTab.js +18 -7
- package/dist-lib/components/klanten/DiscountsTab.js +2 -2
- package/dist-lib/components/klanten/ExternalCacheBanner.d.ts +1 -1
- package/dist-lib/components/klanten/FloridayNetworkStatus.js +3 -3
- package/dist-lib/components/klanten/GroupedKlantDetailRoute.js +1 -1
- package/dist-lib/components/klanten/ImportKlanten.js +1 -1
- package/dist-lib/components/klanten/KlantBewerkenDialog.js +2 -2
- package/dist-lib/components/klanten/KlantDetailLayout.d.ts +1 -1
- package/dist-lib/components/klanten/KlantDetailLayout.js +5 -5
- package/dist-lib/components/klanten/KlantDetailRoute.js +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +16 -16
- package/dist-lib/components/klanten/LocalDiscountFormDialog.js +1 -1
- package/dist-lib/components/klanten/LocalDiscountsTab.js +2 -2
- package/dist-lib/components/klanten/NetwerkPagina.js +3 -3
- package/dist-lib/components/klanten/NieuweKlant.js +1 -1
- package/dist-lib/components/klanten/OvernemenTwinfieldKlant.js +1 -1
- package/dist-lib/components/klanten/OvernemenTwinfieldKlantRoute.js +1 -1
- package/dist-lib/components/klanten/RouteError.js +1 -1
- package/dist-lib/components/klanten/pricegroups/CustomerPickerDialog.js +6 -6
- package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.js +3 -3
- package/dist-lib/components/klanten/pricegroups/PriceGroupEditRoute.js +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.js +11 -11
- package/dist-lib/components/klanten/pricegroups/PriceGroupNewRoute.js +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupsPage.js +4 -4
- package/dist-lib/components/klanten/pricegroups/PriceGroupsRoute.js +1 -1
- package/dist-lib/components/klanten/pricegroups/ProductPickerDialog.d.ts +1 -1
- package/dist-lib/components/klanten/pricegroups/UnknownFloridayMembers.d.ts +1 -1
- package/dist-lib/components/klanten/pricegroups/UnknownFloridayMembers.js +2 -2
- package/dist-lib/components/klanten/useCustomerDefaults.d.ts +1 -1
- package/dist-lib/index.d.ts +34 -34
- package/dist-lib/index.js +35 -35
- package/dist-lib/integrations/supabase/auth-attacher.js +1 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +903 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/accounting/exact/client.server.d.ts +1 -1
- package/dist-lib/lib/accounting/exact/client.server.js +2 -2
- package/dist-lib/lib/accounting/exact/sync.server.d.ts +1 -1
- package/dist-lib/lib/accounting/exact/sync.server.js +3 -3
- package/dist-lib/lib/accounting/floriday/sync.server.d.ts +1 -1
- package/dist-lib/lib/accounting/floriday/sync.server.js +1 -1
- package/dist-lib/lib/accounting/registry.server.d.ts +1 -1
- package/dist-lib/lib/accounting/registry.server.js +2 -2
- package/dist-lib/lib/accounting/twinfield/client.server.js +2 -2
- package/dist-lib/lib/accounting/twinfield/field-coverage.test.js +6 -6
- package/dist-lib/lib/accounting/twinfield/mapping.js +3 -3
- package/dist-lib/lib/accounting/twinfield/rmw-push.server.d.ts +2 -2
- package/dist-lib/lib/accounting/twinfield/rmw-push.server.js +4 -4
- package/dist-lib/lib/accounting/twinfield/rmw.server.d.ts +1 -1
- package/dist-lib/lib/accounting/twinfield/rmw.server.js +2 -2
- package/dist-lib/lib/accounting/twinfield/sandbox-rmw.server.d.ts +6 -6
- package/dist-lib/lib/accounting/twinfield/sandbox-rmw.server.js +12 -12
- package/dist-lib/lib/accounting/twinfield/sandbox.server.js +3 -3
- package/dist-lib/lib/accounting/twinfield/sync.server.js +4 -4
- package/dist-lib/lib/accounting/twinfield/worker.functions.d.ts +7 -7
- package/dist-lib/lib/accounting/twinfield/worker.functions.js +6 -6
- package/dist-lib/lib/accounting/twinfield/worker.server.js +8 -8
- package/dist-lib/lib/accounting.functions.d.ts +4 -4
- package/dist-lib/lib/accounting.functions.js +2 -2
- package/dist-lib/lib/countries.test.js +3 -3
- package/dist-lib/lib/customer-analytics.functions.d.ts +1 -1
- package/dist-lib/lib/customer-analytics.functions.js +1 -1
- package/dist-lib/lib/customer-assortment.functions.d.ts +1 -1
- package/dist-lib/lib/customer-assortment.functions.js +3 -3
- package/dist-lib/lib/customer-defaults.test.js +3 -3
- package/dist-lib/lib/customer-insert.d.ts +1 -1
- package/dist-lib/lib/customer-insert.js +2 -2
- package/dist-lib/lib/customer-notes.functions.d.ts +2 -2
- package/dist-lib/lib/customer-notes.functions.js +1 -1
- package/dist-lib/lib/customer-orders.functions.d.ts +1 -1
- package/dist-lib/lib/customer-orders.functions.js +1 -1
- package/dist-lib/lib/customer-revenue.functions.d.ts +1 -1
- package/dist-lib/lib/customer-revenue.functions.js +2 -2
- package/dist-lib/lib/customer-schemas.js +1 -1
- package/dist-lib/lib/customer-schemas.test.js +1 -1
- package/dist-lib/lib/customer-stickers.functions.d.ts +9 -9
- package/dist-lib/lib/customer-stickers.functions.js +2 -2
- package/dist-lib/lib/customers.functions.d.ts +29 -29
- package/dist-lib/lib/customers.functions.js +11 -11
- package/dist-lib/lib/delivery-locations.functions.d.ts +18 -30
- package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
- package/dist-lib/lib/delivery-locations.functions.js +24 -5
- package/dist-lib/lib/external-customers.functions.d.ts +4 -4
- package/dist-lib/lib/external-customers.functions.js +2 -2
- package/dist-lib/lib/floriday-app-url.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-app-url.functions.js +2 -2
- package/dist-lib/lib/floriday-assortment.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-assortment.functions.js +2 -2
- package/dist-lib/lib/floriday-discounts.functions.d.ts +2 -2
- package/dist-lib/lib/floriday-discounts.functions.js +2 -2
- package/dist-lib/lib/floriday-network-status.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-network-status.functions.js +1 -1
- package/dist-lib/lib/floriday-price-import.functions.d.ts +2 -2
- package/dist-lib/lib/floriday-price-import.functions.js +2 -2
- package/dist-lib/lib/floriday-sticker-import.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-sticker-import.functions.js +1 -1
- package/dist-lib/lib/floriday-trade-items.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-trade-items.functions.js +1 -1
- package/dist-lib/lib/floriday-trade-settings.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-trade-settings.functions.js +1 -1
- package/dist-lib/lib/local-discounts.functions.d.ts +7 -7
- package/dist-lib/lib/local-discounts.functions.js +1 -1
- package/dist-lib/lib/logistics-events.functions.d.ts +1 -1
- package/dist-lib/lib/logistics-events.functions.js +1 -1
- package/dist-lib/lib/logistics-strategy.functions.d.ts +4 -4
- package/dist-lib/lib/logistics-strategy.functions.js +1 -1
- package/dist-lib/lib/overdue-invoices.functions.d.ts +1 -1
- package/dist-lib/lib/overdue-invoices.functions.js +2 -2
- package/dist-lib/lib/price-groups-local.functions.d.ts +15 -15
- package/dist-lib/lib/price-groups-local.functions.js +1 -1
- package/dist-lib/lib/price-groups.functions.d.ts +1 -1
- package/dist-lib/lib/price-groups.functions.js +1 -1
- package/dist-lib/lib/twinfield-adopt.functions.d.ts +5 -5
- package/dist-lib/lib/twinfield-adopt.functions.js +7 -7
- package/dist-lib/lib/twinfield-customer-defaults.functions.d.ts +2 -2
- package/dist-lib/lib/twinfield-customer-defaults.functions.js +2 -2
- package/dist-lib/lib/twinfield-customer-defaults.server.js +1 -1
- package/dist-lib/lib/twinfield-ledger.functions.d.ts +2 -2
- package/dist-lib/lib/twinfield-ledger.functions.js +2 -2
- package/dist-lib/lib/twinfield-ledger.server.js +2 -2
- package/dist-lib/lib/twinfield-required-fields.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { requiresVatNumber, isDutch } from "./twinfield-required-fields";
|
|
2
|
+
import { requiresVatNumber, isDutch } from "./twinfield-required-fields.js";
|
|
3
3
|
const optStr = (max) => z.string().trim().max(max).optional().or(z.literal(""));
|
|
4
4
|
const reqStr = (max, msg) => z.string().trim().min(1, msg).max(max);
|
|
5
5
|
/** Optioneel tekstveld met formaatcontrole; leeg blijft altijd toegestaan. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { customerCreateSchema, customerUpdateSchema } from "./customer-schemas";
|
|
2
|
+
import { customerCreateSchema, customerUpdateSchema } from "./customer-schemas.js";
|
|
3
3
|
describe("alleen de naam is verplicht", () => {
|
|
4
4
|
it("aanmaken met alleen een naam", () => {
|
|
5
5
|
expect(customerCreateSchema.safeParse({ company_name: "Alleen naam" }).success).toBe(true);
|
|
@@ -20,14 +20,14 @@ export type CustomerStickersResult = {
|
|
|
20
20
|
format: StickerFormat | null;
|
|
21
21
|
};
|
|
22
22
|
export declare const listCustomerStickers: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
23
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
23
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
24
24
|
userId: string;
|
|
25
25
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
26
26
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
27
27
|
customerKey: string;
|
|
28
28
|
}, Promise<CustomerStickersResult>>;
|
|
29
29
|
export declare const confirmStickerUpload: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
30
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
30
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
31
31
|
userId: string;
|
|
32
32
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
33
33
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -41,7 +41,7 @@ export declare const confirmStickerUpload: import("@tanstack/start-client-core")
|
|
|
41
41
|
ok: true;
|
|
42
42
|
}>>;
|
|
43
43
|
export declare const deleteCustomerSticker: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
44
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
44
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
45
45
|
userId: string;
|
|
46
46
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
47
47
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -51,14 +51,14 @@ export declare const deleteCustomerSticker: import("@tanstack/start-client-core"
|
|
|
51
51
|
ok: true;
|
|
52
52
|
}>>;
|
|
53
53
|
export declare const getCustomerStickerSettings: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
54
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
54
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
55
55
|
userId: string;
|
|
56
56
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
57
57
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
58
58
|
customerKey: string;
|
|
59
59
|
}, Promise<StickerFormat | null>>;
|
|
60
60
|
export declare const setCustomerStickerSettings: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
61
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
61
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
62
62
|
userId: string;
|
|
63
63
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
64
64
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -73,7 +73,7 @@ export declare const setCustomerStickerSettings: import("@tanstack/start-client-
|
|
|
73
73
|
* ingestelde formaat terug, of null als er geen klantsticker gekoppeld is.
|
|
74
74
|
*/
|
|
75
75
|
export declare const getStickerForPrint: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
76
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
76
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
77
77
|
userId: string;
|
|
78
78
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
79
79
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -94,7 +94,7 @@ export type StickerMatchSuggestion = {
|
|
|
94
94
|
reason: string | null;
|
|
95
95
|
};
|
|
96
96
|
export declare const suggestStickerMatches: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
97
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
97
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
98
98
|
userId: string;
|
|
99
99
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
100
100
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -115,7 +115,7 @@ export declare const suggestStickerMatches: import("@tanstack/start-client-core"
|
|
|
115
115
|
aiError?: string | null;
|
|
116
116
|
}>>;
|
|
117
117
|
export declare const commitStickerBatch: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
118
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
118
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
119
119
|
userId: string;
|
|
120
120
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
121
121
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -139,7 +139,7 @@ export declare const commitStickerBatch: import("@tanstack/start-client-core").O
|
|
|
139
139
|
}[];
|
|
140
140
|
}>>;
|
|
141
141
|
export declare const discardStickerBatch: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
142
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
142
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
143
143
|
userId: string;
|
|
144
144
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
145
145
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
4
|
const BUCKET = "customer-stickers";
|
|
5
5
|
const SIGNED_TTL = 60 * 60; // 1 uur
|
|
6
6
|
export const ALLOWED_STICKER_MIME = [
|
|
@@ -265,7 +265,7 @@ export const suggestStickerMatches = createServerFn({ method: "POST" })
|
|
|
265
265
|
}
|
|
266
266
|
if (remaining.length === 0)
|
|
267
267
|
return { suggestions };
|
|
268
|
-
const { resolveModuleModel, logAiCall, AiModuleError } = await import("./ai-module.server");
|
|
268
|
+
const { resolveModuleModel, logAiCall, AiModuleError } = await import("./ai-module.server.js");
|
|
269
269
|
let model;
|
|
270
270
|
try {
|
|
271
271
|
model = await resolveModuleModel(AI_MODULE_KEY);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CustomerImportInput, type CustomerCreateInput, type ListFiltersInput } from "./customer-schemas";
|
|
1
|
+
import { type CustomerImportInput, type CustomerCreateInput, type ListFiltersInput } from "./customer-schemas.js";
|
|
2
2
|
type TwinfieldDraft = {
|
|
3
3
|
company_name?: string | null;
|
|
4
4
|
email?: string | null;
|
|
@@ -11,7 +11,7 @@ type TwinfieldDraft = {
|
|
|
11
11
|
};
|
|
12
12
|
/** Naam en code van de actieve Twinfield-administratie, voor vinkje en knop. */
|
|
13
13
|
export declare const getActiveTwinfieldAdministration: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
14
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
14
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
15
15
|
userId: string;
|
|
16
16
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
17
17
|
}, undefined, undefined, undefined>], undefined, Promise<{
|
|
@@ -28,7 +28,7 @@ export declare const getActiveTwinfieldAdministration: import("@tanstack/start-c
|
|
|
28
28
|
* Zet het kenmerk aan; de wachtrijtrigger plant dan een aanmaakregel.
|
|
29
29
|
*/
|
|
30
30
|
export declare const createTwinfieldDebtorNow: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
31
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
31
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
32
32
|
userId: string;
|
|
33
33
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
34
34
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -39,7 +39,7 @@ export declare const createTwinfieldDebtorNow: import("@tanstack/start-client-co
|
|
|
39
39
|
ok: true;
|
|
40
40
|
}>>;
|
|
41
41
|
export declare const precheckTwinfieldPush: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
42
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
42
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
43
43
|
userId: string;
|
|
44
44
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
45
45
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -54,7 +54,7 @@ export declare const precheckTwinfieldPush: import("@tanstack/start-client-core"
|
|
|
54
54
|
reason: string;
|
|
55
55
|
}>>;
|
|
56
56
|
export declare const listCustomers: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
57
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
57
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
58
58
|
userId: string;
|
|
59
59
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
60
60
|
}, undefined, undefined, undefined>], (input: ListFiltersInput) => {
|
|
@@ -69,7 +69,7 @@ export declare const listCustomers: import("@tanstack/start-client-core").Requir
|
|
|
69
69
|
server_now: string;
|
|
70
70
|
}>>;
|
|
71
71
|
export declare const getCustomer: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
72
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
72
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
73
73
|
userId: string;
|
|
74
74
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
75
75
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -78,7 +78,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
78
78
|
id: string;
|
|
79
79
|
}, Promise<{
|
|
80
80
|
customer: {
|
|
81
|
-
price_groups: import("./price-groups.functions").PriceGroup[];
|
|
81
|
+
price_groups: import("./price-groups.functions.js").PriceGroup[];
|
|
82
82
|
address: string | null;
|
|
83
83
|
address_line1: string | null;
|
|
84
84
|
address_line2: string | null;
|
|
@@ -114,7 +114,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
114
114
|
credit_manager: string | null;
|
|
115
115
|
credit_manager_name: string | null;
|
|
116
116
|
credit_manager_shortname: string | null;
|
|
117
|
-
custom_fields: import("../integrations/supabase/types").Json;
|
|
117
|
+
custom_fields: import("../integrations/supabase/types.js").Json;
|
|
118
118
|
customer_class: string | null;
|
|
119
119
|
customer_number: string | null;
|
|
120
120
|
discount_days: number | null;
|
|
@@ -126,7 +126,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
126
126
|
fax: string | null;
|
|
127
127
|
floriday_connection_id: string | null;
|
|
128
128
|
floriday_organization_id: string | null;
|
|
129
|
-
floriday_raw: import("../integrations/supabase/types").Json | null;
|
|
129
|
+
floriday_raw: import("../integrations/supabase/types.js").Json | null;
|
|
130
130
|
gln: string | null;
|
|
131
131
|
house_number: string | null;
|
|
132
132
|
icp_country_code: string | null;
|
|
@@ -154,7 +154,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
154
154
|
sync_error: string | null;
|
|
155
155
|
sync_status: string;
|
|
156
156
|
trade_forms: string[];
|
|
157
|
-
twinfield_base_snapshot: import("../integrations/supabase/types").Json | null;
|
|
157
|
+
twinfield_base_snapshot: import("../integrations/supabase/types.js").Json | null;
|
|
158
158
|
twinfield_base_version: number | null;
|
|
159
159
|
twinfield_code: string | null;
|
|
160
160
|
twinfield_create_on_insert: boolean;
|
|
@@ -172,7 +172,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
172
172
|
};
|
|
173
173
|
audit: {
|
|
174
174
|
action: string;
|
|
175
|
-
changes: import("../integrations/supabase/types").Json;
|
|
175
|
+
changes: import("../integrations/supabase/types.js").Json;
|
|
176
176
|
created_at: string;
|
|
177
177
|
customer_id: string;
|
|
178
178
|
id: string;
|
|
@@ -190,7 +190,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
190
190
|
job_title: string | null;
|
|
191
191
|
phone: string | null;
|
|
192
192
|
photo_url: string | null;
|
|
193
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
193
|
+
raw: import("../integrations/supabase/types.js").Json | null;
|
|
194
194
|
updated_at: string;
|
|
195
195
|
}[];
|
|
196
196
|
delivery_locations: {
|
|
@@ -212,7 +212,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
212
212
|
name: string | null;
|
|
213
213
|
postal_code: string | null;
|
|
214
214
|
province: string | null;
|
|
215
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
215
|
+
raw: import("../integrations/supabase/types.js").Json | null;
|
|
216
216
|
self_pickup: boolean;
|
|
217
217
|
street: string | null;
|
|
218
218
|
updated_at: string;
|
|
@@ -223,7 +223,7 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
223
223
|
customer_id: string;
|
|
224
224
|
id: string;
|
|
225
225
|
is_active: boolean;
|
|
226
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
226
|
+
raw: import("../integrations/supabase/types.js").Json | null;
|
|
227
227
|
setting_key: string;
|
|
228
228
|
setting_label: string;
|
|
229
229
|
updated_at: string;
|
|
@@ -237,15 +237,15 @@ export declare const getCustomer: import("@tanstack/start-client-core").Required
|
|
|
237
237
|
price: number | null;
|
|
238
238
|
product_group: string | null;
|
|
239
239
|
product_name: string;
|
|
240
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
240
|
+
raw: import("../integrations/supabase/types.js").Json | null;
|
|
241
241
|
unit: string | null;
|
|
242
242
|
updated_at: string;
|
|
243
243
|
}[];
|
|
244
|
-
price_groups: import("./price-groups.functions").PriceGroup[];
|
|
244
|
+
price_groups: import("./price-groups.functions.js").PriceGroup[];
|
|
245
245
|
floriday_synced_at: string | null;
|
|
246
246
|
}>>;
|
|
247
247
|
export declare const createCustomer: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
248
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
248
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
249
249
|
userId: string;
|
|
250
250
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
251
251
|
}, undefined, undefined, undefined>], (input: CustomerCreateInput) => {
|
|
@@ -345,7 +345,7 @@ export declare const createCustomer: import("@tanstack/start-client-core").Requi
|
|
|
345
345
|
credit_manager: string | null;
|
|
346
346
|
credit_manager_name: string | null;
|
|
347
347
|
credit_manager_shortname: string | null;
|
|
348
|
-
custom_fields: import("../integrations/supabase/types").Json;
|
|
348
|
+
custom_fields: import("../integrations/supabase/types.js").Json;
|
|
349
349
|
customer_class: string | null;
|
|
350
350
|
customer_number: string | null;
|
|
351
351
|
discount_days: number | null;
|
|
@@ -357,7 +357,7 @@ export declare const createCustomer: import("@tanstack/start-client-core").Requi
|
|
|
357
357
|
fax: string | null;
|
|
358
358
|
floriday_connection_id: string | null;
|
|
359
359
|
floriday_organization_id: string | null;
|
|
360
|
-
floriday_raw: import("../integrations/supabase/types").Json | null;
|
|
360
|
+
floriday_raw: import("../integrations/supabase/types.js").Json | null;
|
|
361
361
|
gln: string | null;
|
|
362
362
|
house_number: string | null;
|
|
363
363
|
icp_country_code: string | null;
|
|
@@ -385,7 +385,7 @@ export declare const createCustomer: import("@tanstack/start-client-core").Requi
|
|
|
385
385
|
sync_error: string | null;
|
|
386
386
|
sync_status: string;
|
|
387
387
|
trade_forms: string[];
|
|
388
|
-
twinfield_base_snapshot: import("../integrations/supabase/types").Json | null;
|
|
388
|
+
twinfield_base_snapshot: import("../integrations/supabase/types.js").Json | null;
|
|
389
389
|
twinfield_base_version: number | null;
|
|
390
390
|
twinfield_code: string | null;
|
|
391
391
|
twinfield_create_on_insert: boolean;
|
|
@@ -405,7 +405,7 @@ export declare const createCustomer: import("@tanstack/start-client-core").Requi
|
|
|
405
405
|
twinfieldQueued: boolean;
|
|
406
406
|
}>>;
|
|
407
407
|
export declare const updateCustomer: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
408
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
408
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
409
409
|
userId: string;
|
|
410
410
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
411
411
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -500,7 +500,7 @@ export declare const updateCustomer: import("@tanstack/start-client-core").Optio
|
|
|
500
500
|
credit_manager: string | null;
|
|
501
501
|
credit_manager_name: string | null;
|
|
502
502
|
credit_manager_shortname: string | null;
|
|
503
|
-
custom_fields: import("../integrations/supabase/types").Json;
|
|
503
|
+
custom_fields: import("../integrations/supabase/types.js").Json;
|
|
504
504
|
customer_class: string | null;
|
|
505
505
|
customer_number: string | null;
|
|
506
506
|
discount_days: number | null;
|
|
@@ -512,7 +512,7 @@ export declare const updateCustomer: import("@tanstack/start-client-core").Optio
|
|
|
512
512
|
fax: string | null;
|
|
513
513
|
floriday_connection_id: string | null;
|
|
514
514
|
floriday_organization_id: string | null;
|
|
515
|
-
floriday_raw: import("../integrations/supabase/types").Json | null;
|
|
515
|
+
floriday_raw: import("../integrations/supabase/types.js").Json | null;
|
|
516
516
|
gln: string | null;
|
|
517
517
|
house_number: string | null;
|
|
518
518
|
icp_country_code: string | null;
|
|
@@ -540,7 +540,7 @@ export declare const updateCustomer: import("@tanstack/start-client-core").Optio
|
|
|
540
540
|
sync_error: string | null;
|
|
541
541
|
sync_status: string;
|
|
542
542
|
trade_forms: string[];
|
|
543
|
-
twinfield_base_snapshot: import("../integrations/supabase/types").Json | null;
|
|
543
|
+
twinfield_base_snapshot: import("../integrations/supabase/types.js").Json | null;
|
|
544
544
|
twinfield_base_version: number | null;
|
|
545
545
|
twinfield_code: string | null;
|
|
546
546
|
twinfield_create_on_insert: boolean;
|
|
@@ -564,7 +564,7 @@ export declare const updateCustomer: import("@tanstack/start-client-core").Optio
|
|
|
564
564
|
}[];
|
|
565
565
|
}>>;
|
|
566
566
|
export declare const deleteCustomer: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
567
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
567
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
568
568
|
userId: string;
|
|
569
569
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
570
570
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -575,7 +575,7 @@ export declare const deleteCustomer: import("@tanstack/start-client-core").Requi
|
|
|
575
575
|
ok: true;
|
|
576
576
|
}>>;
|
|
577
577
|
export declare const listFloridayNetwork: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
578
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
578
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
579
579
|
userId: string;
|
|
580
580
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
581
581
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -607,7 +607,7 @@ export declare const listFloridayNetwork: import("@tanstack/start-client-core").
|
|
|
607
607
|
end_date: string | null;
|
|
608
608
|
is_expired: boolean;
|
|
609
609
|
fetched_at: any;
|
|
610
|
-
price_groups: import("./price-groups.functions").PriceGroup[];
|
|
610
|
+
price_groups: import("./price-groups.functions.js").PriceGroup[];
|
|
611
611
|
}[];
|
|
612
612
|
total: number;
|
|
613
613
|
limit: number;
|
|
@@ -615,14 +615,14 @@ export declare const listFloridayNetwork: import("@tanstack/start-client-core").
|
|
|
615
615
|
truncated: boolean;
|
|
616
616
|
}>>;
|
|
617
617
|
export declare const listCustomerClasses: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
618
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
618
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
619
619
|
userId: string;
|
|
620
620
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
621
621
|
}, undefined, undefined, undefined>], undefined, Promise<{
|
|
622
622
|
classes: string[];
|
|
623
623
|
}>>;
|
|
624
624
|
export declare const bulkImportCustomers: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
625
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
625
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
626
626
|
userId: string;
|
|
627
627
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
628
628
|
}, undefined, undefined, undefined>], (input: CustomerImportInput) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
4
|
-
import { customerCreateSchema, customerUpdateSchema, listFiltersSchema, customerImportSchema, } from "./customer-schemas";
|
|
5
|
-
import { buildPriceGroupsMap } from "./price-groups.functions";
|
|
6
|
-
import { buildCustomerInsertRow } from "./customer-insert";
|
|
7
|
-
import { friendlyError } from "./errors";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
|
+
import { customerCreateSchema, customerUpdateSchema, listFiltersSchema, customerImportSchema, } from "./customer-schemas.js";
|
|
5
|
+
import { buildPriceGroupsMap } from "./price-groups.functions.js";
|
|
6
|
+
import { buildCustomerInsertRow } from "./customer-insert.js";
|
|
7
|
+
import { friendlyError } from "./errors.js";
|
|
8
8
|
function checkTwinfieldReady(draft) {
|
|
9
9
|
const missing = [];
|
|
10
10
|
if (!draft.company_name?.trim())
|
|
@@ -255,7 +255,7 @@ async function findDuplicates(supabase, input) {
|
|
|
255
255
|
*/
|
|
256
256
|
async function pushCustomerNow(customerId) {
|
|
257
257
|
try {
|
|
258
|
-
const { runTwinfieldPushQueueInternal } = await import("./accounting/twinfield/worker.server");
|
|
258
|
+
const { runTwinfieldPushQueueInternal } = await import("./accounting/twinfield/worker.server.js");
|
|
259
259
|
const res = await runTwinfieldPushQueueInternal(5, customerId);
|
|
260
260
|
return res.claimed > 0;
|
|
261
261
|
}
|
|
@@ -277,8 +277,8 @@ export const createCustomer = createServerFn({ method: "POST" })
|
|
|
277
277
|
if (duplicates.length > 0 && !data.force) {
|
|
278
278
|
return { customer: null, duplicates };
|
|
279
279
|
}
|
|
280
|
-
const { resolveFreeCustomerNumber } = await import("./customer-insert");
|
|
281
|
-
const { loadCustomerDefaults } = await import("./twinfield-customer-defaults.server");
|
|
280
|
+
const { resolveFreeCustomerNumber } = await import("./customer-insert.js");
|
|
281
|
+
const { loadCustomerDefaults } = await import("./twinfield-customer-defaults.server.js");
|
|
282
282
|
const defaults = await loadCustomerDefaults(supabase);
|
|
283
283
|
const number = await resolveFreeCustomerNumber(supabase, data.customer_number);
|
|
284
284
|
// Zonder actieve koppeling nooit versturen (fail closed).
|
|
@@ -324,7 +324,7 @@ export const updateCustomer = createServerFn({ method: "POST" })
|
|
|
324
324
|
.handler(async ({ data, context }) => {
|
|
325
325
|
const { supabase } = context;
|
|
326
326
|
const { id, force: _force, base, base_updated_at, ...patch } = data;
|
|
327
|
-
const { ACCOUNTING_DEFAULTS } = await import("./customer-insert");
|
|
327
|
+
const { ACCOUNTING_DEFAULTS } = await import("./customer-insert.js");
|
|
328
328
|
const cleaned = {};
|
|
329
329
|
for (const [k, v] of Object.entries(patch)) {
|
|
330
330
|
if (v === undefined)
|
|
@@ -342,7 +342,7 @@ export const updateCustomer = createServerFn({ method: "POST" })
|
|
|
342
342
|
cleaned[k] = v;
|
|
343
343
|
}
|
|
344
344
|
if ("customer_number" in cleaned) {
|
|
345
|
-
const { resolveFreeCustomerNumber } = await import("./customer-insert");
|
|
345
|
+
const { resolveFreeCustomerNumber } = await import("./customer-insert.js");
|
|
346
346
|
const number = await resolveFreeCustomerNumber(supabase, cleaned.customer_number, id);
|
|
347
347
|
cleaned.customer_number = number.value;
|
|
348
348
|
}
|
|
@@ -515,7 +515,7 @@ export const bulkImportCustomers = createServerFn({ method: "POST" })
|
|
|
515
515
|
.inputValidator((input) => customerImportSchema.parse(input))
|
|
516
516
|
.handler(async ({ data, context }) => {
|
|
517
517
|
const { supabase } = context;
|
|
518
|
-
const { loadCustomerDefaults } = await import("./twinfield-customer-defaults.server");
|
|
518
|
+
const { loadCustomerDefaults } = await import("./twinfield-customer-defaults.server.js");
|
|
519
519
|
const importDefaults = await loadCustomerDefaults(supabase);
|
|
520
520
|
const results = { created: 0, skipped: 0, failed: 0, errors: [] };
|
|
521
521
|
for (let i = 0; i < data.rows.length; i++) {
|
|
@@ -41,7 +41,7 @@ export declare function pickCarrierForLocation(location: {
|
|
|
41
41
|
matched_on: "city" | "province" | "country" | null;
|
|
42
42
|
};
|
|
43
43
|
export declare const listCarriers: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
44
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
44
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
45
45
|
userId: string;
|
|
46
46
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
47
47
|
}, undefined, undefined, undefined>], undefined, Promise<{
|
|
@@ -55,7 +55,7 @@ export declare const listCarriers: import("@tanstack/start-client-core").Optiona
|
|
|
55
55
|
}[];
|
|
56
56
|
}>>;
|
|
57
57
|
export declare const listDeliveryLocations: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
58
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
58
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
59
59
|
userId: string;
|
|
60
60
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
61
61
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -88,14 +88,14 @@ export declare const listDeliveryLocations: import("@tanstack/start-client-core"
|
|
|
88
88
|
name: string | null;
|
|
89
89
|
postal_code: string | null;
|
|
90
90
|
province: string | null;
|
|
91
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
91
|
+
raw: import("../integrations/supabase/types.js").Json | null;
|
|
92
92
|
self_pickup: boolean;
|
|
93
93
|
street: string | null;
|
|
94
94
|
updated_at: string;
|
|
95
95
|
}[];
|
|
96
96
|
}>>;
|
|
97
97
|
export declare const upsertDeliveryLocation: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
98
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
98
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
99
99
|
userId: string;
|
|
100
100
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
101
101
|
}, undefined, undefined, undefined>], (input: LocationInput) => {
|
|
@@ -116,33 +116,21 @@ export declare const upsertDeliveryLocation: import("@tanstack/start-client-core
|
|
|
116
116
|
is_primary?: boolean | undefined;
|
|
117
117
|
self_pickup?: boolean | undefined;
|
|
118
118
|
}, Promise<{
|
|
119
|
-
location:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
group_key: string | null;
|
|
132
|
-
house_number: string | null;
|
|
133
|
-
id: string;
|
|
134
|
-
is_primary: boolean;
|
|
135
|
-
name: string | null;
|
|
136
|
-
postal_code: string | null;
|
|
137
|
-
province: string | null;
|
|
138
|
-
raw: import("../integrations/supabase/types").Json | null;
|
|
139
|
-
self_pickup: boolean;
|
|
140
|
-
street: string | null;
|
|
141
|
-
updated_at: string;
|
|
142
|
-
};
|
|
119
|
+
location: any;
|
|
120
|
+
}>>;
|
|
121
|
+
export declare const setPrimaryDeliveryLocation: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
122
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
123
|
+
userId: string;
|
|
124
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
125
|
+
}, undefined, undefined, undefined>], (input: {
|
|
126
|
+
id: string;
|
|
127
|
+
}) => {
|
|
128
|
+
id: string;
|
|
129
|
+
}, Promise<{
|
|
130
|
+
ok: true;
|
|
143
131
|
}>>;
|
|
144
132
|
export declare const deleteDeliveryLocation: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
145
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
133
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
146
134
|
userId: string;
|
|
147
135
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
148
136
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -169,7 +157,7 @@ export type FloridayLocationImportResult = {
|
|
|
169
157
|
cacheEmpty: boolean;
|
|
170
158
|
};
|
|
171
159
|
export declare const importFloridayDeliveryLocations: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
172
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
160
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
173
161
|
userId: string;
|
|
174
162
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
175
163
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-locations.functions.d.ts","sourceRoot":"","sources":["../../src/lib/delivery-locations.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;iBAoBnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAa3D;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACrF,QAAQ,EAAE,KAAK,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,GACD;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAA;CAAE,CAgBnF;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;GAUrB,CAAC;AAEL,eAAO,MAAM,qBAAqB;;;;8CAGtB;IACN,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;kBAJe,MAAM,GAAG,IAAI;gBACf,MAAM,GAAG,IAAI;wBACL,MAAM,GAAG,IAAI;mBAClB,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;GAwB9B,CAAC;AAEL,eAAO,MAAM,sBAAsB;;;;8CAET,aAAa
|
|
1
|
+
{"version":3,"file":"delivery-locations.functions.d.ts","sourceRoot":"","sources":["../../src/lib/delivery-locations.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;iBAoBnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAa3D;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACrF,QAAQ,EAAE,KAAK,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,GACD;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAA;CAAE,CAgBnF;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;GAUrB,CAAC;AAEL,eAAO,MAAM,qBAAqB;;;;8CAGtB;IACN,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;kBAJe,MAAM,GAAG,IAAI;gBACf,MAAM,GAAG,IAAI;wBACL,MAAM,GAAG,IAAI;mBAClB,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;GAwB9B,CAAC;AAEL,eAAO,MAAM,sBAAsB;;;;8CAET,aAAa;;;;;;;;;;;;;;;;;;;GAyEnC,CAAC;AAEL,eAAO,MAAM,0BAA0B;;;;8CAEb;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;QAAR,MAAM;;;GAKlC,CAAC;AAEL,eAAO,MAAM,sBAAsB;;;;8CAET;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;QAAR,MAAM;;;GAQlC,CAAC;AAGL,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,2BAA2B,EAAE,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA4BF,eAAO,MAAM,+BAA+B;;;;8CAElB,OAAO;;yCAmJ7B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
4
|
-
import { regionAliases } from "./eu-regions";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
|
+
import { regionAliases } from "./eu-regions.js";
|
|
5
5
|
const locationSchema = z.object({
|
|
6
6
|
id: z.string().uuid().optional(),
|
|
7
7
|
customer_id: z.string().uuid().nullable().optional(),
|
|
@@ -137,9 +137,15 @@ export const upsertDeliveryLocation = createServerFn({ method: "POST" })
|
|
|
137
137
|
country: data.country || null,
|
|
138
138
|
carrier_id,
|
|
139
139
|
carrier_assignment_source: source,
|
|
140
|
-
|
|
140
|
+
// Vast maken loopt via set_primary_delivery_location (precies één per klant).
|
|
141
|
+
is_primary: false,
|
|
141
142
|
self_pickup: data.self_pickup ?? false,
|
|
142
143
|
};
|
|
144
|
+
const makePrimary = async (id) => {
|
|
145
|
+
const { error } = await supabase.rpc("set_primary_delivery_location", { p_location_id: id });
|
|
146
|
+
if (error)
|
|
147
|
+
throw new Error(error.message);
|
|
148
|
+
};
|
|
143
149
|
if (data.id) {
|
|
144
150
|
const { data: updated, error } = await supabase
|
|
145
151
|
.from("customer_delivery_locations")
|
|
@@ -149,7 +155,9 @@ export const upsertDeliveryLocation = createServerFn({ method: "POST" })
|
|
|
149
155
|
.single();
|
|
150
156
|
if (error)
|
|
151
157
|
throw new Error(error.message);
|
|
152
|
-
|
|
158
|
+
if (data.is_primary)
|
|
159
|
+
await makePrimary(data.id);
|
|
160
|
+
return { location: { ...updated, is_primary: !!data.is_primary } };
|
|
153
161
|
}
|
|
154
162
|
const { data: inserted, error } = await supabase
|
|
155
163
|
.from("customer_delivery_locations")
|
|
@@ -158,7 +166,18 @@ export const upsertDeliveryLocation = createServerFn({ method: "POST" })
|
|
|
158
166
|
.single();
|
|
159
167
|
if (error)
|
|
160
168
|
throw new Error(error.message);
|
|
161
|
-
|
|
169
|
+
if (data.is_primary)
|
|
170
|
+
await makePrimary(inserted.id);
|
|
171
|
+
return { location: { ...inserted, is_primary: !!data.is_primary } };
|
|
172
|
+
});
|
|
173
|
+
export const setPrimaryDeliveryLocation = createServerFn({ method: "POST" })
|
|
174
|
+
.middleware([requireSupabaseAuth])
|
|
175
|
+
.inputValidator((input) => input)
|
|
176
|
+
.handler(async ({ data, context }) => {
|
|
177
|
+
const { error } = await context.supabase.rpc("set_primary_delivery_location", { p_location_id: data.id });
|
|
178
|
+
if (error)
|
|
179
|
+
throw new Error(error.message);
|
|
180
|
+
return { ok: true };
|
|
162
181
|
});
|
|
163
182
|
export const deleteDeliveryLocation = createServerFn({ method: "POST" })
|
|
164
183
|
.middleware([requireSupabaseAuth])
|
|
@@ -55,14 +55,14 @@ export type GroupedCustomer = {
|
|
|
55
55
|
sources: ExternalCustomer[];
|
|
56
56
|
};
|
|
57
57
|
export declare const listExternalProviders: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
58
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
58
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
59
59
|
userId: string;
|
|
60
60
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
61
61
|
}, undefined, undefined, undefined>], undefined, Promise<{
|
|
62
62
|
providers: ExternalProvider[];
|
|
63
63
|
}>>;
|
|
64
64
|
export declare const listExternalCustomers: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
65
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
65
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
66
66
|
userId: string;
|
|
67
67
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
68
68
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -78,7 +78,7 @@ export declare const listExternalCustomers: import("@tanstack/start-client-core"
|
|
|
78
78
|
server_now: string;
|
|
79
79
|
}>>;
|
|
80
80
|
export declare const getGroupedCustomerDetail: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
81
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
81
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
82
82
|
userId: string;
|
|
83
83
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
84
84
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -95,7 +95,7 @@ export declare const getGroupedCustomerDetail: import("@tanstack/start-client-co
|
|
|
95
95
|
redirectCustomerId: string;
|
|
96
96
|
}>>;
|
|
97
97
|
export declare const getExternalCustomerDetail: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
98
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
98
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
99
99
|
userId: string;
|
|
100
100
|
claims: import("@supabase/auth-js").JwtPayload;
|
|
101
101
|
}, undefined, undefined, undefined>], (input: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
4
|
const GROUPED_COLS = "group_key, display_name, commercial_name, contact_person, email, phone, city, country, website, logo_url, vat_number, gln, is_active, fetched_at, last_changed_at, providers, source_count, is_merged, match_key, sources";
|
|
5
5
|
const SELECT_COLS = "provider, connection_id, external_id, company_name, commercial_name, contact_person, email, phone, street, house_number, postal_code, city, country, vat_number, gln, website, logo_url, status, is_active, is_deleted, fetched_at, raw";
|
|
6
6
|
const listInput = z.object({
|
|
@@ -13,7 +13,7 @@ const listInput = z.object({
|
|
|
13
13
|
since: z.string().datetime({ offset: true }).optional(),
|
|
14
14
|
});
|
|
15
15
|
async function admin() {
|
|
16
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
16
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
17
17
|
return supabaseAdmin;
|
|
18
18
|
}
|
|
19
19
|
/** Postgres levert nooit meer dan 1000 rijen per aanvraag; lees in blokken door. */
|