@appcorp/stellar-solutions-invoice-module 0.1.74 → 0.1.75
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/base-modules/invoice/add-service-product-section.d.ts +1 -5
- package/base-modules/invoice/add-service-product-section.js +3 -3
- package/base-modules/invoice/cache.d.ts +15 -0
- package/base-modules/invoice/cache.js +50 -0
- package/base-modules/invoice/calculate-subtotal.d.ts +6 -1
- package/base-modules/invoice/calculate-subtotal.js +2 -2
- package/base-modules/invoice/calculate-total.d.ts +1 -1
- package/base-modules/invoice/calculate-total.js +8 -8
- package/base-modules/invoice/company-form-section.d.ts +1 -5
- package/base-modules/invoice/company-form-section.js +25 -22
- package/base-modules/invoice/constants.d.ts +2 -3
- package/base-modules/invoice/constants.js +2 -3
- package/base-modules/invoice/context.d.ts +556 -20
- package/base-modules/invoice/context.js +530 -342
- package/base-modules/invoice/customer-form-section.d.ts +1 -5
- package/base-modules/invoice/customer-form-section.js +25 -9
- package/base-modules/invoice/form.d.ts +1 -5
- package/base-modules/invoice/form.js +9 -9
- package/base-modules/invoice/page.d.ts +8 -0
- package/base-modules/invoice/page.js +171 -0
- package/base-modules/invoice/pricing-form-section.d.ts +1 -5
- package/base-modules/invoice/pricing-form-section.js +16 -11
- package/base-modules/invoice/products-form-section.d.ts +1 -5
- package/base-modules/invoice/products-form-section.js +49 -40
- package/base-modules/invoice/services-form-section.d.ts +1 -5
- package/base-modules/invoice/services-form-section.js +10 -9
- package/base-modules/invoice/validate.d.ts +83 -25
- package/base-modules/invoice/validate.js +4 -4
- package/base-modules/payment/cache.d.ts +15 -0
- package/base-modules/payment/cache.js +52 -0
- package/base-modules/payment/constants.d.ts +1 -14
- package/base-modules/payment/constants.js +2 -15
- package/base-modules/payment/context.d.ts +214 -48
- package/base-modules/payment/context.js +266 -237
- package/base-modules/payment/drawer.d.ts +0 -6
- package/base-modules/payment/drawer.js +89 -44
- package/base-modules/payment/form.js +3 -2
- package/base-modules/payment/{payment.js → page.js} +2 -5
- package/base-modules/payment/types.d.ts +0 -85
- package/base-modules/payment/types.js +74 -21
- package/base-modules/payment/validate.d.ts +12 -0
- package/base-modules/payment/validate.js +19 -8
- package/base-modules/payment/view.d.ts +1 -5
- package/base-modules/payment/view.js +4 -3
- package/base-modules/quote/add-service-product-section.js +1 -1
- package/base-modules/quote/cache.d.ts +15 -0
- package/base-modules/quote/cache.js +50 -0
- package/base-modules/quote/company-form-section.d.ts +1 -1
- package/base-modules/quote/company-form-section.js +14 -12
- package/base-modules/quote/constants.js +1 -0
- package/base-modules/quote/context.d.ts +656 -46
- package/base-modules/quote/context.js +413 -289
- package/base-modules/quote/customer-form-section.d.ts +1 -1
- package/base-modules/quote/customer-form-section.js +24 -9
- package/base-modules/quote/form.d.ts +1 -5
- package/base-modules/quote/form.js +8 -9
- package/base-modules/quote/page.d.ts +8 -0
- package/base-modules/quote/page.js +163 -0
- package/base-modules/quote/pricing-form-section.js +9 -8
- package/base-modules/quote/products-form-section.js +2 -2
- package/base-modules/quote/services-form-section.js +1 -1
- package/base-modules/quote/types.d.ts +0 -127
- package/base-modules/quote/types.js +92 -35
- package/base-modules/quote/validate.d.ts +82 -25
- package/base-modules/quote/validate.js +3 -4
- package/package.json +8 -8
- package/base-modules/invoice/actions.d.ts +0 -215
- package/base-modules/invoice/actions.js +0 -38
- package/base-modules/invoice/drawer.d.ts +0 -13
- package/base-modules/invoice/drawer.js +0 -46
- package/base-modules/invoice/invoice.d.ts +0 -8
- package/base-modules/invoice/invoice.js +0 -69
- package/base-modules/invoice/reducer.d.ts +0 -4
- package/base-modules/invoice/reducer.js +0 -180
- package/base-modules/invoice/types.d.ts +0 -211
- package/base-modules/invoice/types.js +0 -43
- package/base-modules/payment/actions.d.ts +0 -203
- package/base-modules/payment/actions.js +0 -50
- package/base-modules/payment/reducer.d.ts +0 -29
- package/base-modules/payment/reducer.js +0 -215
- package/base-modules/quote/actions.d.ts +0 -215
- package/base-modules/quote/actions.js +0 -38
- package/base-modules/quote/drawer.d.ts +0 -13
- package/base-modules/quote/drawer.js +0 -46
- package/base-modules/quote/quote.d.ts +0 -8
- package/base-modules/quote/quote.js +0 -69
- package/base-modules/quote/reducer.d.ts +0 -4
- package/base-modules/quote/reducer.js +0 -181
- /package/base-modules/payment/{payment.d.ts → page.d.ts} +0 -0
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
* - Type Exports
|
|
20
20
|
*/
|
|
21
21
|
import { z } from "zod";
|
|
22
|
-
import {
|
|
22
|
+
import { QUOTE_INVOICE_MODE } from "@react-pakistan/util-functions";
|
|
23
23
|
export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
24
|
address: z.ZodString;
|
|
25
25
|
city: z.ZodString;
|
|
26
26
|
country: z.ZodString;
|
|
27
27
|
currency: z.ZodString;
|
|
28
|
-
|
|
28
|
+
invoiceMode: z.ZodLiteral<QUOTE_INVOICE_MODE.CUSTOMER>;
|
|
29
29
|
email: z.ZodString;
|
|
30
30
|
firstName: z.ZodString;
|
|
31
31
|
lastName: z.ZodString;
|
|
@@ -47,7 +47,7 @@ export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
47
47
|
companyId: z.ZodString;
|
|
48
48
|
currency: z.ZodString;
|
|
49
49
|
date: z.ZodString;
|
|
50
|
-
|
|
50
|
+
invoiceMode: z.ZodLiteral<QUOTE_INVOICE_MODE.COMPANY>;
|
|
51
51
|
expiryDate: z.ZodString;
|
|
52
52
|
note: z.ZodOptional<z.ZodString>;
|
|
53
53
|
ref: z.ZodString;
|
|
@@ -64,8 +64,15 @@ export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
64
64
|
price: z.ZodString;
|
|
65
65
|
rowTotal: z.ZodString;
|
|
66
66
|
}, z.core.$strip>>>;
|
|
67
|
-
}, z.core.$strip>], "
|
|
67
|
+
}, z.core.$strip>], "invoiceMode">;
|
|
68
68
|
export declare const formValidation: z.ZodObject<{
|
|
69
|
+
"~standard": z.ZodStandardSchemaWithJSON<z.ZodObject<{
|
|
70
|
+
discountUnit: z.ZodString;
|
|
71
|
+
discount: z.ZodString;
|
|
72
|
+
total: z.ZodString;
|
|
73
|
+
subTotal: z.ZodString;
|
|
74
|
+
taxRate: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>;
|
|
69
76
|
shape: {
|
|
70
77
|
discountUnit: z.ZodString;
|
|
71
78
|
discount: z.ZodString;
|
|
@@ -74,11 +81,11 @@ export declare const formValidation: z.ZodObject<{
|
|
|
74
81
|
taxRate: z.ZodString;
|
|
75
82
|
};
|
|
76
83
|
keyof: () => z.ZodEnum<{
|
|
77
|
-
discount: "discount";
|
|
78
|
-
discountUnit: "discountUnit";
|
|
79
84
|
subTotal: "subTotal";
|
|
80
85
|
taxRate: "taxRate";
|
|
86
|
+
discount: "discount";
|
|
81
87
|
total: "total";
|
|
88
|
+
discountUnit: "discountUnit";
|
|
82
89
|
}>;
|
|
83
90
|
catchall: <T extends z.core.SomeType>(schema: T) => z.ZodObject<{
|
|
84
91
|
discountUnit: z.ZodString;
|
|
@@ -115,7 +122,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
115
122
|
subTotal: z.ZodString;
|
|
116
123
|
taxRate: z.ZodString;
|
|
117
124
|
}, z.core.$strip>;
|
|
118
|
-
extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("
|
|
125
|
+
extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U extends never ? {
|
|
119
126
|
discountUnit: z.ZodString;
|
|
120
127
|
discount: z.ZodString;
|
|
121
128
|
total: z.ZodString;
|
|
@@ -134,7 +141,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
134
141
|
total: z.ZodString;
|
|
135
142
|
subTotal: z.ZodString;
|
|
136
143
|
taxRate: z.ZodString;
|
|
137
|
-
}, U> & Partial<Record<"
|
|
144
|
+
}, U> & Partial<Record<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit", z.core.SomeType>>) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U extends never ? {
|
|
138
145
|
discountUnit: z.ZodString;
|
|
139
146
|
discount: z.ZodString;
|
|
140
147
|
total: z.ZodString;
|
|
@@ -147,7 +154,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
147
154
|
subTotal: z.ZodString;
|
|
148
155
|
taxRate: z.ZodString;
|
|
149
156
|
} extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof U ? never : K]: T_1[K]; } : never) & { [K_1 in keyof U]: U[K_1]; }) extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
150
|
-
merge: <U extends z.ZodObject>(other: U) => z.ZodObject<(("
|
|
157
|
+
merge: <U extends z.ZodObject>(other: U) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U["shape"] extends never ? {
|
|
151
158
|
discountUnit: z.ZodString;
|
|
152
159
|
discount: z.ZodString;
|
|
153
160
|
total: z.ZodString;
|
|
@@ -160,20 +167,20 @@ export declare const formValidation: z.ZodObject<{
|
|
|
160
167
|
subTotal: z.ZodString;
|
|
161
168
|
taxRate: z.ZodString;
|
|
162
169
|
} extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof U["shape"] ? never : K]: T_1[K]; } : never) & (U["shape"] extends infer T_2 extends z.core.util.SomeObject ? { [K_1 in keyof T_2]: T_2[K_1]; } : never)) extends infer T ? { [k in keyof T]: T[k]; } : never, U["_zod"]["config"]>;
|
|
163
|
-
pick: <M extends z.core.util.Mask<"
|
|
170
|
+
pick: <M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>) => z.ZodObject<Pick<{
|
|
164
171
|
discountUnit: z.ZodString;
|
|
165
172
|
discount: z.ZodString;
|
|
166
173
|
total: z.ZodString;
|
|
167
174
|
subTotal: z.ZodString;
|
|
168
175
|
taxRate: z.ZodString;
|
|
169
|
-
}, Extract<"
|
|
170
|
-
omit: <M extends z.core.util.Mask<"
|
|
176
|
+
}, Extract<"subTotal", keyof M> | Extract<"taxRate", keyof M> | Extract<"discount", keyof M> | Extract<"total", keyof M> | Extract<"discountUnit", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
177
|
+
omit: <M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>) => z.ZodObject<Omit<{
|
|
171
178
|
discountUnit: z.ZodString;
|
|
172
179
|
discount: z.ZodString;
|
|
173
180
|
total: z.ZodString;
|
|
174
181
|
subTotal: z.ZodString;
|
|
175
182
|
taxRate: z.ZodString;
|
|
176
|
-
}, Extract<"
|
|
183
|
+
}, Extract<"subTotal", keyof M> | Extract<"taxRate", keyof M> | Extract<"discount", keyof M> | Extract<"total", keyof M> | Extract<"discountUnit", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
177
184
|
partial: {
|
|
178
185
|
(): z.ZodObject<{
|
|
179
186
|
discountUnit: z.ZodOptional<z.ZodString>;
|
|
@@ -182,7 +189,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
182
189
|
subTotal: z.ZodOptional<z.ZodString>;
|
|
183
190
|
taxRate: z.ZodOptional<z.ZodString>;
|
|
184
191
|
}, z.core.$strip>;
|
|
185
|
-
<M extends z.core.util.Mask<"
|
|
192
|
+
<M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>): z.ZodObject<{
|
|
186
193
|
discountUnit: "discountUnit" extends infer T ? T extends "discountUnit" ? T extends keyof M ? z.ZodOptional<{
|
|
187
194
|
discountUnit: z.ZodString;
|
|
188
195
|
discount: z.ZodString;
|
|
@@ -258,7 +265,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
258
265
|
subTotal: z.ZodNonOptional<z.ZodString>;
|
|
259
266
|
taxRate: z.ZodNonOptional<z.ZodString>;
|
|
260
267
|
}, z.core.$strip>;
|
|
261
|
-
<M extends z.core.util.Mask<"
|
|
268
|
+
<M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>): z.ZodObject<{
|
|
262
269
|
discountUnit: "discountUnit" extends infer T ? T extends "discountUnit" ? T extends keyof M ? z.ZodNonOptional<{
|
|
263
270
|
discountUnit: z.ZodString;
|
|
264
271
|
discount: z.ZodString;
|
|
@@ -355,6 +362,13 @@ export declare const formValidation: z.ZodObject<{
|
|
|
355
362
|
subTotal: string;
|
|
356
363
|
taxRate: string;
|
|
357
364
|
};
|
|
365
|
+
toJSONSchema: (params?: z.core.ToJSONSchemaParams) => z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
366
|
+
discountUnit: z.ZodString;
|
|
367
|
+
discount: z.ZodString;
|
|
368
|
+
total: z.ZodString;
|
|
369
|
+
subTotal: z.ZodString;
|
|
370
|
+
taxRate: z.ZodString;
|
|
371
|
+
}, z.core.$strip>>;
|
|
358
372
|
check: (...checks: (z.core.CheckFn<{
|
|
359
373
|
discountUnit: string;
|
|
360
374
|
discount: string;
|
|
@@ -374,6 +388,25 @@ export declare const formValidation: z.ZodObject<{
|
|
|
374
388
|
subTotal: z.ZodString;
|
|
375
389
|
taxRate: z.ZodString;
|
|
376
390
|
}, z.core.$strip>;
|
|
391
|
+
with: (...checks: (z.core.CheckFn<{
|
|
392
|
+
discountUnit: string;
|
|
393
|
+
discount: string;
|
|
394
|
+
total: string;
|
|
395
|
+
subTotal: string;
|
|
396
|
+
taxRate: string;
|
|
397
|
+
}> | z.core.$ZodCheck<{
|
|
398
|
+
discountUnit: string;
|
|
399
|
+
discount: string;
|
|
400
|
+
total: string;
|
|
401
|
+
subTotal: string;
|
|
402
|
+
taxRate: string;
|
|
403
|
+
}>)[]) => z.ZodObject<{
|
|
404
|
+
discountUnit: z.ZodString;
|
|
405
|
+
discount: z.ZodString;
|
|
406
|
+
total: z.ZodString;
|
|
407
|
+
subTotal: z.ZodString;
|
|
408
|
+
taxRate: z.ZodString;
|
|
409
|
+
}, z.core.$strip>;
|
|
377
410
|
clone: (def?: z.core.$ZodObjectDef<{
|
|
378
411
|
discountUnit: z.ZodString;
|
|
379
412
|
discount: z.ZodString;
|
|
@@ -420,7 +453,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
420
453
|
subTotal: z.ZodString;
|
|
421
454
|
taxRate: z.ZodString;
|
|
422
455
|
}, z.core.$strip>;
|
|
423
|
-
brand: <T extends PropertyKey = PropertyKey>(value?: T | undefined) => PropertyKey extends T ? z.ZodObject<{
|
|
456
|
+
brand: <T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T | undefined) => PropertyKey extends T ? z.ZodObject<{
|
|
424
457
|
discountUnit: z.ZodString;
|
|
425
458
|
discount: z.ZodString;
|
|
426
459
|
total: z.ZodString;
|
|
@@ -432,7 +465,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
432
465
|
total: z.ZodString;
|
|
433
466
|
subTotal: z.ZodString;
|
|
434
467
|
taxRate: z.ZodString;
|
|
435
|
-
}, z.core.$strip>, T>;
|
|
468
|
+
}, z.core.$strip>, T, Dir>;
|
|
436
469
|
parse: (data: unknown, params?: z.core.ParseContext<z.core.$ZodIssue>) => {
|
|
437
470
|
discountUnit: string;
|
|
438
471
|
discount: string;
|
|
@@ -572,20 +605,38 @@ export declare const formValidation: z.ZodObject<{
|
|
|
572
605
|
subTotal: string;
|
|
573
606
|
taxRate: string;
|
|
574
607
|
}>>;
|
|
575
|
-
refine:
|
|
608
|
+
refine: <Ch extends (arg: {
|
|
576
609
|
discountUnit: string;
|
|
577
610
|
discount: string;
|
|
578
611
|
total: string;
|
|
579
612
|
subTotal: string;
|
|
580
613
|
taxRate: string;
|
|
581
|
-
}) => unknown | Promise<unknown
|
|
614
|
+
}) => unknown | Promise<unknown>>(check: Ch, params?: string | {
|
|
615
|
+
params?: Record<string, any> | undefined;
|
|
582
616
|
abort?: boolean | undefined | undefined;
|
|
583
617
|
when?: ((payload: z.core.ParsePayload) => boolean) | undefined | undefined;
|
|
584
618
|
path?: PropertyKey[] | undefined | undefined;
|
|
585
|
-
params?: Record<string, any> | undefined;
|
|
586
619
|
error?: string | z.core.$ZodErrorMap<NonNullable<z.core.$ZodIssue>> | undefined;
|
|
587
620
|
message?: string | undefined | undefined;
|
|
588
|
-
} | undefined) => z.ZodObject<{
|
|
621
|
+
} | undefined) => Ch extends (arg: any) => arg is infer R ? z.ZodObject<{
|
|
622
|
+
discountUnit: z.ZodString;
|
|
623
|
+
discount: z.ZodString;
|
|
624
|
+
total: z.ZodString;
|
|
625
|
+
subTotal: z.ZodString;
|
|
626
|
+
taxRate: z.ZodString;
|
|
627
|
+
}, z.core.$strip> & z.ZodType<R, {
|
|
628
|
+
discountUnit: string;
|
|
629
|
+
discount: string;
|
|
630
|
+
total: string;
|
|
631
|
+
subTotal: string;
|
|
632
|
+
taxRate: string;
|
|
633
|
+
}, z.core.$ZodTypeInternals<R, {
|
|
634
|
+
discountUnit: string;
|
|
635
|
+
discount: string;
|
|
636
|
+
total: string;
|
|
637
|
+
subTotal: string;
|
|
638
|
+
taxRate: string;
|
|
639
|
+
}>> : z.ZodObject<{
|
|
589
640
|
discountUnit: z.ZodString;
|
|
590
641
|
discount: z.ZodString;
|
|
591
642
|
total: z.ZodString;
|
|
@@ -637,6 +688,13 @@ export declare const formValidation: z.ZodObject<{
|
|
|
637
688
|
subTotal: z.ZodString;
|
|
638
689
|
taxRate: z.ZodString;
|
|
639
690
|
}, z.core.$strip>>;
|
|
691
|
+
exactOptional: () => z.ZodExactOptional<z.ZodObject<{
|
|
692
|
+
discountUnit: z.ZodString;
|
|
693
|
+
discount: z.ZodString;
|
|
694
|
+
total: z.ZodString;
|
|
695
|
+
subTotal: z.ZodString;
|
|
696
|
+
taxRate: z.ZodString;
|
|
697
|
+
}, z.core.$strip>>;
|
|
640
698
|
nonoptional: (params?: string | z.core.$ZodNonOptionalParams) => z.ZodNonOptional<z.ZodObject<{
|
|
641
699
|
discountUnit: z.ZodString;
|
|
642
700
|
discount: z.ZodString;
|
|
@@ -858,19 +916,19 @@ export declare const formValidation: z.ZodObject<{
|
|
|
858
916
|
};
|
|
859
917
|
isOptional: () => boolean;
|
|
860
918
|
isNullable: () => boolean;
|
|
861
|
-
|
|
919
|
+
apply: <T>(fn: (schema: z.ZodObject<{
|
|
862
920
|
discountUnit: z.ZodString;
|
|
863
921
|
discount: z.ZodString;
|
|
864
922
|
total: z.ZodString;
|
|
865
923
|
subTotal: z.ZodString;
|
|
866
924
|
taxRate: z.ZodString;
|
|
867
|
-
}, z.core.$strip
|
|
868
|
-
|
|
925
|
+
}, z.core.$strip>) => T) => T;
|
|
926
|
+
_zod: z.core.$ZodObjectInternals<{
|
|
869
927
|
discountUnit: z.ZodString;
|
|
870
928
|
discount: z.ZodString;
|
|
871
929
|
total: z.ZodString;
|
|
872
930
|
subTotal: z.ZodString;
|
|
873
931
|
taxRate: z.ZodString;
|
|
874
|
-
}, z.core.$strip
|
|
932
|
+
}, z.core.$strip>;
|
|
875
933
|
}, z.core.$strip>;
|
|
876
934
|
export type FormValidate = z.infer<typeof formValidation>;
|
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.formValidation = exports.formValid = void 0;
|
|
24
24
|
var zod_1 = require("zod");
|
|
25
25
|
var constants_1 = require("./constants");
|
|
26
|
-
var
|
|
26
|
+
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
27
27
|
// ============================================================================
|
|
28
28
|
// SERVICE ITEM SCHEMA
|
|
29
29
|
// ============================================================================
|
|
@@ -73,7 +73,7 @@ var customerSchema = zod_1.z.object({
|
|
|
73
73
|
city: zod_1.z.string().nonempty(constants_1.validationErrors.customerCity),
|
|
74
74
|
country: zod_1.z.string().nonempty(constants_1.validationErrors.customerCountry),
|
|
75
75
|
currency: zod_1.z.string(),
|
|
76
|
-
|
|
76
|
+
invoiceMode: zod_1.z.literal(util_functions_1.QUOTE_INVOICE_MODE.CUSTOMER),
|
|
77
77
|
email: zod_1.z.string().nonempty(constants_1.validationErrors.customerEmail),
|
|
78
78
|
firstName: zod_1.z.string().nonempty(constants_1.validationErrors.customerFirstName),
|
|
79
79
|
lastName: zod_1.z.string().nonempty(constants_1.validationErrors.customerLastName),
|
|
@@ -88,7 +88,7 @@ var companySchema = zod_1.z.object({
|
|
|
88
88
|
companyId: zod_1.z.string().nonempty(constants_1.validationErrors.companyId),
|
|
89
89
|
currency: zod_1.z.string().nonempty(constants_1.validationErrors.currency),
|
|
90
90
|
date: zod_1.z.string().nonempty(constants_1.validationErrors.date),
|
|
91
|
-
|
|
91
|
+
invoiceMode: zod_1.z.literal(util_functions_1.QUOTE_INVOICE_MODE.COMPANY),
|
|
92
92
|
expiryDate: zod_1.z.string().nonempty(constants_1.validationErrors.expiryDate),
|
|
93
93
|
note: zod_1.z.string().optional(),
|
|
94
94
|
ref: zod_1.z.string().nonempty(constants_1.validationErrors.ref),
|
|
@@ -98,7 +98,7 @@ var companySchema = zod_1.z.object({
|
|
|
98
98
|
// ============================================================================
|
|
99
99
|
// MAIN FORM VALIDATION (DISCRIMINATED UNION)
|
|
100
100
|
// ============================================================================
|
|
101
|
-
exports.formValid = zod_1.z.discriminatedUnion("
|
|
101
|
+
exports.formValid = zod_1.z.discriminatedUnion("invoiceMode", [
|
|
102
102
|
customerSchema,
|
|
103
103
|
companySchema,
|
|
104
104
|
]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Cache
|
|
3
|
+
*
|
|
4
|
+
* Client-side caching utilities for payment data.
|
|
5
|
+
* Uses localStorage-backed cache to reduce redundant API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { PaymentBE, type ListResponse } from "@react-pakistan/util-functions";
|
|
8
|
+
export declare const getCachedPaymentsSync: () => ListResponse<PaymentBE> | null;
|
|
9
|
+
export declare const getCachedPayments: ({ params, }?: {
|
|
10
|
+
params?: Record<string, unknown>;
|
|
11
|
+
}) => Promise<ListResponse<PaymentBE>>;
|
|
12
|
+
export declare const getCachedPaymentById: (paymentId: string) => PaymentBE | null;
|
|
13
|
+
export declare const invalidatePaymentsCache: () => void;
|
|
14
|
+
export declare const preloadPayments: () => Promise<ListResponse<PaymentBE>>;
|
|
15
|
+
export declare const isPaymentsCacheStale: () => boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Payment Cache
|
|
4
|
+
*
|
|
5
|
+
* Client-side caching utilities for payment data.
|
|
6
|
+
* Uses localStorage-backed cache to reduce redundant API calls.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.isPaymentsCacheStale = exports.preloadPayments = exports.invalidatePaymentsCache = exports.getCachedPaymentById = exports.getCachedPayments = exports.getCachedPaymentsSync = void 0;
|
|
10
|
+
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
11
|
+
var constants_1 = require("./constants");
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// CACHE CONFIG
|
|
14
|
+
// ============================================================================
|
|
15
|
+
var PAYMENTS_CACHE_KEY = "stellar_payments_cache";
|
|
16
|
+
var PAYMENT_CACHE_CONFIG = {
|
|
17
|
+
apiUrl: constants_1.PAYMENT_API_ROUTES.UNIT,
|
|
18
|
+
cacheKey: PAYMENTS_CACHE_KEY,
|
|
19
|
+
};
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// CACHE UTILITIES
|
|
22
|
+
// ============================================================================
|
|
23
|
+
var getCachedPaymentsSync = function () {
|
|
24
|
+
return (0, util_functions_1.getCachedDataSync)(PAYMENTS_CACHE_KEY);
|
|
25
|
+
};
|
|
26
|
+
exports.getCachedPaymentsSync = getCachedPaymentsSync;
|
|
27
|
+
var getCachedPayments = function (_a) {
|
|
28
|
+
var _b = _a === void 0 ? {} : _a, params = _b.params;
|
|
29
|
+
return (0, util_functions_1.getCachedData)({
|
|
30
|
+
config: PAYMENT_CACHE_CONFIG,
|
|
31
|
+
params: params,
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
"x-api-token": process.env.NEXT_PUBLIC_API_KEY,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.getCachedPayments = getCachedPayments;
|
|
39
|
+
var getCachedPaymentById = function (paymentId) {
|
|
40
|
+
return (0, util_functions_1.getCachedItemById)(PAYMENTS_CACHE_KEY, paymentId);
|
|
41
|
+
};
|
|
42
|
+
exports.getCachedPaymentById = getCachedPaymentById;
|
|
43
|
+
var invalidatePaymentsCache = function () {
|
|
44
|
+
return (0, util_functions_1.invalidateCache)(PAYMENTS_CACHE_KEY);
|
|
45
|
+
};
|
|
46
|
+
exports.invalidatePaymentsCache = invalidatePaymentsCache;
|
|
47
|
+
var preloadPayments = function () {
|
|
48
|
+
return (0, util_functions_1.preloadCache)(PAYMENT_CACHE_CONFIG);
|
|
49
|
+
};
|
|
50
|
+
exports.preloadPayments = preloadPayments;
|
|
51
|
+
var isPaymentsCacheStale = function () { return (0, util_functions_1.isCacheStale)(PAYMENTS_CACHE_KEY); };
|
|
52
|
+
exports.isPaymentsCacheStale = isPaymentsCacheStale;
|
|
@@ -20,24 +20,11 @@ export declare const pageLimit: number;
|
|
|
20
20
|
/**
|
|
21
21
|
* Validation error keys for i18n translation
|
|
22
22
|
*/
|
|
23
|
-
export declare const VALIDATION_KEYS: {
|
|
24
|
-
amount: string;
|
|
25
|
-
attachment: string;
|
|
26
|
-
balance: string;
|
|
27
|
-
currency: string;
|
|
28
|
-
date: string;
|
|
29
|
-
description: string;
|
|
30
|
-
paymentMode: string;
|
|
31
|
-
paymentType: string;
|
|
32
|
-
quoteInvoice: string;
|
|
33
|
-
ref: string;
|
|
34
|
-
};
|
|
35
23
|
/**
|
|
36
24
|
* API routes for payment-related operations
|
|
37
25
|
*/
|
|
38
26
|
export declare const PAYMENT_API_ROUTES: {
|
|
39
|
-
readonly
|
|
40
|
-
readonly PAYMENT_BY_ID: "/api/payment/payment-by-id";
|
|
27
|
+
readonly UNIT: "/api/payment";
|
|
41
28
|
readonly PAYMENT_MODES: "/api/payment-modes";
|
|
42
29
|
readonly PAYMENTS: "/api/payments";
|
|
43
30
|
readonly QUOTE_INVOICES: "/api/quotes-invoices";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"use client";
|
|
16
16
|
"use strict";
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.uiMessages = exports.validationError = exports.formInfo = exports.tableBodyCols = exports.PAYMENT_API_ROUTES = exports.
|
|
18
|
+
exports.uiMessages = exports.validationError = exports.formInfo = exports.tableBodyCols = exports.PAYMENT_API_ROUTES = exports.pageLimit = void 0;
|
|
19
19
|
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
20
20
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
21
21
|
// ============================================================================
|
|
@@ -31,18 +31,6 @@ exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
|
|
|
31
31
|
/**
|
|
32
32
|
* Validation error keys for i18n translation
|
|
33
33
|
*/
|
|
34
|
-
exports.VALIDATION_KEYS = {
|
|
35
|
-
amount: "validationAmountRequired",
|
|
36
|
-
attachment: "validationAttachmentInvalid",
|
|
37
|
-
balance: "validationBalanceInvalid",
|
|
38
|
-
currency: "validationCurrencyRequired",
|
|
39
|
-
date: "validationDateRequired",
|
|
40
|
-
description: "validationDescriptionInvalid",
|
|
41
|
-
paymentMode: "validationPaymentModeRequired",
|
|
42
|
-
paymentType: "validationPaymentTypeRequired",
|
|
43
|
-
quoteInvoice: "validationQuoteInvoiceRequired",
|
|
44
|
-
ref: "validationRefInvalid",
|
|
45
|
-
};
|
|
46
34
|
// ============================================================================
|
|
47
35
|
// API ROUTES
|
|
48
36
|
// ============================================================================
|
|
@@ -50,8 +38,7 @@ exports.VALIDATION_KEYS = {
|
|
|
50
38
|
* API routes for payment-related operations
|
|
51
39
|
*/
|
|
52
40
|
exports.PAYMENT_API_ROUTES = {
|
|
53
|
-
|
|
54
|
-
PAYMENT_BY_ID: "/api/payment/payment-by-id",
|
|
41
|
+
UNIT: "/api/payment",
|
|
55
42
|
PAYMENT_MODES: "/api/payment-modes",
|
|
56
43
|
PAYMENTS: "/api/payments",
|
|
57
44
|
QUOTE_INVOICES: "/api/quotes-invoices",
|