@techallee/foodverse 1.0.0

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.
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MaterialThemeProjectNewConfig">
4
+ <option name="metadata">
5
+ <MTProjectMetadataState>
6
+ <option name="migrated" value="true" />
7
+ <option name="pristineConfig" value="false" />
8
+ <option name="userId" value="2d81b51f:190131dc07c:-7ffe" />
9
+ </MTProjectMetadataState>
10
+ </option>
11
+ </component>
12
+ </project>
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@techallee/foodverse",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "type": "commonjs"
13
+ }
@@ -0,0 +1,67 @@
1
+ type MenuSource = 'foodverse' | 'lieferando' | 'wolt' | 'uber_eats';
2
+
3
+ interface Specification {
4
+ id: string;
5
+ externalId?: string | null;
6
+ source: MenuSource;
7
+ name: string;
8
+ minQuantity: number;
9
+ maxQuantity: number;
10
+ prices: Price;
11
+ attributes: ItemAttributes;
12
+ status: boolean;
13
+ isMultiple: boolean;
14
+ restaurantId: string;
15
+ }
16
+
17
+ interface OptionGroup {
18
+ id: string;
19
+ externalId?: string | null;
20
+ source: MenuSource;
21
+ name: string;
22
+ isMultiple: boolean;
23
+ specifications: Specification[];
24
+ }
25
+
26
+ interface Variant {
27
+ id: string;
28
+ externalId?: string | null;
29
+ source: MenuSource;
30
+ code?: string | null;
31
+ name: string;
32
+ shippingTypes: DeliveryType[];
33
+ prices: Price;
34
+ attributes: ItemAttributes;
35
+ status: boolean;
36
+ productId: string;
37
+ }
38
+
39
+ interface Product {
40
+ id: string;
41
+ externalId?: string | null;
42
+ source: MenuSource;
43
+ imgUrl: string;
44
+ code?: string | null;
45
+ shortName: string;
46
+ name: string;
47
+ description: string;
48
+ allergies: any[];
49
+ extras: any[];
50
+ vatLevel: string; // Replace with VatLevelEnum if defined
51
+ status: boolean;
52
+ discount: any[];
53
+ categoryId: string;
54
+ variants: Variant[];
55
+ optionGroups: OptionGroup[];
56
+ }
57
+
58
+ interface Category {
59
+ id: string;
60
+ externalId?: string | null;
61
+ source: MenuSource;
62
+ name: string;
63
+ description: string;
64
+ rank: number;
65
+ restaurantId: string;
66
+ products: Product[];
67
+ }
@@ -0,0 +1,92 @@
1
+ type OrderSource = 'foodverse_web' | 'foodverse_local' | 'foodverse_terminal' | 'foodverse_app' | 'lieferando' | 'wolt' | 'uber_eats';
2
+ type PrintStatus = 'pending' | 'success' | 'error';
3
+ type OrderStatus = 'created' | 'confirmed' | 'prepared' | 'delivered' | 'cancelled'
4
+ type DeliveryType = 'service' | 'in_house' | 'pickup' | 'delivery';
5
+ type PaymentType = 'cash' | 'online' | 'card';
6
+
7
+ interface OrderSpecification {
8
+ name: string;
9
+ quantity: number;
10
+ price: number;
11
+ }
12
+
13
+ interface OrderProduct {
14
+ name: string;
15
+ categoryName: string;
16
+ code?: string | null;
17
+ quantity: number;
18
+ price: number;
19
+ totalPrice: number;
20
+ remarks?: string | null;
21
+ specifications: OrderSpecification[];
22
+ }
23
+
24
+ interface OrderPrices {
25
+ deliveryFee: number;
26
+ discountTotal: number;
27
+ subTotal: number;
28
+ totalPrice: number;
29
+ }
30
+
31
+ interface Address {
32
+ id: string;
33
+ fullName: string;
34
+ street: string | null;
35
+ houseNumber: string | null;
36
+ postcode: string | null;
37
+ city: string | null;
38
+ extra: string;
39
+ companyName: string | null;
40
+ phoneNumber: string | null;
41
+ phonePinCode: string | null;
42
+ latitude: number | null;
43
+ longitude: number | null;
44
+ distance: number | null;
45
+ route: [number, number][] | null;
46
+ bbox: [[number, number], [number, number]] | null;
47
+ userId: string | null;
48
+ }
49
+
50
+ interface Order {
51
+ id: string;
52
+ externalId?: string | null;
53
+ placedDate: string;
54
+ orderPlaced?: string | null;
55
+ orderDelivered?: string | null;
56
+ orderPickedUp?: string | null;
57
+ requestedTime?: string | null;
58
+ remarks: string;
59
+ remarksEn: string;
60
+ remarksVi: string;
61
+ publicReference: string;
62
+ dayReference: string;
63
+ source: OrderSource;
64
+ products: OrderProduct[];
65
+ prices: OrderPrices;
66
+ inKitchen: boolean;
67
+ isPending: boolean;
68
+ printStatus: PrintStatus;
69
+ basket: string;
70
+ paymentType: PaymentType;
71
+ deliveryType: DeliveryType;
72
+ status: OrderStatus;
73
+ areaId?: string | null;
74
+ customerId: string;
75
+ userId?: string | null;
76
+ restaurantId: string;
77
+ staffId?: string | null;
78
+ deliveredAt?: string | null;
79
+ arrivedAt?: string | null;
80
+
81
+ customer: Address,
82
+
83
+ remainingTime: number | null;
84
+ moving: boolean | null;
85
+ hidden: boolean | null;
86
+ tooltip: string | null;
87
+ size: [number, number];
88
+ anchor: [number, number];
89
+ icon: IconCollection;
90
+
91
+ staff?: Staff | null
92
+ }
@@ -0,0 +1,85 @@
1
+ type StationPrinterType = 'hardware' | 'software';
2
+ type CounterType = 'main_counter' | 'sub_counter';
3
+ type CounterOperator = 'equals' | 'contains' | 'starts_with' | 'ends_with';
4
+ type CounterPropertyType = 'product' | 'variant' | 'specification';
5
+ type PrintedProductStatus = 0 | 1 | 2 | 3; // 0: nothing, 1: drink, 2: food, 3: both
6
+
7
+ interface CounterProperty {
8
+ id: string;
9
+ operator: CounterOperator;
10
+ property: CounterPropertyType;
11
+ value: string;
12
+ quantity: number;
13
+ counterId: string;
14
+ }
15
+
16
+ interface PrintedProduct {
17
+ id: string;
18
+ stationPrinterId: string;
19
+ productName: string;
20
+ status: PrintedProductStatus;
21
+ showDetail: boolean;
22
+ }
23
+
24
+ interface Counter {
25
+ id: string;
26
+ name: string;
27
+ color: string;
28
+ priority: number;
29
+ type: CounterType;
30
+ stationPrinterId: string;
31
+ counterProperties: CounterProperty[];
32
+ }
33
+
34
+ interface StationPrinterOptions {
35
+ enabled: boolean;
36
+ deliveryTypes: DeliveryTypeEnum[];
37
+ mainCounters: boolean;
38
+ subCounters: boolean;
39
+ comboCounters: boolean;
40
+ mainCounterName: boolean;
41
+ subCounterName: boolean;
42
+ restaurantLogo: boolean;
43
+ restaurantName: boolean;
44
+ restaurantAddress: boolean;
45
+ telephoneNumber: boolean;
46
+ emailAddress: boolean;
47
+ website: boolean;
48
+ vatNumber: boolean;
49
+ dayReference: boolean;
50
+ customerAddress: boolean;
51
+ qrCode: boolean;
52
+ productCode: boolean;
53
+ productShortName: boolean;
54
+ price: boolean;
55
+ extras: boolean;
56
+ notice: boolean;
57
+ bigSize: boolean;
58
+ }
59
+
60
+ type StationPrinterOptionKey = keyof StationPrinterOptions;
61
+
62
+ interface StationPrinter {
63
+ id: string;
64
+ name: string;
65
+ printerName: string;
66
+ size: number;
67
+ options: StationPrinterOptions;
68
+ type: StationPrinterType;
69
+ mainCounters: Counter[];
70
+ subCounters: Counter[];
71
+ printedProducts: PrintedProduct[];
72
+
73
+ products?: string[];
74
+ }
75
+
76
+ interface CategoryOption {
77
+ name: string;
78
+ products: string[];
79
+ selected: boolean;
80
+ }
81
+
82
+ interface DeliveryTypeOption {
83
+ value: DeliveryType,
84
+ text: string,
85
+ }
@@ -0,0 +1,87 @@
1
+ type State = 'NATIONAL' | 'BW' | 'BY' | 'BE' | 'BB' | 'HB' | 'HH' | 'HE' | 'MV' | 'NI' | 'NW' | 'RP' | 'SL' | 'SN' | 'ST' | 'SH' | 'TH';
2
+
3
+ interface Floor {
4
+ id: string;
5
+ name: string;
6
+ displayName?: string | null;
7
+ width: number;
8
+ length: number;
9
+ furniture: any[];
10
+ onlineShopId: string;
11
+ }
12
+
13
+ interface MapGeoJsonFeature {
14
+ id: string;
15
+ type: 'Feature';
16
+ geometry: {
17
+ type: 'Polygon' | 'LineString' | 'Point';
18
+ coordinates: [number,number][][];
19
+ };
20
+ properties: {
21
+ postcode: string;
22
+ locality: string;
23
+ };
24
+ }
25
+
26
+ interface MapGeoJson {
27
+ id: string;
28
+ type: 'FeatureCollection';
29
+ areaId: string;
30
+ features: MapGeoJsonFeature[];
31
+ }
32
+
33
+ interface Area {
34
+ id: string;
35
+ radius: number;
36
+ deliveryFee: number;
37
+ onlineShopId: string;
38
+ geojson: MapGeoJson;
39
+ }
40
+
41
+ interface OnlineShop {
42
+ id: string;
43
+ active: boolean;
44
+ preorderStart: number;
45
+ preorderEnd: number;
46
+ orderInterval: number;
47
+ orderLimit: number;
48
+ paymentTypes: PaymentType[];
49
+ deliveryTypes: PaymentType[];
50
+ restaurantId: string;
51
+
52
+ floors: Floor[];
53
+ areas: Area[];
54
+ }
55
+
56
+ interface Tab {
57
+ id: string;
58
+ name: string;
59
+ icon: number;
60
+ restaurantId: string;
61
+ }
62
+
63
+ interface Restaurant {
64
+ id: string;
65
+ name: string;
66
+ street: string;
67
+ streetNumber: string;
68
+ postalCode: string;
69
+ city: string;
70
+ state: State;
71
+ telephone: string;
72
+ email: string;
73
+ logo: string;
74
+ website: string;
75
+ vatId: string;
76
+ latitude: number;
77
+ longitude: number;
78
+ token: string;
79
+ code: string;
80
+ ownerId?: string | null;
81
+
82
+ categories: Category[];
83
+ specifications: Specification[];
84
+ tabs: Tab[];
85
+ printers: StationPrinter[];
86
+ onlineShop: OnlineShop;
87
+ }
@@ -0,0 +1,11 @@
1
+ export interface SocketEventData<T> {
2
+ data: T;
3
+ }
4
+
5
+ export interface OrderCreatedData {
6
+ order: Order;
7
+ }
8
+
9
+ export interface OrderUpdatedData {
10
+ order: Partial<Order>;
11
+ }
@@ -0,0 +1,17 @@
1
+ type StaffStatus = 'active' | 'inactive' | 'locked';
2
+ type Role = 'admin' | 'waiter' | 'station' | 'manager' | 'kitchen' | 'courier';
3
+
4
+ interface Staff {
5
+ id: string;
6
+ name: string;
7
+ firstName: string;
8
+ lastName: string;
9
+ settings: Settings;
10
+ fullTime: boolean;
11
+ onDuty: boolean;
12
+ status: StaffStatus;
13
+ currentRole?: RoleEnum;
14
+ currentRoleId?: string;
15
+ teamId: string;
16
+ lastActive?: string;
17
+ }
@@ -0,0 +1,65 @@
1
+ interface SmoothZoomOptions {
2
+ wheelDebounceTime?: number
3
+ wheelPxPerZoomLevel?: number
4
+ easeLinearity?: number
5
+ duration?: number
6
+ }
7
+
8
+ interface DropController<T> {
9
+ onenter: () => void;
10
+ ondrop: (dropResult: DropResult<T>) => void;
11
+ payload: (index: number) => string;
12
+ accept: (_sourceContainerOptions, payload: T) => boolean;
13
+ }
14
+
15
+ type OrderDropController = Record<string, DropController<Order>>
16
+ type SelectedDriver = Record<string, Staff>
17
+
18
+ interface Polyline {
19
+ color: string;
20
+ latlngs: [number, number][];
21
+ }
22
+
23
+ interface IconCollection {
24
+ base: string;
25
+ opaque: string;
26
+ hidden: string;
27
+ }
28
+
29
+ interface MapProperties {
30
+ url: string;
31
+ attribution: string;
32
+ homeSize: [number, number];
33
+ homeAnchor: [number, number];
34
+ homeBigSize: [number, number];
35
+ homeBigAnchor: [number, number];
36
+ locationNormalSize: [number, number];
37
+ locationNormalAnchor: [number, number];
38
+ locationBigSize: [number, number];
39
+ locationBigAnchor: [number, number];
40
+ locationPreNormalSize: [number, number];
41
+ locationPreNormalAnchor: [number, number];
42
+ locationPreBigSize: [number, number];
43
+ locationPreBigAnchor: [number, number];
44
+ iconHome: string,
45
+ iconOrder: IconCollection,
46
+ iconOrder0: IconCollection,
47
+ iconOrder1: IconCollection,
48
+ iconOrder2: IconCollection,
49
+ iconOrder3: IconCollection,
50
+ iconPreOrder: IconCollection,
51
+ iconPreOrder0: IconCollection,
52
+ iconPreOrder1: IconCollection,
53
+ iconPreOrder2: IconCollection,
54
+ iconPreOrder3: IconCollection,
55
+ }
56
+
57
+ interface CookOrderRequestPayload {
58
+ basket: string,
59
+ }
60
+
61
+ interface DeliveryRequestPayload extends CookOrderRequestPayload{
62
+ orderIds: string[],
63
+ courierId: string,
64
+ basket: string,
65
+ }
@@ -0,0 +1,37 @@
1
+ interface RouteSettings {
2
+ icon: string,
3
+ tooltip: string,
4
+ route: string,
5
+ subscriptions: string[],
6
+ active: boolean
7
+ }
8
+
9
+ interface RouteSettingsCollection {
10
+ [key: string]: RouteSettings[]
11
+ }
12
+
13
+ interface ExpressDiscount {
14
+ id: number,
15
+ type: number,
16
+ amount: number,
17
+ }
18
+
19
+ interface Settings {
20
+ holidayState: string,
21
+ timeRange: [number, number],
22
+ timeView: boolean,
23
+
24
+ showMap: boolean,
25
+ mapApp: number,
26
+ directCall: boolean,
27
+ showingProducts: string[],
28
+ zoomSensitivity: number,
29
+
30
+ basketList: [number, number],
31
+ basketHeight: number,
32
+ defaultBasket: string | null,
33
+
34
+ expressDiscounts: ExpressDiscount[],
35
+
36
+ printer: string | null,
37
+ }
@@ -0,0 +1,59 @@
1
+ declare module 'vue3-smooth-dnd' {
2
+ import Vue from 'vue';
3
+
4
+ type Payload = any;
5
+
6
+ interface DropResult<T> {
7
+ removedIndex: number;
8
+ addedIndex: number;
9
+ payload: T;
10
+ element: Element;
11
+ }
12
+
13
+ interface DragEvent {
14
+ isSource: boolean;
15
+ payload: Payload;
16
+ willAcceptDrop: boolean;
17
+ }
18
+
19
+ interface NodeDescription {
20
+ value: string;
21
+ props: Vue.VNodeData;
22
+ }
23
+
24
+ interface ContainerProps {
25
+ orientation?: string;
26
+ behaviour?: string;
27
+ tag?: string | NodeDescription;
28
+ groupName?: string;
29
+ lockAxis?: string;
30
+ dragHandleSelector?: string;
31
+ nonDragAreaSelector?: string;
32
+ dragBeginDelay?: number;
33
+ animationDuration?: number;
34
+ autoScrollEnabled?: boolean;
35
+ dragClass?: string;
36
+ dropClass?: string;
37
+ removeOnDropOut?: boolean;
38
+ getChildPayload?: (index: number) => Payload;
39
+ shouldAnimateDrop?: (sourceContainerOptions: ContainerProps, payload: Payload) => boolean;
40
+ shouldAcceptDrop?: (sourceContainerOptions: ContainerProps, payload: Payload) => boolean;
41
+ getGhostParent: () => Element;
42
+ onDragStart?: (dragEvent: DragEvent) => void;
43
+ onDragEnd?: (dragEvent: DragEvent) => void;
44
+ onDrop?: (dropResult: DropResult) => void;
45
+ onDragEnter?: () => void;
46
+ onDragLeave?: () => void;
47
+ onDropReady?: (dropResult: DropResult) => void;
48
+ }
49
+
50
+ class Container extends Vue {
51
+ props: ContainerProps
52
+ }
53
+
54
+ class Draggable extends Vue {
55
+ props: {
56
+ tag?: string | NodeDescription;
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,25 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ /**
4
+ * Describes all existing environment variables and their types.
5
+ * Required for Code completion/intellisense and type checking.
6
+ *
7
+ * Note: To prevent accidentally leaking env variables to the client, only variables prefixed with `VITE_` are exposed to your Vite-processed code.
8
+ *
9
+ * @see https://github.com/vitejs/vite/blob/0a699856b248116632c1ac18515c0a5c7cf3d1db/packages/vite/types/importMeta.d.ts#L7-L14 Base Interface.
10
+ * @see https://vitejs.dev/guide/env-and-mode.html#env-files Vite Env Variables Doc.
11
+ */
12
+ interface ImportMetaEnv {
13
+ /**
14
+ * URL where `renderer` web page is running.
15
+ * This variable is initialized in scripts/watch.ts
16
+ */
17
+ readonly VITE_DEV_SERVER_URL: undefined | string;
18
+
19
+ /** Current app version */
20
+ readonly VITE_APP_VERSION: string;
21
+ }
22
+
23
+ interface ImportMeta {
24
+ readonly env: ImportMetaEnv;
25
+ }
@@ -0,0 +1,346 @@
1
+ // types/escpos.d.ts
2
+ declare module 'escpos' {
3
+ export interface PrinterOptions {
4
+ encoding?: string;
5
+ width?: number;
6
+ }
7
+
8
+ export interface ImageOptions {
9
+ type?: 'bmp' | 'png' | 'jpg';
10
+ mode?: 'dhdw' | 'dwh' | 'dhw' | 'dw' | 'dh' | 'normal';
11
+ density?: 'd8' | 'd24';
12
+ }
13
+
14
+ export interface BarcodeOptions {
15
+ width?: number;
16
+ height?: number;
17
+ includeParity?: boolean;
18
+ position?: 'off' | 'abv' | 'blw' | 'bth';
19
+ font?: 'a' | 'b';
20
+ }
21
+
22
+ export interface QRCodeOptions {
23
+ version?: number;
24
+ level?: 'l' | 'm' | 'q' | 'h';
25
+ size?: number;
26
+ }
27
+
28
+ export interface CashDrawerOptions {
29
+ pin?: number;
30
+ time?: number;
31
+ }
32
+
33
+ // Base adapter interface that all adapters should implement
34
+ export interface Adapter {
35
+ open(callback?: (error?: Error) => void): void;
36
+ close(callback?: (error?: Error) => void): void;
37
+ write(data: Buffer | Uint8Array | string, callback?: (error?: Error) => void): void;
38
+ }
39
+
40
+ // The main Printer class - this is the only class exported by escpos
41
+ export class Printer {
42
+ constructor(adapter: Adapter, options?: PrinterOptions);
43
+
44
+ // Text methods
45
+ text(content: string): this;
46
+ encode(encoding: string): this;
47
+ raw(data: Buffer | Uint8Array | string): this;
48
+
49
+ // Formatting methods
50
+ align(alignment: 'lt' | 'ct' | 'rt'): this;
51
+ font(family: 'a' | 'b' | 'c'): this;
52
+ size(width: number, height: number): this;
53
+ bold(enable?: boolean): this;
54
+ underline(enable?: boolean): this;
55
+ underlineThick(enable?: boolean): this;
56
+ upsideDown(enable?: boolean): this;
57
+ invert(enable?: boolean): this;
58
+
59
+ // Feed and cut methods
60
+ feed(lines?: number): this;
61
+ control(ctrl: string): this;
62
+ cut(mode?: boolean, lines?: number): this;
63
+
64
+ // Table methods
65
+ table(data: string[][]): this;
66
+ tableCustom(data: Array<{text: string, align?: string, width?: number}>): this;
67
+
68
+ // Barcode methods
69
+ barcode(data: string, type: string, options?: BarcodeOptions): this;
70
+ qrcode(data: string, version?: number, level?: string, size?: number): this;
71
+ qrcode(data: string, options?: QRCodeOptions): this;
72
+
73
+ // Image methods
74
+ image(image: Buffer | string, options?: ImageOptions): this;
75
+ raster(image: Buffer): this;
76
+
77
+ // Hardware methods
78
+ beep(times?: number, duration?: number): this;
79
+ cashdraw(pin?: number, time?: number): this;
80
+ cashdraw(options?: CashDrawerOptions): this;
81
+
82
+ // Connection methods
83
+ close(callback?: (error?: Error) => void): this;
84
+ then(onFulfilled?: () => void, onRejected?: (error: Error) => void): Promise<void>;
85
+ }
86
+
87
+ // Constants that might be available
88
+ export const ALIGN_CENTER: string;
89
+ export const ALIGN_LEFT: string;
90
+ export const ALIGN_RIGHT: string;
91
+ export const COLOR_1: number;
92
+ export const COLOR_2: number;
93
+ export const FONT_A: string;
94
+ export const FONT_B: string;
95
+ export const FONT_C: string;
96
+ export const TXT_NORMAL: number;
97
+ export const TXT_2HEIGHT: number;
98
+ export const TXT_2WIDTH: number;
99
+ export const TXT_4SQUARE: number;
100
+ export const TXT_UNDERL_OFF: number;
101
+ export const TXT_UNDERL_ON: number;
102
+ export const TXT_UNDERL2_ON: number;
103
+ export const TXT_BOLD_OFF: number;
104
+ export const TXT_BOLD_ON: number;
105
+ export const TXT_FONT_A: number;
106
+ export const TXT_FONT_B: number;
107
+ export const TXT_FONT_C: number;
108
+ export const TXT_ALIGN_LT: number;
109
+ export const TXT_ALIGN_CT: number;
110
+ export const TXT_ALIGN_RT: number;
111
+
112
+ // Barcode types
113
+ export const BARCODE_TXT_OFF: number;
114
+ export const BARCODE_TXT_ABV: number;
115
+ export const BARCODE_TXT_BLW: number;
116
+ export const BARCODE_TXT_BTH: number;
117
+ export const BARCODE_FONT_A: number;
118
+ export const BARCODE_FONT_B: number;
119
+ export const BARCODE_HEIGHT: number;
120
+ export const BARCODE_WIDTH: number;
121
+ export const BARCODE_UPC_A: number;
122
+ export const BARCODE_UPC_E: number;
123
+ export const BARCODE_EAN13: number;
124
+ export const BARCODE_EAN8: number;
125
+ export const BARCODE_CODE39: number;
126
+ export const BARCODE_ITF: number;
127
+ export const BARCODE_NW7: number;
128
+ export const BARCODE_CODE93: number;
129
+ export const BARCODE_CODE128: number;
130
+
131
+ // Paper cut types
132
+ export const PAPER_FULL_CUT: number;
133
+ export const PAPER_PART_CUT: number;
134
+
135
+ // Hardware
136
+ export const HW_INIT: string;
137
+ export const HW_SELECT: string;
138
+ export const HW_RESET: string;
139
+
140
+ // Cash drawer
141
+ export const CD_KICK_2: string;
142
+ export const CD_KICK_5: string;
143
+
144
+ // Paper
145
+ export const PAPER: any;
146
+
147
+ // Colors
148
+ export const COLORS: any;
149
+
150
+ // Image processing utilities
151
+ export namespace Image {
152
+ function load(path: string, callback: (image: any) => void): void;
153
+ function load(path: string): Promise<any>;
154
+ }
155
+
156
+ // Export Printer as default export only
157
+ export = Printer;
158
+
159
+ // Screen buffer
160
+ export class Screen {
161
+ constructor();
162
+ clear(): this;
163
+ move(x: number, y: number): this;
164
+ text(text: string, encoding?: string): this;
165
+ background(color: 'none' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white'): this;
166
+ display(): this;
167
+ close(): this;
168
+ }
169
+
170
+ // Image processing utilities
171
+ export namespace Image {
172
+ function load(path: string, callback: (image: any) => void): void;
173
+ function load(path: string): Promise<any>;
174
+ }
175
+
176
+ // Constants
177
+ export const ALIGN_CENTER: string;
178
+ export const ALIGN_LEFT: string;
179
+ export const ALIGN_RIGHT: string;
180
+ export const COLOR_1: number;
181
+ export const COLOR_2: number;
182
+ export const FONT_A: string;
183
+ export const FONT_B: string;
184
+ export const FONT_C: string;
185
+ export const TXT_NORMAL: number;
186
+ export const TXT_2HEIGHT: number;
187
+ export const TXT_2WIDTH: number;
188
+ export const TXT_4SQUARE: number;
189
+ export const TXT_UNDERL_OFF: number;
190
+ export const TXT_UNDERL_ON: number;
191
+ export const TXT_UNDERL2_ON: number;
192
+ export const TXT_BOLD_OFF: number;
193
+ export const TXT_BOLD_ON: number;
194
+ export const TXT_FONT_A: number;
195
+ export const TXT_FONT_B: number;
196
+ export const TXT_FONT_C: number;
197
+ export const TXT_ALIGN_LT: number;
198
+ export const TXT_ALIGN_CT: number;
199
+ export const TXT_ALIGN_RT: number;
200
+
201
+ // Barcode types
202
+ export const BARCODE_TXT_OFF: number;
203
+ export const BARCODE_TXT_ABV: number;
204
+ export const BARCODE_TXT_BLW: number;
205
+ export const BARCODE_TXT_BTH: number;
206
+ export const BARCODE_FONT_A: number;
207
+ export const BARCODE_FONT_B: number;
208
+ export const BARCODE_HEIGHT: number;
209
+ export const BARCODE_WIDTH: number;
210
+ export const BARCODE_UPC_A: number;
211
+ export const BARCODE_UPC_E: number;
212
+ export const BARCODE_EAN13: number;
213
+ export const BARCODE_EAN8: number;
214
+ export const BARCODE_CODE39: number;
215
+ export const BARCODE_ITF: number;
216
+ export const BARCODE_NW7: number;
217
+ export const BARCODE_CODE93: number;
218
+ export const BARCODE_CODE128: number;
219
+
220
+ // Paper cut types
221
+ export const PAPER_FULL_CUT: number;
222
+ export const PAPER_PART_CUT: number;
223
+
224
+ // Hardware
225
+ export const HW_INIT: string;
226
+ export const HW_SELECT: string;
227
+ export const HW_RESET: string;
228
+
229
+ // Cash drawer
230
+ export const CD_KICK_2: string;
231
+ export const CD_KICK_5: string;
232
+
233
+ // Paper
234
+ export const PAPER: any;
235
+
236
+ // Colors
237
+ export const COLORS: any;
238
+ }
239
+
240
+ // types/escpos-network.d.ts
241
+ declare module 'escpos-network' {
242
+ export interface NetworkOptions {
243
+ address: string;
244
+ port?: number;
245
+ timeout?: number;
246
+ retry?: number;
247
+ family?: number;
248
+ }
249
+
250
+ export class Network {
251
+ constructor(address: string, port?: number);
252
+ constructor(options: NetworkOptions);
253
+
254
+ address: string;
255
+ port: number;
256
+ timeout: number;
257
+ retry: number;
258
+ family: number;
259
+
260
+ open(callback?: (error?: Error) => void): void;
261
+ close(callback?: (error?: Error) => void): void;
262
+ write(data: Buffer | Uint8Array | string, callback?: (error?: Error) => void): void;
263
+
264
+ // Event emitter methods
265
+ on(event: 'connect' | 'close' | 'error' | 'timeout', callback: (data?: any) => void): this;
266
+ once(event: 'connect' | 'close' | 'error' | 'timeout', callback: (data?: any) => void): this;
267
+ emit(event: string, data?: any): boolean;
268
+ removeListener(event: string, callback: Function): this;
269
+ removeAllListeners(event?: string): this;
270
+ }
271
+
272
+ export = Network;
273
+ }
274
+
275
+ // types/escpos-usb.d.ts (bonus)
276
+ declare module 'escpos-usb' {
277
+ export interface USBDevice {
278
+ deviceDescriptor: {
279
+ idVendor: number;
280
+ idProduct: number;
281
+ };
282
+ }
283
+
284
+ export interface USBOptions {
285
+ vid?: number;
286
+ pid?: number;
287
+ type?: string;
288
+ endpoint?: number;
289
+ }
290
+
291
+ export class USB {
292
+ constructor(vid?: number, pid?: number);
293
+ constructor(options?: USBOptions);
294
+
295
+ device: USBDevice | null;
296
+
297
+ open(callback?: (error?: Error) => void): void;
298
+ close(callback?: (error?: Error) => void): void;
299
+ write(data: Buffer | Uint8Array | string, callback?: (error?: Error) => void): void;
300
+
301
+ static findPrinter(): USBDevice[];
302
+
303
+ // Event emitter methods
304
+ on(event: 'connect' | 'disconnect' | 'error', callback: (data?: any) => void): this;
305
+ once(event: 'connect' | 'disconnect' | 'error', callback: (data?: any) => void): this;
306
+ emit(event: string, data?: any): boolean;
307
+ }
308
+
309
+ export = USB;
310
+ }
311
+
312
+ // types/escpos-serialport.d.ts (bonus)
313
+ declare module 'escpos-serialport' {
314
+ export interface SerialOptions {
315
+ baudRate?: number;
316
+ dataBits?: number;
317
+ stopBits?: number;
318
+ parity?: 'none' | 'even' | 'mark' | 'odd' | 'space';
319
+ rtscts?: boolean;
320
+ xon?: boolean;
321
+ xoff?: boolean;
322
+ xany?: boolean;
323
+ autoOpen?: boolean;
324
+ }
325
+
326
+ export class Serial {
327
+ constructor(port: string, options?: SerialOptions);
328
+
329
+ port: string;
330
+ options: SerialOptions;
331
+
332
+ open(callback?: (error?: Error) => void): void;
333
+ close(callback?: (error?: Error) => void): void;
334
+ write(data: Buffer | Uint8Array | string, callback?: (error?: Error) => void): void;
335
+
336
+ // Event emitter methods
337
+ on(event: 'open' | 'close' | 'error' | 'data', callback: (data?: any) => void): this;
338
+ once(event: 'open' | 'close' | 'error' | 'data', callback: (data?: any) => void): this;
339
+ emit(event: string, data?: any): boolean;
340
+ }
341
+
342
+ export = Serial;
343
+ }
344
+
345
+ // types/index.d.ts (optional - for barrel exports)
346
+ /// <reference path="./escpos.d.ts" />
@@ -0,0 +1,54 @@
1
+ import type {Handler} from "leaflet";
2
+ import type {PrinterInfo} from "electron";
3
+ import {OrderCreatedData, OrderUpdatedData, SocketEventData} from "../api/socketEvent.js";
4
+
5
+ type MainProcessEvent<T> = (callback: (data: T) => void) => void
6
+
7
+ interface ElectronAPI {
8
+ /** Send to main process */
9
+ getRequest: <T>(url: string) => Promise<T>;
10
+ postRequest: <T>(url: string, payload: unknown) => Promise<T>;
11
+ patchRequest: <T>(url: string, payload: unknown) => Promise<T>;
12
+ deleteRequest: <T>(url: string, payload: unknown) => Promise<T>;
13
+ updateToken: (token: string) => Promise<Restaurant>;
14
+ connectSocket: (token: string, restaurantId: string) => Promise<void>;
15
+
16
+ isTokenLoaded: () => Promise<string | null | undefined>;
17
+
18
+ getSystemPrinters: () => Promise<PrinterInfo[]>;
19
+
20
+ printOnce: (order: Order, printer: StationPrinter, restaurant: Restaurant) => Promise<boolean>;
21
+ printTest: (printerName: string) => Promise<boolean>;
22
+
23
+ /** Receive from main process */
24
+ onOrderCreated: MainProcessEvent<OrderCreatedData>;
25
+ onOrderUpdated: MainProcessEvent<OrderUpdatedData>;
26
+ }
27
+
28
+ declare global {
29
+ interface Map {
30
+ SmoothWheelZoom: Handler
31
+ }
32
+ interface Window {
33
+ api: ElectronAPI;
34
+ }
35
+ }
36
+
37
+
38
+ interface Price {
39
+ price: number;
40
+ pickupPrice: number;
41
+ deliveryPrice: number;
42
+ }
43
+
44
+ interface ItemAttribute {
45
+ depositAmount?: string;
46
+ volume?: string;
47
+ alcoholVolume?: string;
48
+ caffeineAmount?: string;
49
+ isAlcoholic: boolean;
50
+ isVegan: boolean;
51
+ isVegetarian: boolean;
52
+ isGlutenFree: boolean;
53
+ isLactoseFree: boolean;
54
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ }
7
+ }