deskmanager-ui 0.0.1

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,604 @@
1
+ import * as react from 'react';
2
+ import react__default, { ReactNode, ForwardRefExoticComponent, RefAttributes, MouseEvent } from 'react';
3
+ import { IconProps } from '@solar-icons/react';
4
+ import * as axios from 'axios';
5
+ import { Method } from 'axios';
6
+ import * as _mui_material from '@mui/material';
7
+ import { Accept } from 'react-dropzone';
8
+
9
+ interface HeaderProps {
10
+ sections?: string[];
11
+ }
12
+ declare function Header({ sections, }: HeaderProps): react.JSX.Element;
13
+
14
+ interface ModalActionProps {
15
+ visible: boolean;
16
+ title: string;
17
+ description?: string;
18
+ confirmText?: string;
19
+ cancelText?: string;
20
+ icon?: ReactNode;
21
+ onClose?: () => void;
22
+ onConfirm?: () => Promise<void> | void;
23
+ autoCloseOnSuccess?: boolean;
24
+ /**
25
+ * Si es true el usuario no podrá cerrar
26
+ * el modal mientras se ejecuta onConfirm.
27
+ *
28
+ * Default: true
29
+ */
30
+ lockWhileLoading?: boolean;
31
+ }
32
+ declare const ModalAction: ({ visible, title, description, confirmText, cancelText, icon, onClose, onConfirm, autoCloseOnSuccess, lockWhileLoading, }: ModalActionProps) => react.JSX.Element;
33
+
34
+ interface UserTwoFA {
35
+ active: boolean;
36
+ secret: string;
37
+ updatedAt: Date;
38
+ }
39
+ interface User {
40
+ _id: string;
41
+ active: boolean;
42
+ isInvite: boolean;
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ firstName: string;
46
+ lastName: string;
47
+ email: string;
48
+ phone: string;
49
+ acceptTerms: boolean;
50
+ image: string;
51
+ rol: string;
52
+ language: string;
53
+ twoFa: UserTwoFA;
54
+ }
55
+
56
+ interface Category {
57
+ _id: string;
58
+ value: string;
59
+ label: string;
60
+ type: string;
61
+ isDefault: boolean;
62
+ parent: string | null;
63
+ name: string;
64
+ }
65
+
66
+ interface ClientOption {
67
+ value: string;
68
+ label: string;
69
+ }
70
+ interface Client {
71
+ _id: string;
72
+ name: string;
73
+ }
74
+
75
+ interface Supplier {
76
+ _id: string;
77
+ name: string;
78
+ }
79
+
80
+ declare enum TaxType {
81
+ IVA = "IVA",
82
+ ISR = "ISR",
83
+ IEPS = "IEPS"
84
+ }
85
+ declare enum FactorType {
86
+ TASA = "Tasa",
87
+ CUOTA = "Cuota",
88
+ EXENTO = "Exento"
89
+ }
90
+ declare enum IepsMode {
91
+ SUM_BEFORE_TAXES = "sum_before_taxes",
92
+ BREAK_DOWN = "break_down",
93
+ UNIT = "unit",
94
+ SUBTRACT_BEFORE_BREAK_DOWN = "subtract_before_break_down"
95
+ }
96
+ interface Tax {
97
+ type: TaxType;
98
+ factor: FactorType;
99
+ rate: number;
100
+ withholding: boolean;
101
+ ieps_mode: IepsMode;
102
+ base: number;
103
+ total: number;
104
+ }
105
+
106
+ interface Account {
107
+ _id: string;
108
+ name: string;
109
+ value: string;
110
+ label: string;
111
+ }
112
+
113
+ declare enum Taxability {
114
+ _01 = "01",// No objeto de impuesto
115
+ _02 = "02",// Sí objeto de impuesto
116
+ _03 = "03"
117
+ }
118
+
119
+ declare enum PaymentMethod {
120
+ CASH = "cash",
121
+ TRANSFER = "transfer",
122
+ CARD = "card",
123
+ CREDIT_CARD = "credit_card",
124
+ DEBIT_CARD = "debit_card",
125
+ CHECK = "check",
126
+ OTHER = "other"
127
+ }
128
+ declare enum PaymentStatus {
129
+ PENDING = "pending",
130
+ PAID = "paid",
131
+ UNPAID = "unpaid",
132
+ CANCELED = "canceled"
133
+ }
134
+ declare enum TypePayment {
135
+ INCOME = "income",
136
+ EXPENSE = "expense"
137
+ }
138
+ declare enum PaymentAction {
139
+ VIEW = "view",
140
+ EDIT = "edit",
141
+ DELETE = "delete",
142
+ MAKE_PAID = "makePaid",
143
+ MAKE_PENDING = "makePending",
144
+ MAKE_CANCELED = "makeCanceled",
145
+ SELECTED = "selected"
146
+ }
147
+ interface Payment {
148
+ _id: string;
149
+ folio: string;
150
+ user: User;
151
+ notes: string;
152
+ type: TypePayment;
153
+ paymentMethod: PaymentMethod;
154
+ status: PaymentStatus;
155
+ paymentDate: string;
156
+ billingDate: string;
157
+ subtotal: number;
158
+ total: number;
159
+ category: Category;
160
+ subcategory: Category;
161
+ client: Client | null;
162
+ supplier: Supplier | null;
163
+ tax_active: boolean;
164
+ tax_included: boolean;
165
+ taxability: Taxability;
166
+ taxes: Tax[];
167
+ account: Account | null;
168
+ }
169
+
170
+ interface PaymentTableRowProps {
171
+ data: Payment;
172
+ selected?: boolean;
173
+ onAction?: (action: PaymentAction, payment: Payment, event: React.MouseEvent<HTMLElement>) => void;
174
+ }
175
+ declare const PaymentTableRow: ({ data, selected, onAction }: PaymentTableRowProps) => react.JSX.Element;
176
+
177
+ interface PaymentModalProps {
178
+ visible: boolean;
179
+ onClose: (value: boolean | Payment | null) => void;
180
+ data: Payment | null;
181
+ type: TypePayment | null;
182
+ }
183
+ declare const PaymentModal: ({ visible, onClose, data, type, ...props }: PaymentModalProps) => react__default.JSX.Element;
184
+
185
+ type SolarIcon = ForwardRefExoticComponent<Omit<IconProps, "ref"> & RefAttributes<SVGSVGElement>>;
186
+ interface BulkActionBarAction {
187
+ id: string;
188
+ label: string;
189
+ icon: SolarIcon;
190
+ tone?: "default" | "success" | "warning" | "danger";
191
+ }
192
+ interface BulkActionBarProps {
193
+ selectedCount: number;
194
+ actions: BulkActionBarAction[];
195
+ onAction: (action: BulkActionBarAction, event: MouseEvent<HTMLButtonElement>) => void;
196
+ onCancelSelection: (event: MouseEvent<HTMLButtonElement>) => void;
197
+ selectedLabel?: (count: number) => string;
198
+ }
199
+ declare const BulkActionBar: ({ selectedCount, actions, onAction, onCancelSelection, selectedLabel, }: BulkActionBarProps) => react.JSX.Element | null;
200
+
201
+ declare const API: string | undefined;
202
+ declare const API_LOCAL: string | undefined;
203
+ declare const STATUS_COLORS: {
204
+ paid: string;
205
+ pending: string;
206
+ canceled: string;
207
+ unpaid: string;
208
+ };
209
+
210
+ type HttpMethod = Method;
211
+ type HttpData = Record<string, unknown>;
212
+ declare const HTTP_API: axios.AxiosInstance;
213
+ declare const HTTP: <TResponse = unknown>(method?: HttpMethod, url?: string, data?: HttpData, accessToken?: string | false) => Promise<TResponse>;
214
+
215
+ declare const createAppTheme: (prefersDarkMode: boolean) => _mui_material.Theme;
216
+
217
+ declare const formatCurrency: (amount: number, decimals?: number) => string;
218
+ declare const formatBytes: (bytes: number, decimals?: number) => string;
219
+
220
+ interface UserContextType {
221
+ user: User | null;
222
+ isMobile: boolean;
223
+ openSidebar: boolean;
224
+ updateUser: React.Dispatch<React.SetStateAction<User | null>>;
225
+ closeSidebar: () => void;
226
+ toggleOpen: () => void;
227
+ }
228
+ interface UserProviderProps {
229
+ children: ReactNode;
230
+ user?: User | null;
231
+ isMobile?: boolean;
232
+ }
233
+ declare function UserProvider({ children, user: initialUser, isMobile: initialIsMobile, }: UserProviderProps): react.JSX.Element;
234
+ declare function useUser(): UserContextType;
235
+
236
+ interface BusinessCrudPermissions {
237
+ FULL_ACCESS: boolean;
238
+ CREATE: boolean;
239
+ EDIT: boolean;
240
+ DELETE: boolean;
241
+ }
242
+ interface BusinessPayrollPermissions {
243
+ FULL_ACCESS: boolean;
244
+ CALENDAR_ACCESS: boolean;
245
+ CALENDAR_CREATE: boolean;
246
+ CALENDAR_EDIT: boolean;
247
+ CALENDAR_DELETE: boolean;
248
+ LOANS_ACCESS: boolean;
249
+ LOANS_CREATE: boolean;
250
+ LOANS_EDIT: boolean;
251
+ LOANS_DELETE: boolean;
252
+ PAYSHEET_ACCESS: boolean;
253
+ PAYSHEET_CREATE: boolean;
254
+ PAYSHEET_EDIT: boolean;
255
+ PAYSHEET_DELETE: boolean;
256
+ STATISTICS_ACCESS: boolean;
257
+ }
258
+ interface BusinessStorehousePermissions extends BusinessCrudPermissions {
259
+ INVENTORY_CREATE: boolean;
260
+ ENTRIES_CREATE: boolean;
261
+ EXITS_CREATE: boolean;
262
+ PURCHASE_ORDERS_CREATE: boolean;
263
+ DELIVER_MERCHANDISE: boolean;
264
+ }
265
+ interface BusinessProjectsPermissions {
266
+ FULL_ACCESS: boolean;
267
+ READ: boolean;
268
+ CREATE: boolean;
269
+ EDIT: boolean;
270
+ DELETE: boolean;
271
+ }
272
+ interface BusinessBillingPermissions {
273
+ FULL_ACCESS: boolean;
274
+ READ: boolean;
275
+ CREATE_INVOICES: boolean;
276
+ CANCEL_INVOICES: boolean;
277
+ CREATE_COMPLEMENTS: boolean;
278
+ }
279
+ interface BusinessCataloguePermissions {
280
+ FULL_ACCESS: boolean;
281
+ CREATE: boolean;
282
+ EDIT: boolean;
283
+ DELETE: boolean;
284
+ CREATE_TPU: boolean;
285
+ }
286
+ interface BusinessSettingsPermissions {
287
+ FULL_ACCESS: boolean;
288
+ READ: boolean;
289
+ BUY: boolean;
290
+ UPDATE_BUSINESS_INFO: boolean;
291
+ ADD_USERS: boolean;
292
+ REMOVE_USERS: boolean;
293
+ UPDATE_USERS_PERMISSIONS: boolean;
294
+ }
295
+ interface PermissionsBusiness {
296
+ PAYROLL: BusinessPayrollPermissions;
297
+ EMPLOYEES: BusinessCrudPermissions;
298
+ CLIENTS: BusinessCrudPermissions;
299
+ PROVIDERS: BusinessCrudPermissions;
300
+ STOREHOUSE: BusinessStorehousePermissions;
301
+ PROJECTS: BusinessProjectsPermissions;
302
+ BILLING: BusinessBillingPermissions;
303
+ CATALOG: BusinessCataloguePermissions;
304
+ SETTINGS: BusinessSettingsPermissions;
305
+ }
306
+ type PermissionSection = keyof PermissionsBusiness;
307
+ type PermissionAction<S extends PermissionSection = PermissionSection> = S extends PermissionSection ? keyof PermissionsBusiness[S] & string : never;
308
+ interface BusinessPermissions {
309
+ _id?: string;
310
+ active: boolean;
311
+ business: string;
312
+ user: string;
313
+ permissions: PermissionsBusiness;
314
+ createdAt?: string;
315
+ updatedAt?: string;
316
+ }
317
+ interface SessionPermissionsResponse {
318
+ permissions: PermissionsBusiness | null;
319
+ }
320
+
321
+ interface PermissionsContextValue {
322
+ businessId: string | null;
323
+ permissions: PermissionsBusiness | null;
324
+ loading: boolean;
325
+ refresh: () => Promise<void>;
326
+ iCan: <S extends PermissionSection>(section: S, action: PermissionAction<S>) => boolean;
327
+ }
328
+ interface PermissionsProviderProps {
329
+ children: ReactNode;
330
+ }
331
+ declare function PermissionsProvider({ children }: PermissionsProviderProps): react.JSX.Element;
332
+ declare function usePermissions(): PermissionsContextValue;
333
+
334
+ interface BusinessItem {
335
+ _id: string;
336
+ name: string;
337
+ businessName: string;
338
+ image: string;
339
+ }
340
+
341
+ declare enum UploadFileMode {
342
+ SINGLE = "single",
343
+ MULTIPART = "multipart"
344
+ }
345
+ interface UploadProgress {
346
+ percentage: number;
347
+ uploadedBytes: number;
348
+ totalBytes: number;
349
+ chunkIndex: number;
350
+ totalChunks: number;
351
+ mode: UploadFileMode;
352
+ fileName: string;
353
+ }
354
+
355
+ interface Request {
356
+ _id: string;
357
+ folio: string;
358
+ active: boolean;
359
+ user: User;
360
+ }
361
+
362
+ declare enum PurchaseAction {
363
+ SELECTED = "selected",
364
+ VIEW = "view",
365
+ EDIT = "edit",
366
+ DELETE = "delete",
367
+ MAKE_CANCELED = "makeCanceled",
368
+ MAKE_CLOSED = "makeClosed",
369
+ REOPEN = "reopen"
370
+ }
371
+ declare enum PurchaseItemAction {
372
+ SELECTED = "selected",
373
+ VIEW = "view",
374
+ EDIT = "edit",
375
+ DELETE = "delete"
376
+ }
377
+ declare enum PurchaseStatus {
378
+ DRAFT = "draft",
379
+ CANCELED = "canceled",
380
+ CLOSED = "closed",
381
+ RECEIVED = "received"
382
+ }
383
+ interface PurchaseItem {
384
+ _id: string;
385
+ catalogue_id: string | null;
386
+ name_snapshot: string;
387
+ code_snapshot: string;
388
+ sku_snapshot: string;
389
+ unit_snapshot: string;
390
+ description_snapshot: string;
391
+ qty_ordered: number;
392
+ qty_received: number;
393
+ unit_cost: number;
394
+ discount: number;
395
+ sub_total: number;
396
+ total: number;
397
+ tax_active: boolean;
398
+ tax_type: string;
399
+ tax_included: boolean;
400
+ taxability: Taxability;
401
+ taxes: Tax[];
402
+ }
403
+ interface PurchaseHistory {
404
+ _id: string;
405
+ status: string;
406
+ user: User;
407
+ date: string;
408
+ }
409
+ declare enum PaymentControlMode {
410
+ BY_ORDER = "BY_ORDER",
411
+ BY_RECEIPT = "BY_RECEIPT",
412
+ ADVANCE_AND_RECEIPT = "ADVANCE_AND_RECEIPT"
413
+ }
414
+ declare enum InventoryMode {
415
+ NONE = "none",//no afecta el stock
416
+ INCOMING = "incoming",//afecta el stock de entrada
417
+ OUTGOING = "outgoing"
418
+ }
419
+ interface Purchase {
420
+ _id: string;
421
+ active: boolean;
422
+ taxes_summary: Tax[];
423
+ folio: string;
424
+ status: PurchaseStatus;
425
+ user: User;
426
+ sub_total: number;
427
+ total: number;
428
+ paid_total: number;
429
+ supplier: Supplier;
430
+ notes: string;
431
+ request: Request | null;
432
+ items: PurchaseItem[];
433
+ history: PurchaseHistory[];
434
+ createdAt: string;
435
+ updatedAt: string;
436
+ payment_control_mode: PaymentControlMode;
437
+ inventory_mode: InventoryMode;
438
+ target_id: string | null;
439
+ target_type: string | null;
440
+ }
441
+
442
+ interface ClientContextValue {
443
+ businessId: string | null;
444
+ clients: ClientOption[];
445
+ loading: boolean;
446
+ save: React.Dispatch<React.SetStateAction<ClientOption[]>>;
447
+ refresh: () => Promise<void>;
448
+ clear: () => void;
449
+ }
450
+ interface ClientProviderProps {
451
+ children: ReactNode;
452
+ persist?: boolean;
453
+ }
454
+ declare function ClientProvider({ children, persist, }: ClientProviderProps): react.JSX.Element;
455
+ declare function useClient(): ClientContextValue;
456
+
457
+ interface CategoryContextValue {
458
+ businessId: string | null;
459
+ categories: Category[];
460
+ loading: boolean;
461
+ refresh: () => Promise<void>;
462
+ clear: () => void;
463
+ }
464
+ interface CategoryProviderProps {
465
+ children: ReactNode;
466
+ }
467
+ declare function CategoryProvider({ children }: CategoryProviderProps): react.JSX.Element;
468
+ declare function useCategory(): CategoryContextValue;
469
+
470
+ interface AccountContextValue {
471
+ businessId: string | null;
472
+ accounts: Account[];
473
+ loading: boolean;
474
+ refresh: () => Promise<void>;
475
+ clear: () => void;
476
+ }
477
+ interface AccountProviderProps {
478
+ children: ReactNode;
479
+ }
480
+ declare function AccountProvider({ children }: AccountProviderProps): react.JSX.Element;
481
+ declare function useAccount(): AccountContextValue;
482
+
483
+ interface SelectOption {
484
+ label: string;
485
+ value: string | number | boolean | null;
486
+ }
487
+ interface SelectAutocompleteFormProps {
488
+ name?: string;
489
+ label?: string;
490
+ value: SelectOption | null;
491
+ placeholder?: string;
492
+ onChange: (value: SelectOption | null) => void;
493
+ options: SelectOption[];
494
+ disabled?: boolean;
495
+ error?: boolean;
496
+ helperText?: string;
497
+ }
498
+ declare const SelectAutocomplete: ({ name, label, value, placeholder, onChange, options, disabled, error, helperText, }: SelectAutocompleteFormProps) => react.JSX.Element;
499
+
500
+ interface ProviderContextValue {
501
+ businessId: string | null;
502
+ providers: SelectOption[];
503
+ loading: boolean;
504
+ refresh: () => Promise<void>;
505
+ clear: () => void;
506
+ }
507
+ interface ProviderProviderProps {
508
+ children: ReactNode;
509
+ }
510
+ declare function ProviderProvider({ children }: ProviderProviderProps): react.JSX.Element;
511
+ declare function useProvider(): ProviderContextValue;
512
+
513
+ interface CatalogueContextValue {
514
+ businessId: string | null;
515
+ catalogues: SelectOption[];
516
+ loading: boolean;
517
+ refresh: () => Promise<void>;
518
+ clear: () => void;
519
+ }
520
+ interface CatalogueProviderProps {
521
+ children: ReactNode;
522
+ }
523
+ declare function CatalogueProvider({ children }: CatalogueProviderProps): react.JSX.Element;
524
+ declare function useCatalogue(): CatalogueContextValue;
525
+
526
+ declare enum DocumentUploadStatus {
527
+ UPLOADING = "uploading",
528
+ COMPLETED = "completed",
529
+ FAILED = "failed"
530
+ }
531
+ interface Document {
532
+ _id: string;
533
+ active: boolean;
534
+ type: string;
535
+ actor_id: string;
536
+ originalName: string;
537
+ size: number;
538
+ mimeType: string;
539
+ key: string;
540
+ uploadStatus: DocumentUploadStatus;
541
+ createdAt: Date;
542
+ updatedAt: Date;
543
+ url: string;
544
+ }
545
+
546
+ interface DocumentUploadProps {
547
+ businessId: string;
548
+ actorId: string | number;
549
+ type: string;
550
+ onUploaded: (document: Document) => void;
551
+ onProgress?: (progress: UploadProgress) => void;
552
+ onError?: (error: unknown) => void;
553
+ chunkSizeBytes?: number;
554
+ multipartThresholdBytes?: number;
555
+ accept?: Accept;
556
+ disabled?: boolean;
557
+ }
558
+ declare const DocumentUpload: ({ businessId, actorId, type, onUploaded, onProgress, onError, chunkSizeBytes, multipartThresholdBytes, accept, disabled, }: DocumentUploadProps) => react.JSX.Element;
559
+
560
+ interface DocumentRowProps {
561
+ data: Document;
562
+ onDelete?: (document: Document) => void;
563
+ }
564
+ declare const DocumentRow: ({ data, onDelete }: DocumentRowProps) => react.JSX.Element;
565
+
566
+ interface PurchaseTableRowProps {
567
+ data: Purchase;
568
+ selected?: boolean;
569
+ onAction?: (action: PurchaseAction, purchase: Purchase, event: React.MouseEvent<HTMLElement>) => void;
570
+ }
571
+ declare const PurchaseTableRow: ({ data, selected, onAction }: PurchaseTableRowProps) => react.JSX.Element;
572
+
573
+ type PurchaseTargetType = string;
574
+ interface PurchaseModalProps {
575
+ visible: boolean;
576
+ onClose: (value: boolean | Purchase | null) => void;
577
+ data: Purchase | null;
578
+ targetType?: PurchaseTargetType | null;
579
+ targetId?: string | null;
580
+ request?: string | null;
581
+ }
582
+ declare const PurchaseModal: ({ visible, onClose, data, targetType, targetId, request }: PurchaseModalProps) => react__default.JSX.Element;
583
+
584
+ interface SingleOrderProps {
585
+ data: Purchase;
586
+ backUrl?: string;
587
+ }
588
+ declare const SingleOrder: ({ data, backUrl }: SingleOrderProps) => react.JSX.Element;
589
+
590
+ interface ArticleModalProps {
591
+ visible: boolean;
592
+ onClose: (value: boolean | Purchase) => void;
593
+ data: PurchaseItem | null;
594
+ }
595
+ declare const ArticleModal: ({ visible, onClose, data }: ArticleModalProps) => react.JSX.Element;
596
+
597
+ interface ArticleItemProps {
598
+ data: PurchaseItem;
599
+ selected?: boolean;
600
+ onAction?: (action: PurchaseItemAction, data: PurchaseItem, event: React.MouseEvent<HTMLElement>) => void;
601
+ }
602
+ declare const ArticleItem: ({ data, selected, onAction }: ArticleItemProps) => react.JSX.Element;
603
+
604
+ export { API, API_LOCAL, type Account, AccountProvider, ArticleItem, ArticleModal, BulkActionBar, type BulkActionBarAction, type BulkActionBarProps, type BusinessBillingPermissions, type BusinessCataloguePermissions, type BusinessCrudPermissions, type BusinessItem, type BusinessPayrollPermissions, type BusinessPermissions, type BusinessProjectsPermissions, type BusinessSettingsPermissions, type BusinessStorehousePermissions, CatalogueProvider, type Category, CategoryProvider, type Client, type ClientOption, ClientProvider, DocumentRow, DocumentUpload, type DocumentUploadProps, FactorType, HTTP, HTTP_API, Header, IepsMode, InventoryMode, ModalAction, type ModalActionProps, type Payment, PaymentAction, PaymentControlMode, PaymentMethod, PaymentModal, PaymentStatus, PaymentTableRow, type PermissionAction, type PermissionSection, type PermissionsBusiness, PermissionsProvider, ProviderProvider, type Purchase, PurchaseAction, type PurchaseHistory, type PurchaseItem, PurchaseItemAction, PurchaseModal, PurchaseStatus, PurchaseTableRow, STATUS_COLORS, SelectAutocomplete, type SessionPermissionsResponse, SingleOrder, type Supplier, type Tax, TaxType, TypePayment, UploadFileMode, type UploadProgress, type User, UserProvider, type UserTwoFA, createAppTheme, formatBytes, formatCurrency, useAccount, useCatalogue, useCategory, useClient, usePermissions, useProvider, useUser };