@marmot-systems/common 2.0.40 → 2.0.41
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/index.cjs +155 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +183 -82
- package/dist/index.d.ts +183 -82
- package/dist/index.js +153 -151
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { FieldError, Merge, FieldErrorsImpl } from 'react-hook-form';
|
|
3
3
|
|
|
4
|
-
declare const RegisterFormSchema: z.ZodObject<{
|
|
5
|
-
companyData: z.ZodObject<{
|
|
6
|
-
company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
7
|
-
company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
8
|
-
company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
|
|
9
|
-
iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
10
|
-
US: "US";
|
|
11
|
-
HN: "HN";
|
|
12
|
-
}>>;
|
|
13
|
-
}, z.core.$strict>;
|
|
14
|
-
adminUserData: z.ZodObject<{
|
|
15
|
-
user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
16
|
-
user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
17
|
-
user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
|
|
18
|
-
password: z.ZodString;
|
|
19
|
-
}, z.core.$strict>;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
|
|
22
|
-
declare const CustomerFormSchema: z.ZodObject<{
|
|
23
|
-
customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
24
|
-
customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
25
|
-
customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
26
|
-
customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
|
|
27
|
-
}, z.core.$strict>;
|
|
28
|
-
|
|
29
4
|
type RoundType = "half_up";
|
|
30
5
|
interface ToFixedOptions {
|
|
31
6
|
roundType?: RoundType;
|
|
@@ -107,6 +82,124 @@ type CreatedLocation = (typeof CREATED_LOCATION)[number];
|
|
|
107
82
|
type IntBool = 0 | 1;
|
|
108
83
|
declare const uuidSchema: z.ZodUUID;
|
|
109
84
|
type UUID = z.infer<typeof uuidSchema>;
|
|
85
|
+
type status = "active" | "inactive";
|
|
86
|
+
|
|
87
|
+
declare const RegisterFormSchema: z.ZodObject<{
|
|
88
|
+
companyData: z.ZodObject<{
|
|
89
|
+
company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
90
|
+
company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
91
|
+
company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
|
|
92
|
+
iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
93
|
+
US: "US";
|
|
94
|
+
HN: "HN";
|
|
95
|
+
}>>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
adminUserData: z.ZodObject<{
|
|
98
|
+
user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
99
|
+
user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
100
|
+
user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
|
|
101
|
+
password: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
}, z.core.$strict>;
|
|
104
|
+
|
|
105
|
+
declare const CustomerFormSchema: z.ZodObject<{
|
|
106
|
+
customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
107
|
+
customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
108
|
+
customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
109
|
+
customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
|
|
112
|
+
type CustomerSnapshot = {
|
|
113
|
+
customer_id: UUID;
|
|
114
|
+
customer_name: string;
|
|
115
|
+
customer_address: string | null;
|
|
116
|
+
customer_phone_number: string | null;
|
|
117
|
+
customer_email_address: string | null;
|
|
118
|
+
customer_status: status;
|
|
119
|
+
created_location: CreatedLocation;
|
|
120
|
+
company_id: number;
|
|
121
|
+
};
|
|
122
|
+
type MappedCustomers = {
|
|
123
|
+
customer_id: string;
|
|
124
|
+
customer_name: string;
|
|
125
|
+
customer_address?: string;
|
|
126
|
+
customer_phone_number?: string;
|
|
127
|
+
customer_email_address?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type MappedVendors = {
|
|
131
|
+
vendor_id: string;
|
|
132
|
+
vendor_name: string;
|
|
133
|
+
vendor_address: string;
|
|
134
|
+
vendor_phone_number: string;
|
|
135
|
+
vendor_email_address: string;
|
|
136
|
+
tax_rate: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
declare const ProductFormSchema: z.ZodObject<{
|
|
140
|
+
product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
141
|
+
product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
142
|
+
product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
143
|
+
product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
144
|
+
product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
145
|
+
product_type: z.ZodEnum<{
|
|
146
|
+
unit: "unit";
|
|
147
|
+
weight: "weight";
|
|
148
|
+
case: "case";
|
|
149
|
+
}>;
|
|
150
|
+
weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
kg: "kg";
|
|
152
|
+
lb: "lb";
|
|
153
|
+
g: "g";
|
|
154
|
+
oz: "oz";
|
|
155
|
+
}>>>;
|
|
156
|
+
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
157
|
+
cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
|
|
160
|
+
type ProductType = "unit" | "weight" | "case";
|
|
161
|
+
type WeightUnit = "kg" | "lb" | "g" | "oz";
|
|
162
|
+
type ProductSnapshot = {
|
|
163
|
+
product_id: UUID;
|
|
164
|
+
product_name: string;
|
|
165
|
+
product_description: string | null;
|
|
166
|
+
product_sku: string | null;
|
|
167
|
+
product_type: ProductType;
|
|
168
|
+
price: string;
|
|
169
|
+
weight_unit: WeightUnit | null;
|
|
170
|
+
created_location: CreatedLocation;
|
|
171
|
+
company_id: number;
|
|
172
|
+
product_upc: string | null;
|
|
173
|
+
product_gtin_14: string | null;
|
|
174
|
+
product_status: status;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type WarehouseSnapshot = {
|
|
178
|
+
warehouse_id: UUID;
|
|
179
|
+
warehouse_name: string;
|
|
180
|
+
warehouse_address: string;
|
|
181
|
+
created_location: CreatedLocation;
|
|
182
|
+
is_deleted: IntBool | null;
|
|
183
|
+
deleted_at: string | null;
|
|
184
|
+
created_at: string | null;
|
|
185
|
+
updated_at: string | null;
|
|
186
|
+
company_id: number;
|
|
187
|
+
created_by_user_id: number;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
type LocationType = "warehouse" | "employee";
|
|
191
|
+
type InventoryLocationSnapshot = {
|
|
192
|
+
location_id: UUID;
|
|
193
|
+
location_type: LocationType;
|
|
194
|
+
reference_id: UUID;
|
|
195
|
+
name: string;
|
|
196
|
+
created_location: CreatedLocation;
|
|
197
|
+
is_deleted: IntBool | null;
|
|
198
|
+
deleted_at: string | null;
|
|
199
|
+
created_at: string | null;
|
|
200
|
+
updated_at: string | null;
|
|
201
|
+
company_id: number;
|
|
202
|
+
};
|
|
110
203
|
|
|
111
204
|
declare const SalesInvoiceSchema: z.ZodObject<{
|
|
112
205
|
invoice_date: z.ZodString;
|
|
@@ -327,77 +420,44 @@ declare const INVOICE_STATUS: readonly ["finalized", "voided"];
|
|
|
327
420
|
type InvoiceStatus = (typeof INVOICE_STATUS)[number];
|
|
328
421
|
declare const CREDIT_TYPE: readonly ["dump", "return"];
|
|
329
422
|
type CreditType = (typeof CREDIT_TYPE)[number];
|
|
330
|
-
|
|
331
|
-
type SyncInvoice = {
|
|
423
|
+
type InvoiceSnapshot = {
|
|
332
424
|
invoice_id: UUID;
|
|
333
425
|
invoice_type: InvoiceType;
|
|
334
426
|
subtotal: string;
|
|
335
427
|
tax_amount: string;
|
|
336
428
|
total_amount: string;
|
|
337
429
|
remaining_balance: string;
|
|
338
|
-
due_date:
|
|
430
|
+
due_date: string;
|
|
339
431
|
tax_rate: string;
|
|
340
432
|
created_location: CreatedLocation;
|
|
341
|
-
is_new: IntBool;
|
|
342
433
|
customer_id: UUID;
|
|
343
434
|
company_id: number;
|
|
344
435
|
short_invoice_id: string;
|
|
345
436
|
invoice_date: string;
|
|
346
437
|
invoice_status: InvoiceStatus;
|
|
438
|
+
occurred_at_ms: string;
|
|
347
439
|
};
|
|
348
440
|
|
|
349
|
-
type
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
vendor_email_address: string;
|
|
363
|
-
tax_rate: number;
|
|
441
|
+
type InvoiceItemStatus = "finalized" | "voided";
|
|
442
|
+
type InvoiceItemSnapshot = {
|
|
443
|
+
invoice_item_id: UUID;
|
|
444
|
+
invoice_id: UUID;
|
|
445
|
+
product_id: UUID;
|
|
446
|
+
quantity: string;
|
|
447
|
+
price: string;
|
|
448
|
+
amount: string;
|
|
449
|
+
credit_type: CreditType | null;
|
|
450
|
+
company_id: number;
|
|
451
|
+
invoice_type: InvoiceType;
|
|
452
|
+
invoice_item_status: InvoiceItemStatus;
|
|
453
|
+
line_number: number;
|
|
364
454
|
};
|
|
365
455
|
|
|
366
|
-
declare
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
declare function localDateFromYmd(ymd: string): Date;
|
|
370
|
-
declare function ymdFromLocalDate(dt: Date): string;
|
|
371
|
-
|
|
372
|
-
type RHFError = string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
373
|
-
declare const getErrorMessage: (err: RHFError) => string | undefined;
|
|
374
|
-
|
|
375
|
-
declare const exceedsTwoDecimals: (raw: string) => boolean;
|
|
376
|
-
|
|
377
|
-
declare const ProductFormSchema: z.ZodObject<{
|
|
378
|
-
product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
379
|
-
product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
380
|
-
product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
381
|
-
product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
382
|
-
product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
383
|
-
product_type: z.ZodEnum<{
|
|
384
|
-
unit: "unit";
|
|
385
|
-
weight: "weight";
|
|
386
|
-
case: "case";
|
|
387
|
-
}>;
|
|
388
|
-
weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
|
|
389
|
-
kg: "kg";
|
|
390
|
-
lb: "lb";
|
|
391
|
-
g: "g";
|
|
392
|
-
oz: "oz";
|
|
393
|
-
}>>>;
|
|
394
|
-
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
395
|
-
cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
456
|
+
declare const CreditApplicationSchema: z.ZodObject<{
|
|
457
|
+
credit_invoice_id: z.ZodUUID;
|
|
458
|
+
applied_amount: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
396
459
|
}, z.core.$strict>;
|
|
397
460
|
|
|
398
|
-
type ProductType = "unit" | "weight" | "case";
|
|
399
|
-
type WeightUnit = "kg" | "lb" | "g" | "oz";
|
|
400
|
-
|
|
401
461
|
declare const PaymentFormSchema: z.ZodObject<{
|
|
402
462
|
payment_method: z.ZodEnum<{
|
|
403
463
|
check: "check";
|
|
@@ -411,10 +471,51 @@ declare const PaymentFormSchema: z.ZodObject<{
|
|
|
411
471
|
|
|
412
472
|
declare const PAYMENT_METHOD: readonly ["check", "cash", "bank_transfer", "digital_wallet"];
|
|
413
473
|
type PaymentMethod = (typeof PAYMENT_METHOD)[number];
|
|
474
|
+
type PaymentStatus = "finalized" | "voided";
|
|
475
|
+
type PaymentSnapshot = {
|
|
476
|
+
payment_id: UUID;
|
|
477
|
+
invoice_id: UUID;
|
|
478
|
+
payment_amount: string;
|
|
479
|
+
payment_date: string;
|
|
480
|
+
payment_method: PaymentMethod;
|
|
481
|
+
check_number: string | null;
|
|
482
|
+
created_location: CreatedLocation;
|
|
483
|
+
company_id: number;
|
|
484
|
+
short_invoice_id: string;
|
|
485
|
+
payment_status: PaymentStatus;
|
|
486
|
+
occurred_at_ms: string;
|
|
487
|
+
};
|
|
414
488
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
489
|
+
type DriverCustomerSnapshot = {
|
|
490
|
+
driver_customer_id: number;
|
|
491
|
+
is_active: IntBool;
|
|
492
|
+
user_id: number;
|
|
493
|
+
company_id: number;
|
|
494
|
+
customer_id: UUID;
|
|
495
|
+
created_at: string;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
type InvoiceFilter = "all" | "unpaid";
|
|
499
|
+
type PaymentFilter = "all" | "none";
|
|
500
|
+
type DriverSettingSnapshot = {
|
|
501
|
+
driver_setting_id: number;
|
|
502
|
+
invoice_filter: InvoiceFilter;
|
|
503
|
+
payment_filter: PaymentFilter;
|
|
504
|
+
user_id: number;
|
|
505
|
+
company_id: number;
|
|
506
|
+
created_at: string;
|
|
507
|
+
updated_at: string;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
declare const exceedsTwoDecimals: (raw: string) => boolean;
|
|
511
|
+
|
|
512
|
+
declare function todayLocalYmd(): string;
|
|
513
|
+
declare function addDaysLocalYmd(ymd: string, days: number): string;
|
|
514
|
+
declare function formatYmdLong(ymd: string, locale?: string): string;
|
|
515
|
+
declare function localDateFromYmd(ymd: string): Date;
|
|
516
|
+
declare function ymdFromLocalDate(dt: Date): string;
|
|
517
|
+
|
|
518
|
+
type RHFError = string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
519
|
+
declare const getErrorMessage: (err: RHFError) => string | undefined;
|
|
419
520
|
|
|
420
|
-
export { type AnyInvoiceOut, AnyInvoiceSchema, CREDIT_TYPE, type CreatedLocation, CreditApplicationSchema, type CreditInvoice, CreditInvoiceSchema, type CreditType, CustomerFormSchema, INVOICE_STATUS, INVOICE_TYPE, type InventorySystem, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, type MappedCustomers, type MappedVendors, PAYMENT_METHOD, PaymentFormSchema, type PaymentMethod, ProductFormSchema, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema,
|
|
521
|
+
export { type AnyInvoiceOut, AnyInvoiceSchema, CREDIT_TYPE, type CreatedLocation, CreditApplicationSchema, type CreditInvoice, CreditInvoiceSchema, type CreditType, CustomerFormSchema, type CustomerSnapshot, type DriverCustomerSnapshot, type DriverSettingSnapshot, INVOICE_STATUS, INVOICE_TYPE, ISO_COUNTRY_CODES, type InventoryLocationSnapshot, type InventorySystem, type InvoiceFilter, type InvoiceItemSnapshot, type InvoiceItemStatus, type InvoiceSnapshot, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, type MappedCustomers, type MappedVendors, PAYMENT_METHOD, type PaymentFilter, PaymentFormSchema, type PaymentMethod, type PaymentSnapshot, type PaymentStatus, ProductFormSchema, type ProductSnapshot, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema, USER_ROLES, type UUID, type UserRole, type WarehouseSnapshot, type WeightUnit, addDaysLocalYmd, countryToCurrency, currencyToLocale, exceedsTwoDecimals, formatMoneyCurrency, formatYmdLong, getCurrencyFromCountry, getErrorMessage, handleZodCurrency, localDateFromYmd, normalizeSpaces, removeAllWhitespace, removeDashesAndPlusSign, roundWithPrecision, todayLocalYmd, transformEmptyStringToUndefined, ymdFromLocalDate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { FieldError, Merge, FieldErrorsImpl } from 'react-hook-form';
|
|
3
3
|
|
|
4
|
-
declare const RegisterFormSchema: z.ZodObject<{
|
|
5
|
-
companyData: z.ZodObject<{
|
|
6
|
-
company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
7
|
-
company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
8
|
-
company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
|
|
9
|
-
iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
10
|
-
US: "US";
|
|
11
|
-
HN: "HN";
|
|
12
|
-
}>>;
|
|
13
|
-
}, z.core.$strict>;
|
|
14
|
-
adminUserData: z.ZodObject<{
|
|
15
|
-
user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
16
|
-
user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
17
|
-
user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
|
|
18
|
-
password: z.ZodString;
|
|
19
|
-
}, z.core.$strict>;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
|
|
22
|
-
declare const CustomerFormSchema: z.ZodObject<{
|
|
23
|
-
customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
24
|
-
customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
25
|
-
customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
26
|
-
customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
|
|
27
|
-
}, z.core.$strict>;
|
|
28
|
-
|
|
29
4
|
type RoundType = "half_up";
|
|
30
5
|
interface ToFixedOptions {
|
|
31
6
|
roundType?: RoundType;
|
|
@@ -107,6 +82,124 @@ type CreatedLocation = (typeof CREATED_LOCATION)[number];
|
|
|
107
82
|
type IntBool = 0 | 1;
|
|
108
83
|
declare const uuidSchema: z.ZodUUID;
|
|
109
84
|
type UUID = z.infer<typeof uuidSchema>;
|
|
85
|
+
type status = "active" | "inactive";
|
|
86
|
+
|
|
87
|
+
declare const RegisterFormSchema: z.ZodObject<{
|
|
88
|
+
companyData: z.ZodObject<{
|
|
89
|
+
company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
90
|
+
company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
91
|
+
company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
|
|
92
|
+
iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
93
|
+
US: "US";
|
|
94
|
+
HN: "HN";
|
|
95
|
+
}>>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
adminUserData: z.ZodObject<{
|
|
98
|
+
user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
99
|
+
user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
100
|
+
user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
|
|
101
|
+
password: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
}, z.core.$strict>;
|
|
104
|
+
|
|
105
|
+
declare const CustomerFormSchema: z.ZodObject<{
|
|
106
|
+
customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
107
|
+
customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
108
|
+
customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
109
|
+
customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
|
|
112
|
+
type CustomerSnapshot = {
|
|
113
|
+
customer_id: UUID;
|
|
114
|
+
customer_name: string;
|
|
115
|
+
customer_address: string | null;
|
|
116
|
+
customer_phone_number: string | null;
|
|
117
|
+
customer_email_address: string | null;
|
|
118
|
+
customer_status: status;
|
|
119
|
+
created_location: CreatedLocation;
|
|
120
|
+
company_id: number;
|
|
121
|
+
};
|
|
122
|
+
type MappedCustomers = {
|
|
123
|
+
customer_id: string;
|
|
124
|
+
customer_name: string;
|
|
125
|
+
customer_address?: string;
|
|
126
|
+
customer_phone_number?: string;
|
|
127
|
+
customer_email_address?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type MappedVendors = {
|
|
131
|
+
vendor_id: string;
|
|
132
|
+
vendor_name: string;
|
|
133
|
+
vendor_address: string;
|
|
134
|
+
vendor_phone_number: string;
|
|
135
|
+
vendor_email_address: string;
|
|
136
|
+
tax_rate: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
declare const ProductFormSchema: z.ZodObject<{
|
|
140
|
+
product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
141
|
+
product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
142
|
+
product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
143
|
+
product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
144
|
+
product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
145
|
+
product_type: z.ZodEnum<{
|
|
146
|
+
unit: "unit";
|
|
147
|
+
weight: "weight";
|
|
148
|
+
case: "case";
|
|
149
|
+
}>;
|
|
150
|
+
weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
kg: "kg";
|
|
152
|
+
lb: "lb";
|
|
153
|
+
g: "g";
|
|
154
|
+
oz: "oz";
|
|
155
|
+
}>>>;
|
|
156
|
+
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
157
|
+
cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
|
|
160
|
+
type ProductType = "unit" | "weight" | "case";
|
|
161
|
+
type WeightUnit = "kg" | "lb" | "g" | "oz";
|
|
162
|
+
type ProductSnapshot = {
|
|
163
|
+
product_id: UUID;
|
|
164
|
+
product_name: string;
|
|
165
|
+
product_description: string | null;
|
|
166
|
+
product_sku: string | null;
|
|
167
|
+
product_type: ProductType;
|
|
168
|
+
price: string;
|
|
169
|
+
weight_unit: WeightUnit | null;
|
|
170
|
+
created_location: CreatedLocation;
|
|
171
|
+
company_id: number;
|
|
172
|
+
product_upc: string | null;
|
|
173
|
+
product_gtin_14: string | null;
|
|
174
|
+
product_status: status;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type WarehouseSnapshot = {
|
|
178
|
+
warehouse_id: UUID;
|
|
179
|
+
warehouse_name: string;
|
|
180
|
+
warehouse_address: string;
|
|
181
|
+
created_location: CreatedLocation;
|
|
182
|
+
is_deleted: IntBool | null;
|
|
183
|
+
deleted_at: string | null;
|
|
184
|
+
created_at: string | null;
|
|
185
|
+
updated_at: string | null;
|
|
186
|
+
company_id: number;
|
|
187
|
+
created_by_user_id: number;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
type LocationType = "warehouse" | "employee";
|
|
191
|
+
type InventoryLocationSnapshot = {
|
|
192
|
+
location_id: UUID;
|
|
193
|
+
location_type: LocationType;
|
|
194
|
+
reference_id: UUID;
|
|
195
|
+
name: string;
|
|
196
|
+
created_location: CreatedLocation;
|
|
197
|
+
is_deleted: IntBool | null;
|
|
198
|
+
deleted_at: string | null;
|
|
199
|
+
created_at: string | null;
|
|
200
|
+
updated_at: string | null;
|
|
201
|
+
company_id: number;
|
|
202
|
+
};
|
|
110
203
|
|
|
111
204
|
declare const SalesInvoiceSchema: z.ZodObject<{
|
|
112
205
|
invoice_date: z.ZodString;
|
|
@@ -327,77 +420,44 @@ declare const INVOICE_STATUS: readonly ["finalized", "voided"];
|
|
|
327
420
|
type InvoiceStatus = (typeof INVOICE_STATUS)[number];
|
|
328
421
|
declare const CREDIT_TYPE: readonly ["dump", "return"];
|
|
329
422
|
type CreditType = (typeof CREDIT_TYPE)[number];
|
|
330
|
-
|
|
331
|
-
type SyncInvoice = {
|
|
423
|
+
type InvoiceSnapshot = {
|
|
332
424
|
invoice_id: UUID;
|
|
333
425
|
invoice_type: InvoiceType;
|
|
334
426
|
subtotal: string;
|
|
335
427
|
tax_amount: string;
|
|
336
428
|
total_amount: string;
|
|
337
429
|
remaining_balance: string;
|
|
338
|
-
due_date:
|
|
430
|
+
due_date: string;
|
|
339
431
|
tax_rate: string;
|
|
340
432
|
created_location: CreatedLocation;
|
|
341
|
-
is_new: IntBool;
|
|
342
433
|
customer_id: UUID;
|
|
343
434
|
company_id: number;
|
|
344
435
|
short_invoice_id: string;
|
|
345
436
|
invoice_date: string;
|
|
346
437
|
invoice_status: InvoiceStatus;
|
|
438
|
+
occurred_at_ms: string;
|
|
347
439
|
};
|
|
348
440
|
|
|
349
|
-
type
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
vendor_email_address: string;
|
|
363
|
-
tax_rate: number;
|
|
441
|
+
type InvoiceItemStatus = "finalized" | "voided";
|
|
442
|
+
type InvoiceItemSnapshot = {
|
|
443
|
+
invoice_item_id: UUID;
|
|
444
|
+
invoice_id: UUID;
|
|
445
|
+
product_id: UUID;
|
|
446
|
+
quantity: string;
|
|
447
|
+
price: string;
|
|
448
|
+
amount: string;
|
|
449
|
+
credit_type: CreditType | null;
|
|
450
|
+
company_id: number;
|
|
451
|
+
invoice_type: InvoiceType;
|
|
452
|
+
invoice_item_status: InvoiceItemStatus;
|
|
453
|
+
line_number: number;
|
|
364
454
|
};
|
|
365
455
|
|
|
366
|
-
declare
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
declare function localDateFromYmd(ymd: string): Date;
|
|
370
|
-
declare function ymdFromLocalDate(dt: Date): string;
|
|
371
|
-
|
|
372
|
-
type RHFError = string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
373
|
-
declare const getErrorMessage: (err: RHFError) => string | undefined;
|
|
374
|
-
|
|
375
|
-
declare const exceedsTwoDecimals: (raw: string) => boolean;
|
|
376
|
-
|
|
377
|
-
declare const ProductFormSchema: z.ZodObject<{
|
|
378
|
-
product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
379
|
-
product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
380
|
-
product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
|
|
381
|
-
product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
382
|
-
product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
|
|
383
|
-
product_type: z.ZodEnum<{
|
|
384
|
-
unit: "unit";
|
|
385
|
-
weight: "weight";
|
|
386
|
-
case: "case";
|
|
387
|
-
}>;
|
|
388
|
-
weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
|
|
389
|
-
kg: "kg";
|
|
390
|
-
lb: "lb";
|
|
391
|
-
g: "g";
|
|
392
|
-
oz: "oz";
|
|
393
|
-
}>>>;
|
|
394
|
-
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
395
|
-
cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
456
|
+
declare const CreditApplicationSchema: z.ZodObject<{
|
|
457
|
+
credit_invoice_id: z.ZodUUID;
|
|
458
|
+
applied_amount: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
|
|
396
459
|
}, z.core.$strict>;
|
|
397
460
|
|
|
398
|
-
type ProductType = "unit" | "weight" | "case";
|
|
399
|
-
type WeightUnit = "kg" | "lb" | "g" | "oz";
|
|
400
|
-
|
|
401
461
|
declare const PaymentFormSchema: z.ZodObject<{
|
|
402
462
|
payment_method: z.ZodEnum<{
|
|
403
463
|
check: "check";
|
|
@@ -411,10 +471,51 @@ declare const PaymentFormSchema: z.ZodObject<{
|
|
|
411
471
|
|
|
412
472
|
declare const PAYMENT_METHOD: readonly ["check", "cash", "bank_transfer", "digital_wallet"];
|
|
413
473
|
type PaymentMethod = (typeof PAYMENT_METHOD)[number];
|
|
474
|
+
type PaymentStatus = "finalized" | "voided";
|
|
475
|
+
type PaymentSnapshot = {
|
|
476
|
+
payment_id: UUID;
|
|
477
|
+
invoice_id: UUID;
|
|
478
|
+
payment_amount: string;
|
|
479
|
+
payment_date: string;
|
|
480
|
+
payment_method: PaymentMethod;
|
|
481
|
+
check_number: string | null;
|
|
482
|
+
created_location: CreatedLocation;
|
|
483
|
+
company_id: number;
|
|
484
|
+
short_invoice_id: string;
|
|
485
|
+
payment_status: PaymentStatus;
|
|
486
|
+
occurred_at_ms: string;
|
|
487
|
+
};
|
|
414
488
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
489
|
+
type DriverCustomerSnapshot = {
|
|
490
|
+
driver_customer_id: number;
|
|
491
|
+
is_active: IntBool;
|
|
492
|
+
user_id: number;
|
|
493
|
+
company_id: number;
|
|
494
|
+
customer_id: UUID;
|
|
495
|
+
created_at: string;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
type InvoiceFilter = "all" | "unpaid";
|
|
499
|
+
type PaymentFilter = "all" | "none";
|
|
500
|
+
type DriverSettingSnapshot = {
|
|
501
|
+
driver_setting_id: number;
|
|
502
|
+
invoice_filter: InvoiceFilter;
|
|
503
|
+
payment_filter: PaymentFilter;
|
|
504
|
+
user_id: number;
|
|
505
|
+
company_id: number;
|
|
506
|
+
created_at: string;
|
|
507
|
+
updated_at: string;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
declare const exceedsTwoDecimals: (raw: string) => boolean;
|
|
511
|
+
|
|
512
|
+
declare function todayLocalYmd(): string;
|
|
513
|
+
declare function addDaysLocalYmd(ymd: string, days: number): string;
|
|
514
|
+
declare function formatYmdLong(ymd: string, locale?: string): string;
|
|
515
|
+
declare function localDateFromYmd(ymd: string): Date;
|
|
516
|
+
declare function ymdFromLocalDate(dt: Date): string;
|
|
517
|
+
|
|
518
|
+
type RHFError = string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
519
|
+
declare const getErrorMessage: (err: RHFError) => string | undefined;
|
|
419
520
|
|
|
420
|
-
export { type AnyInvoiceOut, AnyInvoiceSchema, CREDIT_TYPE, type CreatedLocation, CreditApplicationSchema, type CreditInvoice, CreditInvoiceSchema, type CreditType, CustomerFormSchema, INVOICE_STATUS, INVOICE_TYPE, type InventorySystem, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, type MappedCustomers, type MappedVendors, PAYMENT_METHOD, PaymentFormSchema, type PaymentMethod, ProductFormSchema, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema,
|
|
521
|
+
export { type AnyInvoiceOut, AnyInvoiceSchema, CREDIT_TYPE, type CreatedLocation, CreditApplicationSchema, type CreditInvoice, CreditInvoiceSchema, type CreditType, CustomerFormSchema, type CustomerSnapshot, type DriverCustomerSnapshot, type DriverSettingSnapshot, INVOICE_STATUS, INVOICE_TYPE, ISO_COUNTRY_CODES, type InventoryLocationSnapshot, type InventorySystem, type InvoiceFilter, type InvoiceItemSnapshot, type InvoiceItemStatus, type InvoiceSnapshot, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, type MappedCustomers, type MappedVendors, PAYMENT_METHOD, type PaymentFilter, PaymentFormSchema, type PaymentMethod, type PaymentSnapshot, type PaymentStatus, ProductFormSchema, type ProductSnapshot, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema, USER_ROLES, type UUID, type UserRole, type WarehouseSnapshot, type WeightUnit, addDaysLocalYmd, countryToCurrency, currencyToLocale, exceedsTwoDecimals, formatMoneyCurrency, formatYmdLong, getCurrencyFromCountry, getErrorMessage, handleZodCurrency, localDateFromYmd, normalizeSpaces, removeAllWhitespace, removeDashesAndPlusSign, roundWithPrecision, todayLocalYmd, transformEmptyStringToUndefined, ymdFromLocalDate };
|