@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.
Files changed (89) hide show
  1. package/base-modules/invoice/add-service-product-section.d.ts +1 -5
  2. package/base-modules/invoice/add-service-product-section.js +3 -3
  3. package/base-modules/invoice/cache.d.ts +15 -0
  4. package/base-modules/invoice/cache.js +50 -0
  5. package/base-modules/invoice/calculate-subtotal.d.ts +6 -1
  6. package/base-modules/invoice/calculate-subtotal.js +2 -2
  7. package/base-modules/invoice/calculate-total.d.ts +1 -1
  8. package/base-modules/invoice/calculate-total.js +8 -8
  9. package/base-modules/invoice/company-form-section.d.ts +1 -5
  10. package/base-modules/invoice/company-form-section.js +25 -22
  11. package/base-modules/invoice/constants.d.ts +2 -3
  12. package/base-modules/invoice/constants.js +2 -3
  13. package/base-modules/invoice/context.d.ts +556 -20
  14. package/base-modules/invoice/context.js +530 -342
  15. package/base-modules/invoice/customer-form-section.d.ts +1 -5
  16. package/base-modules/invoice/customer-form-section.js +25 -9
  17. package/base-modules/invoice/form.d.ts +1 -5
  18. package/base-modules/invoice/form.js +9 -9
  19. package/base-modules/invoice/page.d.ts +8 -0
  20. package/base-modules/invoice/page.js +171 -0
  21. package/base-modules/invoice/pricing-form-section.d.ts +1 -5
  22. package/base-modules/invoice/pricing-form-section.js +16 -11
  23. package/base-modules/invoice/products-form-section.d.ts +1 -5
  24. package/base-modules/invoice/products-form-section.js +49 -40
  25. package/base-modules/invoice/services-form-section.d.ts +1 -5
  26. package/base-modules/invoice/services-form-section.js +10 -9
  27. package/base-modules/invoice/validate.d.ts +83 -25
  28. package/base-modules/invoice/validate.js +4 -4
  29. package/base-modules/payment/cache.d.ts +15 -0
  30. package/base-modules/payment/cache.js +52 -0
  31. package/base-modules/payment/constants.d.ts +1 -14
  32. package/base-modules/payment/constants.js +2 -15
  33. package/base-modules/payment/context.d.ts +214 -48
  34. package/base-modules/payment/context.js +266 -237
  35. package/base-modules/payment/drawer.d.ts +0 -6
  36. package/base-modules/payment/drawer.js +89 -44
  37. package/base-modules/payment/form.js +3 -2
  38. package/base-modules/payment/{payment.js → page.js} +2 -5
  39. package/base-modules/payment/types.d.ts +0 -85
  40. package/base-modules/payment/types.js +74 -21
  41. package/base-modules/payment/validate.d.ts +12 -0
  42. package/base-modules/payment/validate.js +19 -8
  43. package/base-modules/payment/view.d.ts +1 -5
  44. package/base-modules/payment/view.js +4 -3
  45. package/base-modules/quote/add-service-product-section.js +1 -1
  46. package/base-modules/quote/cache.d.ts +15 -0
  47. package/base-modules/quote/cache.js +50 -0
  48. package/base-modules/quote/company-form-section.d.ts +1 -1
  49. package/base-modules/quote/company-form-section.js +14 -12
  50. package/base-modules/quote/constants.js +1 -0
  51. package/base-modules/quote/context.d.ts +656 -46
  52. package/base-modules/quote/context.js +413 -289
  53. package/base-modules/quote/customer-form-section.d.ts +1 -1
  54. package/base-modules/quote/customer-form-section.js +24 -9
  55. package/base-modules/quote/form.d.ts +1 -5
  56. package/base-modules/quote/form.js +8 -9
  57. package/base-modules/quote/page.d.ts +8 -0
  58. package/base-modules/quote/page.js +163 -0
  59. package/base-modules/quote/pricing-form-section.js +9 -8
  60. package/base-modules/quote/products-form-section.js +2 -2
  61. package/base-modules/quote/services-form-section.js +1 -1
  62. package/base-modules/quote/types.d.ts +0 -127
  63. package/base-modules/quote/types.js +92 -35
  64. package/base-modules/quote/validate.d.ts +82 -25
  65. package/base-modules/quote/validate.js +3 -4
  66. package/package.json +8 -8
  67. package/base-modules/invoice/actions.d.ts +0 -215
  68. package/base-modules/invoice/actions.js +0 -38
  69. package/base-modules/invoice/drawer.d.ts +0 -13
  70. package/base-modules/invoice/drawer.js +0 -46
  71. package/base-modules/invoice/invoice.d.ts +0 -8
  72. package/base-modules/invoice/invoice.js +0 -69
  73. package/base-modules/invoice/reducer.d.ts +0 -4
  74. package/base-modules/invoice/reducer.js +0 -180
  75. package/base-modules/invoice/types.d.ts +0 -211
  76. package/base-modules/invoice/types.js +0 -43
  77. package/base-modules/payment/actions.d.ts +0 -203
  78. package/base-modules/payment/actions.js +0 -50
  79. package/base-modules/payment/reducer.d.ts +0 -29
  80. package/base-modules/payment/reducer.js +0 -215
  81. package/base-modules/quote/actions.d.ts +0 -215
  82. package/base-modules/quote/actions.js +0 -38
  83. package/base-modules/quote/drawer.d.ts +0 -13
  84. package/base-modules/quote/drawer.js +0 -46
  85. package/base-modules/quote/quote.d.ts +0 -8
  86. package/base-modules/quote/quote.js +0 -69
  87. package/base-modules/quote/reducer.d.ts +0 -4
  88. package/base-modules/quote/reducer.js +0 -181
  89. /package/base-modules/payment/{payment.d.ts → page.d.ts} +0 -0
