@flowselections/scan-module 1.0.2 → 1.0.4
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/ScanModulePage.d.ts.map +1 -1
- package/dist-lib/components/ScanModulePage.js +71 -16
- package/dist-lib/components/scanners/KarScannerPage.d.ts +3 -1
- package/dist-lib/components/scanners/KarScannerPage.d.ts.map +1 -1
- package/dist-lib/components/scanners/KarScannerPage.js +87 -8
- package/dist-lib/components/scanners/PublicScannerPage.d.ts +2 -1
- package/dist-lib/components/scanners/PublicScannerPage.d.ts.map +1 -1
- package/dist-lib/components/scanners/PublicScannerPage.js +2 -2
- package/dist-lib/components/scanners/ScannerBySlug.d.ts.map +1 -1
- package/dist-lib/components/scanners/ScannerBySlug.js +3 -2
- package/dist-lib/hooks/useScanners.d.ts +3 -1
- package/dist-lib/hooks/useScanners.d.ts.map +1 -1
- package/dist-lib/hooks/useScanners.js +1 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +2482 -311
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +2482 -311
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +2482 -311
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +2557 -366
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +15 -1
- package/dist-lib/lib/scanI18n.d.ts +1 -1
- package/dist-lib/lib/scanI18n.d.ts.map +1 -1
- package/dist-lib/lib/scanI18n.js +139 -1
- package/dist-lib/lib/shellHost.functions.d.ts +3 -0
- package/dist-lib/lib/shellHost.functions.d.ts.map +1 -0
- package/dist-lib/lib/shellHost.functions.js +5 -0
- package/dist-lib/lib/shellHost.server.d.ts +12 -0
- package/dist-lib/lib/shellHost.server.d.ts.map +1 -0
- package/dist-lib/lib/shellHost.server.js +91 -0
- package/dist-lib/lib/veilingbonPrint.d.ts +43 -0
- package/dist-lib/lib/veilingbonPrint.d.ts.map +1 -0
- package/dist-lib/lib/veilingbonPrint.js +124 -0
- package/package.json +105 -103
|
@@ -8,7 +8,18 @@ export const Constants = {
|
|
|
8
8
|
"klaar",
|
|
9
9
|
"mislukt",
|
|
10
10
|
],
|
|
11
|
-
app_role: [
|
|
11
|
+
app_role: [
|
|
12
|
+
"admin",
|
|
13
|
+
"planner",
|
|
14
|
+
"monteur",
|
|
15
|
+
"administratie",
|
|
16
|
+
"ai_admin",
|
|
17
|
+
"manager",
|
|
18
|
+
"warehouse",
|
|
19
|
+
"sales",
|
|
20
|
+
"developer",
|
|
21
|
+
"receptie",
|
|
22
|
+
],
|
|
12
23
|
doc_layout_type: [
|
|
13
24
|
"pakbon",
|
|
14
25
|
"factuur",
|
|
@@ -24,6 +35,9 @@ export const Constants = {
|
|
|
24
35
|
"vrij",
|
|
25
36
|
"sticker",
|
|
26
37
|
"productiebon",
|
|
38
|
+
"veilingbon",
|
|
39
|
+
"afleverbrief",
|
|
40
|
+
"veilingbrief",
|
|
27
41
|
],
|
|
28
42
|
doc_orientation: ["portrait", "landscape"],
|
|
29
43
|
exact_env: ["staging", "live"],
|
|
@@ -5,7 +5,7 @@ export interface ScanLanguage {
|
|
|
5
5
|
locale: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const SCAN_LANGUAGES: ScanLanguage[];
|
|
8
|
-
export type ScanTextKey = "chooseLanguage" | "chooseLanguageHint" | "changeLanguage" | "scanner" | "defaultSubtitle" | "loggedInAs" | "otherEmployee" | "whoScans" | "nameHint" | "name" | "namePlaceholder" | "pin" | "startScanning" | "fillName" | "wrongPin" | "restart" | "stepPakbon" | "stepScanning" | "stepReady" | "searchPakbon" | "scanPakbon" | "closeScanZone" | "openPakbonnen" | "loading" | "noPakbonnen" | "noSearchResults" | "order" | "buffer" | "next" | "pakbon" | "pakbonnen" | "products" | "selectAtLeastOne" | "scanZone" | "scanZoneHint" | "startCamera" | "stopCamera" | "codePlaceholder" | "pakbonCodePlaceholder" | "productCodePlaceholder" | "confirmCode" | "inProgressBy" | "finishWithOpen" | "nothingScannedYet" | "cameraUnsupported" | "remaining" | "productsScanned" | "pakbonnenOnCart" | "lastScanned" | "nothingScanned" | "remove" | "fust" | "fustAdded" | "makeVeilingbon" | "veilingbonCreated" | "pakbonStatus" | "allProcessed" | "stillOpen" | "newCart" | "historyNote" | "print" | "pickStation" | "sentToPrinter" | "sentToPick";
|
|
8
|
+
export type ScanTextKey = "chooseLanguage" | "chooseLanguageHint" | "changeLanguage" | "scanner" | "defaultSubtitle" | "loggedInAs" | "otherEmployee" | "whoScans" | "nameHint" | "name" | "namePlaceholder" | "pin" | "startScanning" | "fillName" | "wrongPin" | "restart" | "stepPakbon" | "stepScanning" | "stepReady" | "searchPakbon" | "scanPakbon" | "closeScanZone" | "openPakbonnen" | "loading" | "noPakbonnen" | "noSearchResults" | "order" | "buffer" | "next" | "pakbon" | "pakbonnen" | "products" | "selectAtLeastOne" | "scanZone" | "scanZoneHint" | "startCamera" | "stopCamera" | "codePlaceholder" | "pakbonCodePlaceholder" | "productCodePlaceholder" | "confirmCode" | "inProgressBy" | "finishWithOpen" | "nothingScannedYet" | "cameraUnsupported" | "remaining" | "productsScanned" | "pakbonnenOnCart" | "lastScanned" | "nothingScanned" | "remove" | "fust" | "fustAdded" | "makeVeilingbon" | "veilingbonCreated" | "pakbonStatus" | "allProcessed" | "stillOpen" | "newCart" | "historyNote" | "print" | "pickStation" | "sentToPrinter" | "sentToPick" | "printNoWorkplace" | "printNoPrinter" | "printSending" | "printQueued" | "printBusy" | "printDone" | "printFailed" | "printAlreadyQueued" | "printAgain";
|
|
9
9
|
export type ScanDict = Record<ScanTextKey, string>;
|
|
10
10
|
export type ScanT = (key: ScanTextKey, vars?: Record<string, string | number>) => string;
|
|
11
11
|
export declare function getScanTexts(code?: string | null): ScanDict;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanI18n.d.ts","sourceRoot":"","sources":["../../src/lib/scanI18n.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,EAAE,YAAY,EAaxC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,SAAS,GACT,iBAAiB,GACjB,YAAY,GACZ,eAAe,GACf,UAAU,GACV,UAAU,GACV,MAAM,GACN,iBAAiB,GACjB,KAAK,GACL,eAAe,GACf,UAAU,GACV,UAAU,GACV,SAAS,GACT,YAAY,GACZ,cAAc,GACd,WAAW,GACX,cAAc,GACd,YAAY,GACZ,eAAe,GACf,eAAe,GACf,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,WAAW,GACX,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,cAAc,GACd,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,uBAAuB,GACvB,wBAAwB,GACxB,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,GACnB,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,QAAQ,GACR,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,GACd,cAAc,GACd,WAAW,GACX,SAAS,GACT,aAAa,GACb,OAAO,GACP,aAAa,GACb,eAAe,GACf,YAAY,CAAC;AAEjB,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"scanI18n.d.ts","sourceRoot":"","sources":["../../src/lib/scanI18n.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,EAAE,YAAY,EAaxC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,SAAS,GACT,iBAAiB,GACjB,YAAY,GACZ,eAAe,GACf,UAAU,GACV,UAAU,GACV,MAAM,GACN,iBAAiB,GACjB,KAAK,GACL,eAAe,GACf,UAAU,GACV,UAAU,GACV,SAAS,GACT,YAAY,GACZ,cAAc,GACd,WAAW,GACX,cAAc,GACd,YAAY,GACZ,eAAe,GACf,eAAe,GACf,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,WAAW,GACX,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,cAAc,GACd,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,uBAAuB,GACvB,wBAAwB,GACxB,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,GACnB,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,QAAQ,GACR,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,GACd,cAAc,GACd,WAAW,GACX,SAAS,GACT,aAAa,GACb,OAAO,GACP,aAAa,GACb,eAAe,GACf,YAAY,GACZ,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,WAAW,GACX,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,YAAY,CAAC;AAEjB,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAm8BnD,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAEzF,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAK3D;AAED,uDAAuD;AACvD,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAWvD;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,WAAsC,CAAC"}
|
package/dist-lib/lib/scanI18n.js
CHANGED
|
@@ -790,6 +790,141 @@ const uk = {
|
|
|
790
790
|
sentToPrinter: "Аукціонну накладну надіслано на принтер",
|
|
791
791
|
sentToPick: "Аукціонну накладну надіслано до Pick Station",
|
|
792
792
|
};
|
|
793
|
+
// ── Printteksten (centrale print-API) ───────────────────────────────────────
|
|
794
|
+
const PRINT_TEXTS = {
|
|
795
|
+
nl: {
|
|
796
|
+
printNoWorkplace: "Geen werkplek ingesteld voor deze scanner",
|
|
797
|
+
printNoPrinter: "Geen printer gekoppeld aan werkplek {n} — stel dit in bij Layouts & printers",
|
|
798
|
+
printSending: "Bezig met versturen…",
|
|
799
|
+
printQueued: "Staat in de wachtrij",
|
|
800
|
+
printBusy: "Wordt geprint…",
|
|
801
|
+
printDone: "Geprint",
|
|
802
|
+
printFailed: "Printen mislukt: {n}",
|
|
803
|
+
printAlreadyQueued: "Stond al in de wachtrij",
|
|
804
|
+
printAgain: "Opnieuw printen",
|
|
805
|
+
},
|
|
806
|
+
en: {
|
|
807
|
+
printNoWorkplace: "No workplace set for this scanner",
|
|
808
|
+
printNoPrinter: "No printer linked to workplace {n} — set this up in Layouts & printers",
|
|
809
|
+
printSending: "Sending…",
|
|
810
|
+
printQueued: "In the print queue",
|
|
811
|
+
printBusy: "Printing…",
|
|
812
|
+
printDone: "Printed",
|
|
813
|
+
printFailed: "Printing failed: {n}",
|
|
814
|
+
printAlreadyQueued: "Was already in the queue",
|
|
815
|
+
printAgain: "Print again",
|
|
816
|
+
},
|
|
817
|
+
de: {
|
|
818
|
+
printNoWorkplace: "Für diesen Scanner ist kein Arbeitsplatz eingestellt",
|
|
819
|
+
printNoPrinter: "Kein Drucker mit Arbeitsplatz {n} verknüpft — bitte in Layouts & Drucker einstellen",
|
|
820
|
+
printSending: "Wird gesendet…",
|
|
821
|
+
printQueued: "In der Warteschlange",
|
|
822
|
+
printBusy: "Wird gedruckt…",
|
|
823
|
+
printDone: "Gedruckt",
|
|
824
|
+
printFailed: "Drucken fehlgeschlagen: {n}",
|
|
825
|
+
printAlreadyQueued: "Stand bereits in der Warteschlange",
|
|
826
|
+
printAgain: "Erneut drucken",
|
|
827
|
+
},
|
|
828
|
+
fr: {
|
|
829
|
+
printNoWorkplace: "Aucun poste de travail défini pour ce scanner",
|
|
830
|
+
printNoPrinter: "Aucune imprimante liée au poste {n} — configurez-la dans Layouts & imprimantes",
|
|
831
|
+
printSending: "Envoi en cours…",
|
|
832
|
+
printQueued: "Dans la file d'attente",
|
|
833
|
+
printBusy: "Impression en cours…",
|
|
834
|
+
printDone: "Imprimé",
|
|
835
|
+
printFailed: "Échec de l'impression : {n}",
|
|
836
|
+
printAlreadyQueued: "Était déjà dans la file d'attente",
|
|
837
|
+
printAgain: "Imprimer à nouveau",
|
|
838
|
+
},
|
|
839
|
+
it: {
|
|
840
|
+
printNoWorkplace: "Nessuna postazione impostata per questo scanner",
|
|
841
|
+
printNoPrinter: "Nessuna stampante collegata alla postazione {n} — impostala in Layouts e stampanti",
|
|
842
|
+
printSending: "Invio in corso…",
|
|
843
|
+
printQueued: "In coda di stampa",
|
|
844
|
+
printBusy: "Stampa in corso…",
|
|
845
|
+
printDone: "Stampato",
|
|
846
|
+
printFailed: "Stampa non riuscita: {n}",
|
|
847
|
+
printAlreadyQueued: "Era già in coda",
|
|
848
|
+
printAgain: "Stampa di nuovo",
|
|
849
|
+
},
|
|
850
|
+
es: {
|
|
851
|
+
printNoWorkplace: "No hay puesto de trabajo configurado para este escáner",
|
|
852
|
+
printNoPrinter: "Ninguna impresora vinculada al puesto {n} — configúrelo en Layouts e impresoras",
|
|
853
|
+
printSending: "Enviando…",
|
|
854
|
+
printQueued: "En la cola de impresión",
|
|
855
|
+
printBusy: "Imprimiendo…",
|
|
856
|
+
printDone: "Impreso",
|
|
857
|
+
printFailed: "Error al imprimir: {n}",
|
|
858
|
+
printAlreadyQueued: "Ya estaba en la cola",
|
|
859
|
+
printAgain: "Imprimir de nuevo",
|
|
860
|
+
},
|
|
861
|
+
da: {
|
|
862
|
+
printNoWorkplace: "Ingen arbejdsplads angivet for denne scanner",
|
|
863
|
+
printNoPrinter: "Ingen printer knyttet til arbejdspladsen {n} — indstil det under Layouts og printere",
|
|
864
|
+
printSending: "Sender…",
|
|
865
|
+
printQueued: "I printkøen",
|
|
866
|
+
printBusy: "Udskriver…",
|
|
867
|
+
printDone: "Udskrevet",
|
|
868
|
+
printFailed: "Udskrivning mislykkedes: {n}",
|
|
869
|
+
printAlreadyQueued: "Stod allerede i køen",
|
|
870
|
+
printAgain: "Udskriv igen",
|
|
871
|
+
},
|
|
872
|
+
sv: {
|
|
873
|
+
printNoWorkplace: "Ingen arbetsplats inställd för denna skanner",
|
|
874
|
+
printNoPrinter: "Ingen skrivare kopplad till arbetsplatsen {n} — ställ in det under Layouts och skrivare",
|
|
875
|
+
printSending: "Skickar…",
|
|
876
|
+
printQueued: "I utskriftskön",
|
|
877
|
+
printBusy: "Skriver ut…",
|
|
878
|
+
printDone: "Utskriven",
|
|
879
|
+
printFailed: "Utskriften misslyckades: {n}",
|
|
880
|
+
printAlreadyQueued: "Fanns redan i kön",
|
|
881
|
+
printAgain: "Skriv ut igen",
|
|
882
|
+
},
|
|
883
|
+
pl: {
|
|
884
|
+
printNoWorkplace: "Nie ustawiono stanowiska dla tego skanera",
|
|
885
|
+
printNoPrinter: "Brak drukarki przypisanej do stanowiska {n} — ustaw to w Layouts i drukarki",
|
|
886
|
+
printSending: "Wysyłanie…",
|
|
887
|
+
printQueued: "W kolejce wydruku",
|
|
888
|
+
printBusy: "Drukowanie…",
|
|
889
|
+
printDone: "Wydrukowano",
|
|
890
|
+
printFailed: "Drukowanie nie powiodło się: {n}",
|
|
891
|
+
printAlreadyQueued: "Było już w kolejce",
|
|
892
|
+
printAgain: "Drukuj ponownie",
|
|
893
|
+
},
|
|
894
|
+
ro: {
|
|
895
|
+
printNoWorkplace: "Nicio stație de lucru setată pentru acest scaner",
|
|
896
|
+
printNoPrinter: "Nicio imprimantă asociată stației {n} — configurați în Layouts și imprimante",
|
|
897
|
+
printSending: "Se trimite…",
|
|
898
|
+
printQueued: "În coada de printare",
|
|
899
|
+
printBusy: "Se printează…",
|
|
900
|
+
printDone: "Printat",
|
|
901
|
+
printFailed: "Printarea a eșuat: {n}",
|
|
902
|
+
printAlreadyQueued: "Era deja în coadă",
|
|
903
|
+
printAgain: "Printează din nou",
|
|
904
|
+
},
|
|
905
|
+
bg: {
|
|
906
|
+
printNoWorkplace: "Няма зададено работно място за този скенер",
|
|
907
|
+
printNoPrinter: "Няма принтер, свързан с работно място {n} — настройте го в Layouts и принтери",
|
|
908
|
+
printSending: "Изпраща се…",
|
|
909
|
+
printQueued: "В опашката за печат",
|
|
910
|
+
printBusy: "Печата се…",
|
|
911
|
+
printDone: "Отпечатано",
|
|
912
|
+
printFailed: "Печатът е неуспешен: {n}",
|
|
913
|
+
printAlreadyQueued: "Вече беше в опашката",
|
|
914
|
+
printAgain: "Печат отново",
|
|
915
|
+
},
|
|
916
|
+
uk: {
|
|
917
|
+
printNoWorkplace: "Для цього сканера не задано робоче місце",
|
|
918
|
+
printNoPrinter: "Немає принтера, прив'язаного до робочого місця {n} — налаштуйте у Layouts і принтери",
|
|
919
|
+
printSending: "Надсилання…",
|
|
920
|
+
printQueued: "У черзі друку",
|
|
921
|
+
printBusy: "Друкується…",
|
|
922
|
+
printDone: "Надруковано",
|
|
923
|
+
printFailed: "Не вдалося надрукувати: {n}",
|
|
924
|
+
printAlreadyQueued: "Уже було в черзі",
|
|
925
|
+
printAgain: "Надрукувати ще раз",
|
|
926
|
+
},
|
|
927
|
+
};
|
|
793
928
|
const DICTS = {
|
|
794
929
|
nl,
|
|
795
930
|
en,
|
|
@@ -805,7 +940,10 @@ const DICTS = {
|
|
|
805
940
|
uk,
|
|
806
941
|
};
|
|
807
942
|
export function getScanTexts(code) {
|
|
808
|
-
|
|
943
|
+
const taal = code ?? "nl";
|
|
944
|
+
const basis = DICTS[taal] ?? nl;
|
|
945
|
+
const print = PRINT_TEXTS[taal] ?? PRINT_TEXTS["en"];
|
|
946
|
+
return { ...basis, ...PRINT_TEXTS["nl"], ...print };
|
|
809
947
|
}
|
|
810
948
|
/** Vertaalfunctie met eenvoudige {naam}-vervanging. */
|
|
811
949
|
export function createScanT(code) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellHost.functions.d.ts","sourceRoot":"","sources":["../../src/lib/shellHost.functions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,aAAa,0GAKzB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ShellHostFout = "geen-config" | "onbereikbaar" | "unauthorized" | "geen-shell-host";
|
|
2
|
+
export type ShellHostResultaat = {
|
|
3
|
+
ok: true;
|
|
4
|
+
host: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reden: ShellHostFout;
|
|
8
|
+
status?: number;
|
|
9
|
+
};
|
|
10
|
+
/** Succes wordt kort gecached; fouten nooit, zodat herstel meteen zichtbaar is. */
|
|
11
|
+
export declare function getShellHost(): Promise<ShellHostResultaat>;
|
|
12
|
+
//# sourceMappingURL=shellHost.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellHost.server.d.ts","sourceRoot":"","sources":["../../src/lib/shellHost.server.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,cAAc,GACd,cAAc,GACd,iBAAiB,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkEzD,mFAAmF;AACnF,wBAAsB,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAchE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/shellHost.server.ts — SHELL-HOST VIA CENTRAL-AUTH
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Central-auth kent de shell-host van elke tenant:
|
|
5
|
+
// GET {CENTRAL_AUTH_URL}/api/shell-host
|
|
6
|
+
// Authorization: Bearer <CENTRAL_AUTH_SECRET>
|
|
7
|
+
// 200 -> { "shell_host": "https://m.klant.flowselections.com" }
|
|
8
|
+
//
|
|
9
|
+
// FAIL-CLOSED: elke storing levert een reden op, nooit een gegokte URL.
|
|
10
|
+
// CENTRAL_AUTH_SECRET is een serversecret — dit bestand is server-only
|
|
11
|
+
// (*.server.ts wordt uit de clientbundel geweerd).
|
|
12
|
+
// ============================================================================
|
|
13
|
+
const TIMEOUT_MS = 10000;
|
|
14
|
+
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
15
|
+
let cache;
|
|
16
|
+
let lopend;
|
|
17
|
+
/** Waarde is pas bruikbaar als central zelf het scheme meelevert. */
|
|
18
|
+
function normaliseer(waarde) {
|
|
19
|
+
if (typeof waarde !== "string")
|
|
20
|
+
return null;
|
|
21
|
+
const schoon = waarde.trim().replace(/\/+$/, "");
|
|
22
|
+
if (schoon === "")
|
|
23
|
+
return null;
|
|
24
|
+
// Geen scheme? Dan liever een zichtbare fout dan een gegokte URL.
|
|
25
|
+
if (!/^https?:\/\//i.test(schoon))
|
|
26
|
+
return null;
|
|
27
|
+
return schoon;
|
|
28
|
+
}
|
|
29
|
+
async function haalOp() {
|
|
30
|
+
const baseUrl = process.env["CENTRAL_AUTH_URL"];
|
|
31
|
+
const secret = process.env["CENTRAL_AUTH_SECRET"];
|
|
32
|
+
if (!baseUrl || !secret)
|
|
33
|
+
return { ok: false, reden: "geen-config" };
|
|
34
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/api/shell-host`;
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
37
|
+
let response;
|
|
38
|
+
try {
|
|
39
|
+
response = await fetch(url, {
|
|
40
|
+
method: "GET",
|
|
41
|
+
headers: { Authorization: `Bearer ${secret}` },
|
|
42
|
+
signal: controller.signal,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
console.error("[shell-host] central-auth niet bereikbaar");
|
|
47
|
+
return { ok: false, reden: "onbereikbaar" };
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
}
|
|
52
|
+
if (response.status === 401 || response.status === 403) {
|
|
53
|
+
console.error("[shell-host] central-auth wees de aanvraag af", response.status);
|
|
54
|
+
return { ok: false, reden: "unauthorized", status: response.status };
|
|
55
|
+
}
|
|
56
|
+
if (response.status === 404) {
|
|
57
|
+
return { ok: false, reden: "geen-shell-host", status: 404 };
|
|
58
|
+
}
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
console.error("[shell-host] onverwachte status van central-auth", response.status);
|
|
61
|
+
return { ok: false, reden: "onbereikbaar", status: response.status };
|
|
62
|
+
}
|
|
63
|
+
let body;
|
|
64
|
+
try {
|
|
65
|
+
body = await response.json();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return { ok: false, reden: "onbereikbaar", status: response.status };
|
|
69
|
+
}
|
|
70
|
+
const host = normaliseer(body?.shell_host);
|
|
71
|
+
if (!host)
|
|
72
|
+
return { ok: false, reden: "geen-shell-host", status: response.status };
|
|
73
|
+
return { ok: true, host };
|
|
74
|
+
}
|
|
75
|
+
/** Succes wordt kort gecached; fouten nooit, zodat herstel meteen zichtbaar is. */
|
|
76
|
+
export async function getShellHost() {
|
|
77
|
+
if (cache && cache.tot > Date.now())
|
|
78
|
+
return { ok: true, host: cache.host };
|
|
79
|
+
if (lopend)
|
|
80
|
+
return lopend;
|
|
81
|
+
lopend = haalOp()
|
|
82
|
+
.then((resultaat) => {
|
|
83
|
+
if (resultaat.ok)
|
|
84
|
+
cache = { host: resultaat.host, tot: Date.now() + CACHE_TTL_MS };
|
|
85
|
+
return resultaat;
|
|
86
|
+
})
|
|
87
|
+
.finally(() => {
|
|
88
|
+
lopend = undefined;
|
|
89
|
+
});
|
|
90
|
+
return lopend;
|
|
91
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const VEILINGBON_PAPIERFORMAAT = "A4";
|
|
2
|
+
export type PrintJobStatus = "wachtend" | "bezig" | "voltooid" | "mislukt" | "geannuleerd";
|
|
3
|
+
export interface VeilingbonRegel {
|
|
4
|
+
product_code: string;
|
|
5
|
+
product_naam: string | null;
|
|
6
|
+
aantal: number;
|
|
7
|
+
}
|
|
8
|
+
export interface VeilingbonPayload {
|
|
9
|
+
karnummer: string;
|
|
10
|
+
ordernummer: string;
|
|
11
|
+
buffer: string;
|
|
12
|
+
klanten: string[];
|
|
13
|
+
medewerker: string;
|
|
14
|
+
regels: VeilingbonRegel[];
|
|
15
|
+
}
|
|
16
|
+
/** Dezelfde bon stond al in de wachtrij (dubbelbeveiliging van de print-API). */
|
|
17
|
+
export declare function isDubbeleAanvraag(fout: unknown): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Printer die bij een werkplek hoort. De werkplek moet gelijk zijn aan de
|
|
20
|
+
* locatie- of systeemnaam van de printer in Layouts & printers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function printerVoorWerkplek(werkplek: string | null | undefined, papierformaat?: string): Promise<string | null>;
|
|
23
|
+
export interface VeilingbonPrintResultaat {
|
|
24
|
+
jobId: string;
|
|
25
|
+
printerId: string | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Zet de veilingbon in de centrale printwachtrij.
|
|
29
|
+
* Eerst altijd printDocument (mét printerId). Alleen als daar geen layout voor
|
|
30
|
+
* bestaat volgt printHtml met de bestaande veilingbon-HTML. Nooit allebei.
|
|
31
|
+
*/
|
|
32
|
+
export declare function printVeilingbon(opties: {
|
|
33
|
+
printerId: string;
|
|
34
|
+
documentnaam: string;
|
|
35
|
+
payload: VeilingbonPayload;
|
|
36
|
+
html: string;
|
|
37
|
+
isHerprint?: boolean;
|
|
38
|
+
}): Promise<VeilingbonPrintResultaat>;
|
|
39
|
+
/** Volgt de status van een printopdracht. Geeft een opzegfunctie terug. */
|
|
40
|
+
export declare function volgJobStatus(jobId: string, callback: (status: PrintJobStatus, foutmelding?: string | null) => void): () => void;
|
|
41
|
+
/** HTML-variant van de veilingbon (alleen gebruikt als er geen layout is). */
|
|
42
|
+
export declare function veilingbonHtml(payload: VeilingbonPayload): string;
|
|
43
|
+
//# sourceMappingURL=veilingbonPrint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"veilingbonPrint.d.ts","sourceRoot":"","sources":["../../src/lib/veilingbonPrint.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAQD,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKxD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,aAAa,GAAE,MAAiC,GAC/C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqBxB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAgBpC;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GACtE,MAAM,IAAI,CA0BZ;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA6BjE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/veilingbonPrint.ts — VEILINGBON VIA DE CENTRALE PRINT-API
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// De scanner-module schrijft NOOIT zelf in print_jobs en beheert geen printers.
|
|
5
|
+
// Alles loopt via @flowselections/layout-maker. Zolang een helper daar nog niet
|
|
6
|
+
// in zit, wordt een read-only vervanger gebruikt (printerlijst / statuslezen).
|
|
7
|
+
// ============================================================================
|
|
8
|
+
import * as layoutMaker from "@flowselections/layout-maker";
|
|
9
|
+
import { supabase } from "@flowselections/core";
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
|
+
const lm = layoutMaker;
|
|
12
|
+
const db = supabase;
|
|
13
|
+
export const VEILINGBON_PAPIERFORMAAT = "A4";
|
|
14
|
+
/** Fout die aangeeft dat er geen layout bestaat voor het documenttype. */
|
|
15
|
+
function isGeenLayoutFout(fout) {
|
|
16
|
+
const bericht = fout instanceof Error ? fout.message : String(fout ?? "");
|
|
17
|
+
return /geen layout gevonden/i.test(bericht);
|
|
18
|
+
}
|
|
19
|
+
/** Dezelfde bon stond al in de wachtrij (dubbelbeveiliging van de print-API). */
|
|
20
|
+
export function isDubbeleAanvraag(fout) {
|
|
21
|
+
const Dubbel = lm.DubbeleAanvraagFout;
|
|
22
|
+
if (typeof Dubbel === "function" && fout instanceof Dubbel)
|
|
23
|
+
return true;
|
|
24
|
+
const bericht = fout instanceof Error ? fout.message : String(fout ?? "");
|
|
25
|
+
return /dubbele aanvraag|al in de wachtrij|reeds aangevraagd/i.test(bericht);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Printer die bij een werkplek hoort. De werkplek moet gelijk zijn aan de
|
|
29
|
+
* locatie- of systeemnaam van de printer in Layouts & printers.
|
|
30
|
+
*/
|
|
31
|
+
export async function printerVoorWerkplek(werkplek, papierformaat = VEILINGBON_PAPIERFORMAAT) {
|
|
32
|
+
const plek = (werkplek ?? "").trim();
|
|
33
|
+
if (!plek)
|
|
34
|
+
return null;
|
|
35
|
+
if (typeof lm.printerVoorWerkplek === "function") {
|
|
36
|
+
const gevonden = await lm.printerVoorWerkplek(plek, papierformaat);
|
|
37
|
+
if (!gevonden)
|
|
38
|
+
return null;
|
|
39
|
+
return typeof gevonden === "string" ? gevonden : (gevonden.id ?? null);
|
|
40
|
+
}
|
|
41
|
+
// Terugval: read-only printerlijst uit de centrale module.
|
|
42
|
+
if (typeof lm.beschikbarePrinters !== "function")
|
|
43
|
+
return null;
|
|
44
|
+
const printers = await lm.beschikbarePrinters();
|
|
45
|
+
const lijst = Array.isArray(printers) ? printers : [];
|
|
46
|
+
const past = (p) => [p?.locatie, p?.naam].some((waarde) => typeof waarde === "string" && waarde.trim().toLowerCase() === plek.toLowerCase()) && p?.actief !== false;
|
|
47
|
+
const opFormaat = lijst.filter((p) => past(p) && (!p?.papierformaat || p.papierformaat === papierformaat));
|
|
48
|
+
const gekozen = opFormaat[0] ?? lijst.filter(past)[0];
|
|
49
|
+
return gekozen?.id ?? null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Zet de veilingbon in de centrale printwachtrij.
|
|
53
|
+
* Eerst altijd printDocument (mét printerId). Alleen als daar geen layout voor
|
|
54
|
+
* bestaat volgt printHtml met de bestaande veilingbon-HTML. Nooit allebei.
|
|
55
|
+
*/
|
|
56
|
+
export async function printVeilingbon(opties) {
|
|
57
|
+
const basis = {
|
|
58
|
+
documenttype: "veilingbon",
|
|
59
|
+
documentnaam: opties.documentnaam,
|
|
60
|
+
printerId: opties.printerId,
|
|
61
|
+
isHerprint: opties.isHerprint === true,
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
const res = await lm.printDocument({ ...basis, payload: opties.payload });
|
|
65
|
+
return { jobId: res?.jobId, printerId: res?.printerId ?? opties.printerId };
|
|
66
|
+
}
|
|
67
|
+
catch (fout) {
|
|
68
|
+
if (!isGeenLayoutFout(fout) || typeof lm.printHtml !== "function")
|
|
69
|
+
throw fout;
|
|
70
|
+
const res = await lm.printHtml({ ...basis, html: opties.html });
|
|
71
|
+
return { jobId: res?.jobId, printerId: res?.printerId ?? opties.printerId };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Volgt de status van een printopdracht. Geeft een opzegfunctie terug. */
|
|
75
|
+
export function volgJobStatus(jobId, callback) {
|
|
76
|
+
if (typeof lm.volgJobStatus === "function") {
|
|
77
|
+
const stop = lm.volgJobStatus(jobId, (job) => {
|
|
78
|
+
const status = (typeof job === "string" ? job : job?.status);
|
|
79
|
+
callback(status, typeof job === "object" ? (job?.foutmelding ?? null) : null);
|
|
80
|
+
});
|
|
81
|
+
return typeof stop === "function" ? stop : () => { };
|
|
82
|
+
}
|
|
83
|
+
// Terugval: read-only status uitlezen tot de opdracht klaar is.
|
|
84
|
+
let actief = true;
|
|
85
|
+
const lees = async () => {
|
|
86
|
+
const { data } = await db.from("print_jobs").select("status, foutmelding").eq("id", jobId).maybeSingle();
|
|
87
|
+
if (!actief || !data)
|
|
88
|
+
return;
|
|
89
|
+
callback(data.status, data.foutmelding ?? null);
|
|
90
|
+
if (data.status === "voltooid" || data.status === "mislukt" || data.status === "geannuleerd") {
|
|
91
|
+
actief = false;
|
|
92
|
+
clearInterval(timer);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const timer = setInterval(() => void lees(), 2000);
|
|
96
|
+
void lees();
|
|
97
|
+
return () => {
|
|
98
|
+
actief = false;
|
|
99
|
+
clearInterval(timer);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** HTML-variant van de veilingbon (alleen gebruikt als er geen layout is). */
|
|
103
|
+
export function veilingbonHtml(payload) {
|
|
104
|
+
const esc = (waarde) => String(waarde ?? "")
|
|
105
|
+
.split("&").join("&")
|
|
106
|
+
.split("<").join("<")
|
|
107
|
+
.split(">").join(">");
|
|
108
|
+
const regels = payload.regels
|
|
109
|
+
.map((r) => `<tr><td>${esc(r.product_code)}</td><td>${esc(r.product_naam ?? "")}</td><td style="text-align:right">${esc(r.aantal)}</td></tr>`)
|
|
110
|
+
.join("");
|
|
111
|
+
return `<!doctype html><html lang="nl"><head><meta charset="utf-8"><title>Veilingbon ${esc(payload.karnummer)}</title><style>
|
|
112
|
+
body{font-family:Arial,Helvetica,sans-serif;font-size:12pt;margin:16mm}
|
|
113
|
+
h1{font-size:20pt;margin:0 0 4mm}
|
|
114
|
+
table{width:100%;border-collapse:collapse;margin-top:6mm}
|
|
115
|
+
th,td{border-bottom:1px solid #999;padding:2mm 1mm;text-align:left}
|
|
116
|
+
</style></head><body>
|
|
117
|
+
<h1>Veilingbon ${esc(payload.karnummer)}</h1>
|
|
118
|
+
<p>Order: ${esc(payload.ordernummer)} · Buffer: ${esc(payload.buffer)}</p>
|
|
119
|
+
<p>Klanten: ${esc(payload.klanten.join(", "))}</p>
|
|
120
|
+
<p>Medewerker: ${esc(payload.medewerker)}</p>
|
|
121
|
+
<table><thead><tr><th>Code</th><th>Product</th><th style="text-align:right">Aantal</th></tr></thead>
|
|
122
|
+
<tbody>${regels}</tbody></table>
|
|
123
|
+
</body></html>`;
|
|
124
|
+
}
|