@flowselections/floriday-klanten-module 1.0.62 → 1.0.67

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.
Files changed (61) hide show
  1. package/dist-lib/components/klanten/BulkStickerUploadDialog.d.ts.map +1 -1
  2. package/dist-lib/components/klanten/BulkStickerUploadDialog.js +4 -0
  3. package/dist-lib/components/klanten/CarrierAdminCard.d.ts +3 -0
  4. package/dist-lib/components/klanten/CarrierAdminCard.d.ts.map +1 -0
  5. package/dist-lib/components/klanten/CarrierAdminCard.js +23 -0
  6. package/dist-lib/components/klanten/CarrierPicker.d.ts +221 -0
  7. package/dist-lib/components/klanten/CarrierPicker.d.ts.map +1 -0
  8. package/dist-lib/components/klanten/CarrierPicker.js +74 -0
  9. package/dist-lib/components/klanten/CustomerCarrierCard.d.ts +5 -0
  10. package/dist-lib/components/klanten/CustomerCarrierCard.d.ts.map +1 -0
  11. package/dist-lib/components/klanten/CustomerCarrierCard.js +36 -0
  12. package/dist-lib/components/klanten/CustomerStickerCell.d.ts.map +1 -1
  13. package/dist-lib/components/klanten/CustomerStickerCell.js +11 -5
  14. package/dist-lib/components/klanten/DeliveryLocationsTab.d.ts.map +1 -1
  15. package/dist-lib/components/klanten/DeliveryLocationsTab.js +38 -45
  16. package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
  17. package/dist-lib/components/klanten/KlantDetail.js +2 -1
  18. package/dist-lib/components/klanten/KlantFormulier.d.ts.map +1 -1
  19. package/dist-lib/components/klanten/KlantFormulier.js +8 -12
  20. package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
  21. package/dist-lib/components/klanten/KlantenOverzicht.js +8 -3
  22. package/dist-lib/components/klanten/StickerSizeLine.d.ts +14 -0
  23. package/dist-lib/components/klanten/StickerSizeLine.d.ts.map +1 -0
  24. package/dist-lib/components/klanten/StickerSizeLine.js +74 -0
  25. package/dist-lib/components/klanten/StickerSizePreviewCard.d.ts +3 -0
  26. package/dist-lib/components/klanten/StickerSizePreviewCard.d.ts.map +1 -0
  27. package/dist-lib/components/klanten/StickerSizePreviewCard.js +27 -0
  28. package/dist-lib/integrations/supabase/types.d.ts +1357 -28
  29. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  30. package/dist-lib/lib/carrier-choice.d.ts +60 -0
  31. package/dist-lib/lib/carrier-choice.d.ts.map +1 -0
  32. package/dist-lib/lib/carrier-choice.js +68 -0
  33. package/dist-lib/lib/carriers.functions.d.ts +82 -0
  34. package/dist-lib/lib/carriers.functions.d.ts.map +1 -0
  35. package/dist-lib/lib/carriers.functions.js +180 -0
  36. package/dist-lib/lib/countries.d.ts +2 -0
  37. package/dist-lib/lib/countries.d.ts.map +1 -1
  38. package/dist-lib/lib/countries.js +2 -0
  39. package/dist-lib/lib/customer-schemas.d.ts +108 -2
  40. package/dist-lib/lib/customer-schemas.d.ts.map +1 -1
  41. package/dist-lib/lib/customer-schemas.js +15 -1
  42. package/dist-lib/lib/customer-stickers.functions.d.ts +55 -0
  43. package/dist-lib/lib/customer-stickers.functions.d.ts.map +1 -1
  44. package/dist-lib/lib/customer-stickers.functions.js +137 -5
  45. package/dist-lib/lib/customers.functions.d.ts +4 -1
  46. package/dist-lib/lib/customers.functions.d.ts.map +1 -1
  47. package/dist-lib/lib/customers.functions.js +7 -0
  48. package/dist-lib/lib/delivery-locations.functions.d.ts +2 -2
  49. package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
  50. package/dist-lib/lib/delivery-locations.functions.js +31 -38
  51. package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
  52. package/dist-lib/lib/price-groups-local.functions.js +4 -1
  53. package/dist-lib/lib/sticker-size.d.ts +59 -0
  54. package/dist-lib/lib/sticker-size.d.ts.map +1 -0
  55. package/dist-lib/lib/sticker-size.js +233 -0
  56. package/dist-lib/lib/twinfield-adopt.functions.d.ts +2 -1
  57. package/dist-lib/lib/twinfield-adopt.functions.d.ts.map +1 -1
  58. package/dist-lib/lib/twinfield-adopt.functions.js +2 -2
  59. package/dist-lib/lib/twinfield-customer-defaults.server.js +2 -2
  60. package/package.json +11 -3
  61. package/schema/klanten.sql +514 -48
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Bepaalt de fysieke maat (mm) van een stickerbestand zonder externe libraries.
3
+ * Volgorde: PDF-paginamaat → DPI (PNG pHYs / JPG JFIF / EXIF) → verhouding met
4
+ * een geladen etiket (±3%, alleen voorstel bij precies één maat) → onbekend.
5
+ */
6
+ export const RATIO_TOLERANCE = 0.03;
7
+ const r1 = (v) => Math.round(v * 10) / 10;
8
+ function latin1(bytes, max = bytes.length) {
9
+ let s = "";
10
+ const n = Math.min(max, bytes.length);
11
+ for (let i = 0; i < n; i += 8192)
12
+ s += String.fromCharCode(...bytes.subarray(i, Math.min(n, i + 8192)));
13
+ return s;
14
+ }
15
+ export function pdfPageSizeMm(bytes) {
16
+ const text = latin1(bytes);
17
+ // Eerste pagina-object met MediaBox; anders de eerste MediaBox (bv. in /Pages)
18
+ const num = "(-?\\d+(?:\\.\\d+)?)";
19
+ const re = new RegExp(`/MediaBox\\s*\\[\\s*${num}\\s+${num}\\s+${num}\\s+${num}\\s*\\]`);
20
+ const pageIdx = text.search(/\/Type\s*\/Page(?![s\w])/);
21
+ let m = null;
22
+ if (pageIdx >= 0) {
23
+ const start = text.lastIndexOf(" obj", pageIdx);
24
+ const end = text.indexOf("endobj", pageIdx);
25
+ if (start >= 0 && end > start)
26
+ m = re.exec(text.slice(start, end));
27
+ }
28
+ if (!m)
29
+ m = re.exec(text);
30
+ if (!m)
31
+ return null;
32
+ const [x0, y0, x1, y1] = m.slice(1, 5).map(Number);
33
+ const w = Math.abs(x1 - x0), h = Math.abs(y1 - y0);
34
+ if (!(w > 0 && h > 0))
35
+ return null;
36
+ // /Rotate 90/270 op de pagina wisselt breedte en hoogte
37
+ const rot = /\/Rotate\s+(-?\d+)/.exec(text);
38
+ const swap = rot && Math.abs(Number(rot[1])) % 180 === 90;
39
+ const wmm = r1((w * 25.4) / 72), hmm = r1((h * 25.4) / 72);
40
+ return swap ? { width_mm: hmm, height_mm: wmm } : { width_mm: wmm, height_mm: hmm };
41
+ }
42
+ export function pngInfo(b) {
43
+ if (b.length < 24 || b[0] !== 0x89 || b[1] !== 0x50 || b[2] !== 0x4e || b[3] !== 0x47)
44
+ return null;
45
+ const dv = new DataView(b.buffer, b.byteOffset, b.byteLength);
46
+ const w = dv.getUint32(16), h = dv.getUint32(20);
47
+ let dpiX = null, dpiY = null;
48
+ let p = 8;
49
+ while (p + 8 <= b.length) {
50
+ const len = dv.getUint32(p);
51
+ const type = String.fromCharCode(b[p + 4], b[p + 5], b[p + 6], b[p + 7]);
52
+ if (type === "pHYs" && p + 17 <= b.length) {
53
+ const px = dv.getUint32(p + 8), py = dv.getUint32(p + 12), unit = b[p + 16];
54
+ if (unit === 1 && px > 0 && py > 0) {
55
+ dpiX = px * 0.0254;
56
+ dpiY = py * 0.0254;
57
+ }
58
+ break;
59
+ }
60
+ if (type === "IDAT" || type === "IEND")
61
+ break;
62
+ p += 12 + len;
63
+ }
64
+ return { w, h, dpiX, dpiY };
65
+ }
66
+ function exifDpi(b, start, len) {
67
+ const t = start; // TIFF-header
68
+ if (t + 8 > b.length)
69
+ return null;
70
+ const le = b[t] === 0x49;
71
+ const dv = new DataView(b.buffer, b.byteOffset, b.byteLength);
72
+ const u16 = (o) => dv.getUint16(t + o, le);
73
+ const u32 = (o) => dv.getUint32(t + o, le);
74
+ const ifd = u32(4);
75
+ if (t + ifd + 2 > start + len)
76
+ return null;
77
+ const n = u16(ifd);
78
+ let x = null, y = null, unit = 2;
79
+ for (let i = 0; i < n; i++) {
80
+ const e = ifd + 2 + i * 12;
81
+ if (t + e + 12 > b.length)
82
+ break;
83
+ const tag = u16(e);
84
+ if (tag === 0x011a || tag === 0x011b) {
85
+ const off = u32(e + 8);
86
+ const den = u32(off + 4);
87
+ const v = den ? u32(off) / den : 0;
88
+ if (tag === 0x011a)
89
+ x = v;
90
+ else
91
+ y = v;
92
+ }
93
+ else if (tag === 0x0128)
94
+ unit = u16(e + 8);
95
+ }
96
+ if (!x || !y || unit === 1)
97
+ return null;
98
+ return unit === 3 ? { x: x * 2.54, y: y * 2.54 } : { x, y };
99
+ }
100
+ export function jpegInfo(b) {
101
+ if (b.length < 4 || b[0] !== 0xff || b[1] !== 0xd8)
102
+ return null;
103
+ let p = 2, w = 0, h = 0;
104
+ let dpiX = null, dpiY = null;
105
+ let exif = null;
106
+ while (p + 4 <= b.length) {
107
+ if (b[p] !== 0xff) {
108
+ p++;
109
+ continue;
110
+ }
111
+ const marker = b[p + 1];
112
+ if (marker === 0xd8 || (marker >= 0xd0 && marker <= 0xd7) || marker === 0x01) {
113
+ p += 2;
114
+ continue;
115
+ }
116
+ const len = (b[p + 2] << 8) | b[p + 3];
117
+ const seg = p + 4;
118
+ if (marker === 0xe0 && latin1(b.subarray(seg, seg + 5)) === "JFIF\0") {
119
+ const unit = b[seg + 7];
120
+ const xd = (b[seg + 8] << 8) | b[seg + 9], yd = (b[seg + 10] << 8) | b[seg + 11];
121
+ if ((unit === 1 || unit === 2) && xd > 0 && yd > 0) {
122
+ dpiX = unit === 2 ? xd * 2.54 : xd;
123
+ dpiY = unit === 2 ? yd * 2.54 : yd;
124
+ }
125
+ }
126
+ else if (marker === 0xe1 && latin1(b.subarray(seg, seg + 6)) === "Exif\0\0") {
127
+ try {
128
+ exif = exifDpi(b, seg + 6, len - 8);
129
+ }
130
+ catch {
131
+ exif = null;
132
+ }
133
+ }
134
+ else if (marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc) {
135
+ h = (b[seg + 1] << 8) | b[seg + 2];
136
+ w = (b[seg + 3] << 8) | b[seg + 4];
137
+ break;
138
+ }
139
+ p += 2 + len;
140
+ }
141
+ if (!w || !h)
142
+ return null;
143
+ if (dpiX == null && exif) {
144
+ dpiX = exif.x;
145
+ dpiY = exif.y;
146
+ }
147
+ return { w, h, dpiX, dpiY };
148
+ }
149
+ const UNIT_MM = { mm: 1, cm: 10, in: 25.4, pt: 25.4 / 72 };
150
+ export function svgInfo(b) {
151
+ const head = latin1(b, 4096);
152
+ const tag = /<svg\b[^>]*>/i.exec(head)?.[0] ?? "";
153
+ const attr = (n) => new RegExp(`\\b${n}\\s*=\\s*["']\\s*([\\d.]+)\\s*([a-z%]*)`, "i").exec(tag);
154
+ const wa = attr("width"), ha = attr("height");
155
+ if (wa && ha && UNIT_MM[wa[2].toLowerCase()] && UNIT_MM[ha[2].toLowerCase()]) {
156
+ return {
157
+ size: { width_mm: r1(Number(wa[1]) * UNIT_MM[wa[2].toLowerCase()]), height_mm: r1(Number(ha[1]) * UNIT_MM[ha[2].toLowerCase()]) },
158
+ ratio: null,
159
+ };
160
+ }
161
+ const vb = /viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(tag);
162
+ if (vb && Number(vb[2]) > 0)
163
+ return { size: null, ratio: Number(vb[1]) / Number(vb[2]) };
164
+ if (wa && ha && Number(ha[1]) > 0)
165
+ return { size: null, ratio: Number(wa[1]) / Number(ha[1]) };
166
+ return { size: null, ratio: null };
167
+ }
168
+ /** Eén unieke etiketmaat met dezelfde verhouding (staand of liggend), anders null. */
169
+ export function matchLabelByRatio(ratio, labels, tolerance = RATIO_TOLERANCE) {
170
+ if (!(ratio > 0))
171
+ return null;
172
+ const hits = new Map();
173
+ for (const l of labels) {
174
+ if (!(l.breedte_mm > 0 && l.hoogte_mm > 0))
175
+ continue;
176
+ const opts = [
177
+ { w: l.breedte_mm, h: l.hoogte_mm },
178
+ { w: l.hoogte_mm, h: l.breedte_mm },
179
+ ];
180
+ for (const o of opts) {
181
+ if (Math.abs(o.w / o.h - ratio) / ratio <= tolerance) {
182
+ const key = `${r1(o.w)}x${r1(o.h)}`;
183
+ if (!hits.has(key))
184
+ hits.set(key, { width_mm: r1(o.w), height_mm: r1(o.h), label: l.naam?.trim() || null, printer: l.printer });
185
+ break;
186
+ }
187
+ }
188
+ }
189
+ return hits.size === 1 ? [...hits.values()][0] : null;
190
+ }
191
+ export function detectStickerSize(bytes, mime, labels) {
192
+ const none = { method: "onbekend", size: null, suggestion: null, pixels: null };
193
+ try {
194
+ if (mime === "application/pdf") {
195
+ const s = pdfPageSizeMm(bytes);
196
+ return s ? { method: "pdf", size: s, suggestion: null } : none;
197
+ }
198
+ if (mime === "image/svg+xml") {
199
+ const s = svgInfo(bytes);
200
+ if (s.size)
201
+ return { method: "svg", size: s.size, suggestion: null };
202
+ const sug = s.ratio ? matchLabelByRatio(s.ratio, labels) : null;
203
+ return sug ? { method: "verhouding", size: null, suggestion: sug } : none;
204
+ }
205
+ const info = mime === "image/png" ? pngInfo(bytes) : mime === "image/jpeg" ? jpegInfo(bytes) : null;
206
+ if (!info)
207
+ return none;
208
+ const pixels = { w: info.w, h: info.h };
209
+ if (info.dpiX && info.dpiY) {
210
+ return {
211
+ method: "dpi",
212
+ size: { width_mm: r1((info.w / info.dpiX) * 25.4), height_mm: r1((info.h / info.dpiY) * 25.4) },
213
+ suggestion: null,
214
+ pixels,
215
+ };
216
+ }
217
+ const sug = matchLabelByRatio(info.w / info.h, labels);
218
+ return sug ? { method: "verhouding", size: null, suggestion: sug, pixels } : { ...none, pixels };
219
+ }
220
+ catch {
221
+ return none;
222
+ }
223
+ }
224
+ /** Zet geladen_etiket-jsonb uit Layouts om; onbruikbare waarden worden genegeerd. */
225
+ export function parseLoadedLabel(raw, printer) {
226
+ if (!raw || typeof raw !== "object")
227
+ return null;
228
+ const o = raw;
229
+ const b = Number(o.breedte_mm), h = Number(o.hoogte_mm);
230
+ if (!(b > 0 && h > 0))
231
+ return null;
232
+ return { naam: typeof o.naam === "string" ? o.naam : null, breedte_mm: b, hoogte_mm: h, printer };
233
+ }
@@ -105,6 +105,7 @@ export declare const adoptTwinfieldCustomer: import("@tanstack/start-client-core
105
105
  }) => {
106
106
  code: string;
107
107
  values: {
108
+ country: string | undefined;
108
109
  is_active: boolean;
109
110
  force: boolean;
110
111
  twinfield_create: boolean;
@@ -129,7 +130,6 @@ export declare const adoptTwinfieldCustomer: import("@tanstack/start-client-core
129
130
  street?: string | undefined;
130
131
  house_number?: string | undefined;
131
132
  city?: string | undefined;
132
- country?: string | undefined;
133
133
  customer_class?: string | undefined;
134
134
  notes?: string | undefined;
135
135
  customer_number?: string | undefined;
@@ -204,6 +204,7 @@ export declare const adoptTwinfieldCustomer: import("@tanstack/start-client-core
204
204
  custom_fields: import("../integrations/supabase/types.js").Json;
205
205
  customer_class: string | null;
206
206
  customer_number: string | null;
207
+ default_carrier_id: string | null;
207
208
  discount_days: number | null;
208
209
  discount_percentage: number | null;
209
210
  discount_surcharge: string;
@@ -1 +1 @@
1
- {"version":3,"file":"twinfield-adopt.functions.d.ts","sourceRoot":"","sources":["../../src/lib/twinfield-adopt.functions.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE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C;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF9E,CAAC"}
@@ -101,7 +101,7 @@ export function toPrefill(row) {
101
101
  house_number,
102
102
  postal_code: pick(addr.postcode, data.postcode, data.postal_code),
103
103
  city: pick(addr.city, data.city),
104
- country: countryCode ? toCountryName(countryCode) : "",
104
+ country: countryCode ? countryCode : "",
105
105
  vat_number: pick(row.vat_number, data.vat_number, data.vatnumber, addr.field4, addr.vat_number),
106
106
  website: pick(data.website),
107
107
  contact_person: pick(addr.contact, data.contact_person, attention),
@@ -125,7 +125,7 @@ export function toPrefill(row) {
125
125
  bank_bic: pick(bank.biccode, bank.bicode),
126
126
  bank_city: pick(bank.city),
127
127
  bank_postal_code: pick(bank.postcode),
128
- bank_country: pick(bank.country) ? toCountryName(pick(bank.country)) : "",
128
+ bank_country: pick(bank.country) ? pick(bank.country).toUpperCase() : "",
129
129
  bank_address_line1: pick(bank.address),
130
130
  ledger_account: pick(fin.substitutewith, data.grootboekrekening) || null,
131
131
  credit_limit: numOrNull(cm.basecreditlimit),
@@ -1,4 +1,4 @@
1
- import { countryNameFromIso, toIsoCountry } from "./countries.js";
1
+ import { toIsoCountry } from "./countries.js";
2
2
  export const EMPTY_CUSTOMER_DEFAULTS = {
3
3
  ledger_account: null, country: null, language: null, payment_term_days: null,
4
4
  missing: ["ledger_account", "country", "language", "payment_term_days"],
@@ -19,7 +19,7 @@ export function toCustomerDefaults(s) {
19
19
  const txt = (v) => (v === null || v === undefined || String(v).trim() === "" ? null : String(v).trim());
20
20
  const ledger = txt(s?.customer_gl_account);
21
21
  const iso = toIsoCountry(txt(s?.default_country));
22
- const country = iso ? countryNameFromIso(iso) : null;
22
+ const country = iso ?? null;
23
23
  const language = txt(s?.default_language)?.toLowerCase() ?? null;
24
24
  const n = Number(s?.sales_payment_term_days);
25
25
  const term = Number.isFinite(n) && n > 0 ? n : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-klanten-module",
3
- "version": "1.0.62",
3
+ "version": "1.0.67",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -73,7 +73,14 @@
73
73
  "schema": {
74
74
  "file": "schema/klanten.sql",
75
75
  "order": 40
76
- }
76
+ },
77
+ "ai": [
78
+ {
79
+ "moduleKey": "klanten-stickers",
80
+ "name": "Klantstickers",
81
+ "description": "Leest klantstickers met AI"
82
+ }
83
+ ]
77
84
  },
78
85
  "files": [
79
86
  "dist-lib",
@@ -113,8 +120,9 @@
113
120
  },
114
121
  "devDependencies": {
115
122
  "@cloudflare/vite-plugin": "^1.25.5",
123
+ "@electric-sql/pglite": "^0.5.11",
116
124
  "@eslint/js": "^9.32.0",
117
- "@flowselections/core": "1.0.29",
125
+ "@flowselections/core": "1.0.30",
118
126
  "@lovable.dev/vite-tanstack-config": "2.26.5",
119
127
  "@rsbuild/core": "^1.0.0",
120
128
  "@tailwindcss/vite": "^4.2.1",