@@ -1,56 +1,222 @@
1
1
  /**
2
- * Payment State Context
2
+ * Payment State Context - Using Generic Module Factory
3
3
  *
4
- * This module provides comprehensive state management for the Payment feature including:
5
- * - CRUD operations (create, read, update, delete)
6
- * - Form validation and error handling
7
- * - Search and filtering functionality
8
- * - Pagination controls
9
- * - Payment mode and quote invoice integration
10
- * - Currency management with default selection
11
- * - Internationalization support
12
- * - Theme-aware toast notifications
13
- *
14
- * Organization:
15
- * - Types & Interfaces
16
- * - Main Hook (usePaymentState)
17
- * - State & Core Hooks
18
- * - Debounced Values
19
- * - API Parameters (memoized)
20
- * - API Callbacks (with error handling)
21
- * - Module Entity Hook
22
- * - Effects (list refresh, currency defaults)
23
- * - Drawer & Modal Handlers
24
- * - CRUD Operation Handlers
25
- * - Form Handlers
26
- * - Pagination Handlers
27
- * - Search Handlers
28
- * - Table Actions (memoized)
29
- * - Return State
30
- * - Context Setup
31
- * - Provider Component
32
- * - Custom Hook
4
+ * This module provides comprehensive state management for the Payment feature using
5
+ * the createGenericModule factory pattern.
33
6
  */
34
- import React, { FC, ReactNode } from "react";
35
- import { PaymentContextType, PaymentState } from "./types";
36
- type State = PaymentContextType & PaymentState & {
37
- headerActions: Array<{
38
- enabled: boolean;
39
- handleOnClick: () => void;
40
- label: string;
41
- order: number;
42
- }>;
43
- rowActions: Array<{
7
+ import { PaymentModeBE, PaymentBE, QuoteInvoiceBE, PAYMENT_TYPE } from "@react-pakistan/util-functions";
8
+ export declare const paymentReducer: (state: {
9
+ items: PaymentBE[];
10
+ count: number;
11
+ currentPage: number;
12
+ pageLimit: number;
13
+ searchQuery: string;
14
+ disableSaveButton: boolean;
15
+ drawer: null;
16
+ modal: null;
17
+ errors: Record<string, string>;
18
+ amount: string;
19
+ attachment: string;
20
+ balance: string;
21
+ currency: string;
22
+ date: string;
23
+ description: string;
24
+ id: string;
25
+ mode: "Create" | "Edit";
26
+ paymentModeId: string;
27
+ paymentModeQuery: string;
28
+ paymentType: PAYMENT_TYPE;
29
+ quoteInvoiceId: string;
30
+ quoteInvoiceQuery: string;
31
+ ref: string;
32
+ invoice: QuoteInvoiceBE | null;
33
+ paymentModes: PaymentModeBE[];
34
+ quoteInvoices: QuoteInvoiceBE[];
35
+ paymentMode: PaymentModeBE | undefined;
36
+ quoteInvoice: QuoteInvoiceBE | undefined;
37
+ }, action: any) => {
38
+ items: PaymentBE[];
39
+ count: number;
40
+ currentPage: number;
41
+ pageLimit: number;
42
+ searchQuery: string;
43
+ disableSaveButton: boolean;
44
+ drawer: null;
45
+ modal: null;
46
+ errors: Record<string, string>;
47
+ amount: string;
48
+ attachment: string;
49
+ balance: string;
50
+ currency: string;
51
+ date: string;
52
+ description: string;
53
+ id: string;
54
+ mode: "Create" | "Edit";
55
+ paymentModeId: string;
56
+ paymentModeQuery: string;
57
+ paymentType: PAYMENT_TYPE;
58
+ quoteInvoiceId: string;
59
+ quoteInvoiceQuery: string;
60
+ ref: string;
61
+ invoice: QuoteInvoiceBE | null;
62
+ paymentModes: PaymentModeBE[];
63
+ quoteInvoices: QuoteInvoiceBE[];
64
+ paymentMode: PaymentModeBE | undefined;
65
+ quoteInvoice: QuoteInvoiceBE | undefined;
66
+ }, PaymentCoreProvider: import("react").FC<{
67
+ children: React.ReactNode;
68
+ }>, usePaymentCoreContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContext<{
69
+ items: PaymentBE[];
70
+ count: number;
71
+ currentPage: number;
72
+ pageLimit: number;
73
+ searchQuery: string;
74
+ disableSaveButton: boolean;
75
+ drawer: null;
76
+ modal: null;
77
+ errors: Record<string, string>;
78
+ amount: string;
79
+ attachment: string;
80
+ balance: string;
81
+ currency: string;
82
+ date: string;
83
+ description: string;
84
+ id: string;
85
+ mode: "Create" | "Edit";
86
+ paymentModeId: string;
87
+ paymentModeQuery: string;
88
+ paymentType: PAYMENT_TYPE;
89
+ quoteInvoiceId: string;
90
+ quoteInvoiceQuery: string;
91
+ ref: string;
92
+ invoice: QuoteInvoiceBE | null;
93
+ paymentModes: PaymentModeBE[];
94
+ quoteInvoices: QuoteInvoiceBE[];
95
+ paymentMode: PaymentModeBE | undefined;
96
+ quoteInvoice: QuoteInvoiceBE | undefined;
97
+ }>, paymentModuleConfig: import("@react-pakistan/util-functions/factory/generic-module-factory").ModuleConfig<{
98
+ items: PaymentBE[];
99
+ count: number;
100
+ currentPage: number;
101
+ pageLimit: number;
102
+ searchQuery: string;
103
+ disableSaveButton: boolean;
104
+ drawer: null;
105
+ modal: null;
106
+ errors: Record<string, string>;
107
+ amount: string;
108
+ attachment: string;
109
+ balance: string;
110
+ currency: string;
111
+ date: string;
112
+ description: string;
113
+ id: string;
114
+ mode: "Create" | "Edit";
115
+ paymentModeId: string;
116
+ paymentModeQuery: string;
117
+ paymentType: PAYMENT_TYPE;
118
+ quoteInvoiceId: string;
119
+ quoteInvoiceQuery: string;
120
+ ref: string;
121
+ invoice: QuoteInvoiceBE | null;
122
+ paymentModes: PaymentModeBE[];
123
+ quoteInvoices: QuoteInvoiceBE[];
124
+ paymentMode: PaymentModeBE | undefined;
125
+ quoteInvoice: QuoteInvoiceBE | undefined;
126
+ }>, PAYMENT_ACTION_TYPES: {
127
+ readonly RESET_FORM: "RESET_FORM";
128
+ readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
129
+ readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
130
+ readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY";
131
+ readonly SET_DRAWER: "SET_DRAWER";
132
+ readonly SET_ITEMS: "SET_ITEMS";
133
+ readonly SET_FORM_DATA: "SET_FORM_DATA";
134
+ readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON";
135
+ readonly SET_INPUT_FIELD: "SET_INPUT_FIELD";
136
+ readonly SET_ERRORS: "SET_ERRORS";
137
+ }, initialPaymentState: {
138
+ items: PaymentBE[];
139
+ count: number;
140
+ currentPage: number;
141
+ pageLimit: number;
142
+ searchQuery: string;
143
+ disableSaveButton: boolean;
144
+ drawer: null;
145
+ modal: null;
146
+ errors: Record<string, string>;
147
+ amount: string;
148
+ attachment: string;
149
+ balance: string;
150
+ currency: string;
151
+ date: string;
152
+ description: string;
153
+ id: string;
154
+ mode: "Create" | "Edit";
155
+ paymentModeId: string;
156
+ paymentModeQuery: string;
157
+ paymentType: PAYMENT_TYPE;
158
+ quoteInvoiceId: string;
159
+ quoteInvoiceQuery: string;
160
+ ref: string;
161
+ invoice: QuoteInvoiceBE | null;
162
+ paymentModes: PaymentModeBE[];
163
+ quoteInvoices: QuoteInvoiceBE[];
164
+ paymentMode: PaymentModeBE | undefined;
165
+ quoteInvoice: QuoteInvoiceBE | undefined;
166
+ };
167
+ export declare const usePaymentModule: () => {
168
+ payments: PaymentBE[];
169
+ byIdError: Error | undefined;
170
+ byIdLoading: boolean;
171
+ clearSearch: () => void;
172
+ closeDrawer: () => void;
173
+ deleteError: Error | undefined;
174
+ deleteLoading: boolean;
175
+ dispatch: import("react").Dispatch<any>;
176
+ handleChange: (key: string, value: string | number | number[]) => void;
177
+ handleNextClick: () => void;
178
+ handlePageLimit: (node: string, value: object) => void;
179
+ handlePreviousClick: () => void;
180
+ handleSubmit: () => void;
181
+ headerActions: never[];
182
+ listError: Error | undefined;
183
+ listFetchNow: (url?: string, config?: import("@react-pakistan/util-functions").FetchConfig) => void;
184
+ listLoading: boolean;
185
+ rowActions: {
44
186
  enabled: boolean;
45
187
  handleAction: (id: string) => void;
46
188
  label: string;
47
189
  order: number;
48
- }>;
190
+ }[];
191
+ searchOnChange: (k: string, v: string) => void;
192
+ updateError: Error | undefined;
193
+ updateLoading: boolean;
194
+ items: PaymentBE[];
195
+ count: number;
196
+ currentPage: number;
197
+ pageLimit: number;
198
+ searchQuery: string;
199
+ disableSaveButton: boolean;
200
+ drawer: null;
201
+ modal: null;
202
+ errors: Record<string, string>;
203
+ amount: string;
204
+ attachment: string;
205
+ balance: string;
206
+ currency: string;
207
+ date: string;
208
+ description: string;
209
+ id: string;
210
+ mode: "Create" | "Edit";
211
+ paymentModeId: string;
212
+ paymentModeQuery: string;
213
+ paymentType: PAYMENT_TYPE;
214
+ quoteInvoiceId: string;
215
+ quoteInvoiceQuery: string;
216
+ ref: string;
217
+ invoice: QuoteInvoiceBE | null;
218
+ paymentModes: PaymentModeBE[];
219
+ quoteInvoices: QuoteInvoiceBE[];
220
+ paymentMode: PaymentModeBE | undefined;
221
+ quoteInvoice: QuoteInvoiceBE | undefined;
49
222
  };
50
- interface StateProviderProps {
51
- children: ReactNode;
52
- }
53
- export declare const PaymentStateContext: React.Context<State>;
54
- export declare const PaymentStateContextProvider: FC<StateProviderProps>;
55
- export declare const usePaymentStateContext: () => State;
56
- export {};