@appcorp/stellar-solutions-modules 0.1.34 → 0.1.36
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/README.md +128 -19
- package/components/theme-provider.d.ts +9 -0
- package/components/theme-provider.js +122 -0
- package/components/theme-switcher.d.ts +4 -0
- package/components/theme-switcher.js +60 -0
- package/components/ui/badge.d.ts +9 -0
- package/components/ui/badge.js +82 -0
- package/components/ui/button.d.ts +10 -0
- package/components/ui/button.js +91 -0
- package/components/ui/card.d.ts +9 -0
- package/components/ui/card.js +94 -0
- package/components/ui/checkbox.d.ts +9 -0
- package/components/ui/checkbox.js +87 -0
- package/components/ui/combobox.d.ts +70 -0
- package/components/ui/combobox.js +315 -0
- package/components/ui/command.d.ts +18 -0
- package/components/ui/command.js +115 -0
- package/components/ui/dialog.d.ts +15 -0
- package/components/ui/dialog.js +118 -0
- package/components/ui/drawer.d.ts +13 -0
- package/components/ui/drawer.js +115 -0
- package/components/ui/dropdown-menu.d.ts +25 -0
- package/components/ui/dropdown-menu.js +148 -0
- package/components/ui/enhanced-table-footer-action.d.ts +34 -0
- package/components/ui/enhanced-table-footer-action.js +117 -0
- package/components/ui/enhanced-table-footer-page.d.ts +32 -0
- package/components/ui/enhanced-table-footer-page.js +140 -0
- package/components/ui/enhanced-table-footer-pagination.d.ts +36 -0
- package/components/ui/enhanced-table-footer-pagination.js +122 -0
- package/components/ui/enhanced-table-header-action.d.ts +7 -0
- package/components/ui/enhanced-table-header-action.js +21 -0
- package/components/ui/enhanced-table-header-search.d.ts +12 -0
- package/components/ui/enhanced-table-header-search.js +17 -0
- package/components/ui/enhanced-table.d.ts +65 -0
- package/components/ui/enhanced-table.js +87 -0
- package/components/ui/form.d.ts +24 -0
- package/components/ui/form.js +125 -0
- package/components/ui/input.d.ts +8 -0
- package/components/ui/input.js +86 -0
- package/components/ui/label.d.ts +7 -0
- package/components/ui/label.js +68 -0
- package/components/ui/popover.d.ts +7 -0
- package/components/ui/popover.js +82 -0
- package/components/ui/select.d.ts +15 -0
- package/components/ui/select.js +127 -0
- package/components/ui/separator.d.ts +4 -0
- package/components/ui/separator.js +66 -0
- package/components/ui/sonner.d.ts +4 -0
- package/components/ui/sonner.js +54 -0
- package/components/ui/switch.d.ts +9 -0
- package/components/ui/switch.js +89 -0
- package/components/ui/table.d.ts +10 -0
- package/components/ui/table.js +101 -0
- package/components/ui/textarea.d.ts +8 -0
- package/components/ui/textarea.js +86 -0
- package/global-modules/bank/actions.d.ts +200 -0
- package/global-modules/bank/actions.js +124 -0
- package/global-modules/bank/bank.d.ts +2 -0
- package/global-modules/bank/bank.js +87 -0
- package/global-modules/bank/constants.d.ts +45 -0
- package/global-modules/bank/constants.js +98 -0
- package/global-modules/bank/context.d.ts +41 -0
- package/global-modules/bank/context.js +419 -0
- package/global-modules/bank/drawer.d.ts +31 -0
- package/global-modules/bank/drawer.js +114 -0
- package/global-modules/bank/form.d.ts +22 -0
- package/global-modules/bank/form.js +68 -0
- package/global-modules/bank/reducer.d.ts +25 -0
- package/global-modules/bank/reducer.js +161 -0
- package/global-modules/bank/types.d.ts +217 -0
- package/global-modules/bank/types.js +81 -0
- package/global-modules/bank/validate.d.ts +13 -0
- package/global-modules/bank/validate.js +22 -0
- package/global-modules/branch/actions.d.ts +154 -37
- package/global-modules/branch/actions.js +148 -6
- package/global-modules/branch/branch.d.ts +2 -2
- package/global-modules/branch/branch.js +46 -32
- package/global-modules/branch/constants.d.ts +34 -24
- package/global-modules/branch/constants.js +101 -122
- package/global-modules/branch/context.d.ts +33 -2
- package/global-modules/branch/context.js +195 -164
- package/global-modules/branch/drawer.d.ts +26 -3
- package/global-modules/branch/drawer.js +101 -6
- package/global-modules/branch/form.d.ts +15 -1
- package/global-modules/branch/form.js +54 -71
- package/global-modules/branch/reducer.d.ts +23 -2
- package/global-modules/branch/reducer.js +148 -118
- package/global-modules/branch/types.d.ts +196 -69
- package/global-modules/branch/types.js +66 -7
- package/global-modules/branch/validate.d.ts +1 -1
- package/global-modules/branch/validate.js +15 -11
- package/global-modules/payment-mode/actions.d.ts +154 -37
- package/global-modules/payment-mode/actions.js +148 -6
- package/global-modules/payment-mode/constants.d.ts +34 -17
- package/global-modules/payment-mode/constants.js +90 -66
- package/global-modules/payment-mode/context.d.ts +33 -2
- package/global-modules/payment-mode/context.js +185 -163
- package/global-modules/payment-mode/drawer.d.ts +26 -3
- package/global-modules/payment-mode/drawer.js +104 -9
- package/global-modules/payment-mode/form.d.ts +16 -2
- package/global-modules/payment-mode/form.js +45 -74
- package/global-modules/payment-mode/payment-mode.d.ts +25 -2
- package/global-modules/payment-mode/payment-mode.js +90 -23
- package/global-modules/payment-mode/reducer.d.ts +23 -2
- package/global-modules/payment-mode/reducer.js +140 -114
- package/global-modules/payment-mode/types.d.ts +327 -112
- package/global-modules/payment-mode/types.js +162 -11
- package/global-modules/payment-mode/validate.d.ts +1 -1
- package/global-modules/payment-mode/validate.js +7 -5
- package/global-modules/preferences/actions.d.ts +126 -27
- package/global-modules/preferences/actions.js +128 -4
- package/global-modules/preferences/constants.d.ts +46 -31
- package/global-modules/preferences/constants.js +129 -66
- package/global-modules/preferences/context.d.ts +2 -2
- package/global-modules/preferences/context.js +43 -43
- package/global-modules/preferences/currency.js +15 -10
- package/global-modules/preferences/preferences.d.ts +2 -2
- package/global-modules/preferences/preferences.js +3 -5
- package/global-modules/preferences/validate.d.ts +1 -1
- package/global-modules/preferences/validate.js +7 -7
- package/global-modules/tax/actions.d.ts +155 -38
- package/global-modules/tax/actions.js +149 -7
- package/global-modules/tax/constants.d.ts +31 -39
- package/global-modules/tax/constants.js +83 -114
- package/global-modules/tax/context.d.ts +33 -2
- package/global-modules/tax/context.js +146 -132
- package/global-modules/tax/drawer.d.ts +26 -3
- package/global-modules/tax/drawer.js +101 -6
- package/global-modules/tax/form.d.ts +20 -3
- package/global-modules/tax/form.js +101 -74
- package/global-modules/tax/reducer.d.ts +23 -2
- package/global-modules/tax/reducer.js +143 -24
- package/global-modules/tax/tax.d.ts +25 -2
- package/global-modules/tax/tax.js +92 -28
- package/global-modules/tax/types.d.ts +332 -102
- package/global-modules/tax/types.js +179 -11
- package/global-modules/tax/validate.d.ts +1 -1
- package/global-modules/tax/validate.js +9 -8
- package/hooks/use-rtl.d.ts +44 -0
- package/hooks/use-rtl.js +75 -0
- package/i18n/navigation.d.ts +340 -0
- package/i18n/navigation.js +9 -0
- package/i18n/request.d.ts +2 -0
- package/i18n/request.js +95 -0
- package/i18n/routing.d.ts +18 -0
- package/i18n/routing.js +9 -0
- package/index.d.ts +26 -0
- package/index.js +42 -0
- package/lib/themes.d.ts +147 -0
- package/lib/themes.js +150 -0
- package/lib/toast-utils.d.ts +44 -0
- package/lib/toast-utils.js +212 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +12 -0
- package/package.json +21 -3
- package/supabase/supabase.d.ts +80 -1
- package/supabase/supabase.js +281 -6
- package/global-modules/branch/form-elements.d.ts +0 -3
- package/global-modules/branch/form-elements.js +0 -41
- package/global-modules/payment-mode/form-elements.d.ts +0 -3
- package/global-modules/payment-mode/form-elements.js +0 -41
- package/global-modules/preferences/bank.d.ts +0 -2
- package/global-modules/preferences/bank.js +0 -11
- package/global-modules/preferences/branch-drawer.js +0 -36
- package/global-modules/preferences/branch-form-elements.js +0 -30
- package/global-modules/preferences/branch-form.d.ts +0 -0
- package/global-modules/preferences/branch-form.js +0 -33
- package/global-modules/preferences/branch.d.ts +0 -0
- package/global-modules/preferences/branch.js +0 -106
- package/global-modules/preferences/payment-mode-drawer.d.ts +0 -0
- package/global-modules/preferences/payment-mode-drawer.js +0 -36
- package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form-elements.js +0 -30
- package/global-modules/preferences/payment-mode-form.d.ts +0 -0
- package/global-modules/preferences/payment-mode-form.js +0 -33
- package/global-modules/preferences/payment-mode.d.ts +0 -0
- package/global-modules/preferences/payment-mode.js +0 -94
- package/global-modules/tax/form-elements.d.ts +0 -3
- package/global-modules/tax/form-elements.js +0 -41
- /package/{global-modules/preferences/branch-drawer.d.ts → constants.d.ts} +0 -0
- /package/{global-modules/preferences/branch-form-elements.d.ts → constants.js} +0 -0
|
@@ -1,48 +1,271 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Payment Mode Module Types
|
|
3
|
+
*
|
|
4
|
+
* This module defines all TypeScript interfaces, types, and enums for the Payment Mode feature.
|
|
5
|
+
* Provides type safety and clear contracts for all payment mode-related operations.
|
|
6
|
+
*
|
|
7
|
+
* Type Categories:
|
|
8
|
+
* - Context Types (React context and state management)
|
|
9
|
+
* - Entity Types (Backend data structures)
|
|
10
|
+
* - State Types (Frontend component state)
|
|
11
|
+
* - API Types (Request/response interfaces)
|
|
12
|
+
* - UI Types (Drawer and component enums)
|
|
13
|
+
* - Utility Types (Helper and computed types)
|
|
14
|
+
*
|
|
15
|
+
* Advanced Features:
|
|
16
|
+
* - Payment mode management
|
|
17
|
+
* - CRUD operations support
|
|
18
|
+
* - Enhanced search and pagination
|
|
19
|
+
*
|
|
20
|
+
* Naming Conventions:
|
|
21
|
+
* - Interfaces: PascalCase with descriptive suffixes (Type, State, Args)
|
|
22
|
+
* - Enums: UPPER_SNAKE_CASE for values, PascalCase for enum names
|
|
23
|
+
* - Types: PascalCase following interface conventions
|
|
24
|
+
*/
|
|
25
|
+
import { Dispatch } from "react";
|
|
26
|
+
import { RowAction, HeaderAction } from "@/components/ui/enhanced-table";
|
|
27
|
+
import { PaymentModeActions } from "./actions";
|
|
28
|
+
/**
|
|
29
|
+
* Payment Mode Context Interface
|
|
30
|
+
*
|
|
31
|
+
* Defines the complete context API for payment mode state management.
|
|
32
|
+
* Includes all handlers, state getters, and utility functions.
|
|
33
|
+
*/
|
|
34
|
+
export interface PaymentModeContextType {
|
|
35
|
+
byIdError?: Error;
|
|
36
|
+
byIdLoading: boolean;
|
|
37
|
+
deleteError?: Error;
|
|
38
|
+
deleteLoading: boolean;
|
|
39
|
+
listError?: Error;
|
|
40
|
+
listLoading: boolean;
|
|
41
|
+
updateError?: Error;
|
|
42
|
+
updateLoading: boolean;
|
|
43
|
+
dispatch: Dispatch<PaymentModeActions>;
|
|
44
|
+
handleInputChange: (k: string, v: string | boolean) => void;
|
|
45
|
+
handleNextClick: () => void;
|
|
46
|
+
handlePageLimit: (k: string, v: object) => void;
|
|
47
|
+
handlePreviousClick: () => void;
|
|
48
|
+
handleSubmit: () => void;
|
|
49
|
+
clearSearch: () => void;
|
|
50
|
+
closeDrawer: () => void;
|
|
51
|
+
searchOnChange: (k: string, v: string) => void;
|
|
52
|
+
headerActions: HeaderAction[];
|
|
53
|
+
rowActions: RowAction[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Payment Mode Backend Entity
|
|
57
|
+
*
|
|
58
|
+
* Represents the complete payment mode data structure as received from the API.
|
|
59
|
+
* Includes all payment mode-specific fields and relationships.
|
|
60
|
+
*/
|
|
61
|
+
export interface PaymentModeTypeBE {
|
|
62
|
+
createdAt: string;
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
id: string;
|
|
65
|
+
isDefault: boolean;
|
|
8
66
|
label: string;
|
|
9
|
-
|
|
67
|
+
payments?: PaymentTypeBE[];
|
|
68
|
+
preference?: PreferenceTypeBE;
|
|
69
|
+
preferenceId: string;
|
|
70
|
+
updatedAt: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Payment Backend Entity
|
|
74
|
+
*
|
|
75
|
+
* Represents payment data structure with payment mode relationship.
|
|
76
|
+
*/
|
|
77
|
+
export interface PaymentTypeBE {
|
|
78
|
+
amount: string;
|
|
79
|
+
attachment?: string;
|
|
80
|
+
balance: string;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
currency: string;
|
|
83
|
+
date: string;
|
|
84
|
+
description?: string;
|
|
10
85
|
id: string;
|
|
86
|
+
paymentMode?: PaymentModeTypeBE;
|
|
87
|
+
paymentModeId: string;
|
|
88
|
+
paymentType: PAYMENT_TYPE;
|
|
89
|
+
quoteInvoice?: undefined;
|
|
90
|
+
quoteInvoiceId: string;
|
|
91
|
+
ref: string;
|
|
92
|
+
updatedAt: string;
|
|
11
93
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Preference Backend Entity
|
|
96
|
+
*
|
|
97
|
+
* Represents preference data structure containing payment modes.
|
|
98
|
+
*/
|
|
99
|
+
export interface PreferenceTypeBE {
|
|
100
|
+
bankingDetails: BankingDetailTypeBE[];
|
|
101
|
+
branches: BranchTypeBE[];
|
|
102
|
+
createdAt: string;
|
|
103
|
+
currencies: CurrencyTypeBE[];
|
|
15
104
|
id: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
createdAt?: string;
|
|
23
|
-
updatedAt?: string;
|
|
24
|
-
loading: boolean;
|
|
25
|
-
isDefault: boolean;
|
|
26
|
-
btnDisableTax: boolean;
|
|
105
|
+
menuOrder: MenuOrderTypeBE[];
|
|
106
|
+
onboarding: boolean;
|
|
107
|
+
paymentModes: PaymentModeTypeBE[];
|
|
108
|
+
taxes: TaxTypeBE[];
|
|
109
|
+
updatedAt: string;
|
|
27
110
|
}
|
|
28
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Payment Mode Component State
|
|
113
|
+
*
|
|
114
|
+
* Complete state interface for the payment mode module components.
|
|
115
|
+
* Extends entity data with UI state, form state, and search capabilities.
|
|
116
|
+
*/
|
|
29
117
|
export interface PaymentModeState {
|
|
30
118
|
count: number;
|
|
119
|
+
paymentModes: PaymentModeTypeBE[];
|
|
31
120
|
currentPage: number;
|
|
121
|
+
pageLimit: number;
|
|
122
|
+
searchQuery: string;
|
|
32
123
|
disableSaveButton: boolean;
|
|
33
124
|
drawer: null | PAYMENT_MODE_DRAWER;
|
|
34
125
|
enabled: boolean;
|
|
35
|
-
errors:
|
|
36
|
-
[key: string]: string;
|
|
37
|
-
};
|
|
126
|
+
errors: Record<string, string>;
|
|
38
127
|
id: string;
|
|
39
128
|
isDefault: boolean;
|
|
40
129
|
label: string;
|
|
41
|
-
pageLimit: number;
|
|
42
|
-
paymentModes: PaymentModeTypeBE[];
|
|
43
130
|
preferenceId: string;
|
|
44
|
-
searchQuery: string;
|
|
45
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Fetch Payment Modes API Arguments
|
|
134
|
+
*
|
|
135
|
+
* Parameters for payment mode list API requests.
|
|
136
|
+
* Supports pagination and search functionality.
|
|
137
|
+
*/
|
|
138
|
+
export interface FetchPaymentModesArgs {
|
|
139
|
+
currentPage: number;
|
|
140
|
+
pageLimit: number;
|
|
141
|
+
searchQuery?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Payment Mode API Response
|
|
145
|
+
*
|
|
146
|
+
* Standard API response format for payment mode operations.
|
|
147
|
+
*/
|
|
148
|
+
export interface PaymentModeApiResponse {
|
|
149
|
+
data?: PaymentModeTypeBE[];
|
|
150
|
+
count?: number;
|
|
151
|
+
error?: string;
|
|
152
|
+
success: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Single Payment Mode API Response
|
|
156
|
+
*
|
|
157
|
+
* API response format for individual payment mode operations.
|
|
158
|
+
*/
|
|
159
|
+
export interface SinglePaymentModeApiResponse {
|
|
160
|
+
data?: PaymentModeTypeBE;
|
|
161
|
+
error?: string;
|
|
162
|
+
success: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Update Payment Mode Arguments
|
|
166
|
+
*
|
|
167
|
+
* Parameters for payment mode update operations.
|
|
168
|
+
*/
|
|
169
|
+
export interface UpdatePaymentModeArgs {
|
|
170
|
+
id: string;
|
|
171
|
+
enabled: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Payment Mode Drawer Types
|
|
175
|
+
*
|
|
176
|
+
* Enumeration of all available drawer states for payment mode UI.
|
|
177
|
+
*/
|
|
178
|
+
export declare enum PAYMENT_MODE_DRAWER {
|
|
179
|
+
FORM_DRAWER = "FORM_DRAWER"
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Payment Types
|
|
183
|
+
*
|
|
184
|
+
* Enumeration of payment type classifications.
|
|
185
|
+
*/
|
|
186
|
+
export declare enum PAYMENT_TYPE {
|
|
187
|
+
FULL_PAYMENT = "FULL_PAYMENT",
|
|
188
|
+
PARTIAL_PAYMENT = "PARTIAL_PAYMENT"
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Payment Mode Form Fields
|
|
192
|
+
*
|
|
193
|
+
* Utility type for payment mode form field keys.
|
|
194
|
+
* Useful for form validation and dynamic field handling.
|
|
195
|
+
*/
|
|
196
|
+
export type PaymentModeFormFields = keyof Omit<PaymentModeTypeBE, "id" | "createdAt" | "updatedAt" | "payments" | "preference">;
|
|
197
|
+
/**
|
|
198
|
+
* Payment Mode Required Fields
|
|
199
|
+
*
|
|
200
|
+
* Fields that are mandatory for payment mode creation.
|
|
201
|
+
*/
|
|
202
|
+
export type PaymentModeRequiredFields = "label" | "preferenceId";
|
|
203
|
+
/**
|
|
204
|
+
* Payment Mode Optional Fields
|
|
205
|
+
*
|
|
206
|
+
* Fields that are optional for payment mode creation.
|
|
207
|
+
*/
|
|
208
|
+
export type PaymentModeOptionalFields = "enabled" | "isDefault";
|
|
209
|
+
/**
|
|
210
|
+
* Payment Mode Search Fields
|
|
211
|
+
*
|
|
212
|
+
* Fields that can be used for searching payment modes.
|
|
213
|
+
*/
|
|
214
|
+
export type PaymentModeSearchFields = "label";
|
|
215
|
+
/**
|
|
216
|
+
* Payment Mode Sort Fields
|
|
217
|
+
*
|
|
218
|
+
* Fields that can be used for sorting payment mode lists.
|
|
219
|
+
*/
|
|
220
|
+
export type PaymentModeSortFields = "label" | "createdAt" | "enabled" | "isDefault";
|
|
221
|
+
/**
|
|
222
|
+
* Partial Payment Mode Update
|
|
223
|
+
*
|
|
224
|
+
* Type for partial payment mode updates (PATCH operations).
|
|
225
|
+
*/
|
|
226
|
+
export type PartialPaymentModeUpdate = Partial<Omit<PaymentModeTypeBE, "id" | "createdAt" | "updatedAt">>;
|
|
227
|
+
/**
|
|
228
|
+
* Payment Mode Form Data
|
|
229
|
+
*
|
|
230
|
+
* Type for payment mode form data (excludes backend-only fields).
|
|
231
|
+
*/
|
|
232
|
+
export type PaymentModeForm = Omit<PaymentModeTypeBE, "createdAt" | "updatedAt" | "preference" | "payments">;
|
|
233
|
+
/**
|
|
234
|
+
* Type guard to check if object is a valid PaymentModeTypeBE
|
|
235
|
+
*/
|
|
236
|
+
export declare const isPaymentModeTypeBE: (obj: unknown) => obj is PaymentModeTypeBE;
|
|
237
|
+
/**
|
|
238
|
+
* Type guard to check if string is a valid payment mode drawer type
|
|
239
|
+
*/
|
|
240
|
+
export declare const isPaymentModeDrawer: (value: string) => value is PAYMENT_MODE_DRAWER;
|
|
241
|
+
/**
|
|
242
|
+
* Type guard to check if string is a valid payment type
|
|
243
|
+
*/
|
|
244
|
+
export declare const isPaymentType: (value: string) => value is PAYMENT_TYPE;
|
|
245
|
+
/**
|
|
246
|
+
* Type guard to check if object has valid payment mode filter structure
|
|
247
|
+
*/
|
|
248
|
+
export declare const isFetchPaymentModesArgs: (obj: unknown) => obj is FetchPaymentModesArgs;
|
|
249
|
+
/**
|
|
250
|
+
* Check if payment mode is enabled
|
|
251
|
+
*/
|
|
252
|
+
export declare const isPaymentModeEnabled: (paymentMode: PaymentModeTypeBE) => boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Check if payment mode is default
|
|
255
|
+
*/
|
|
256
|
+
export declare const isPaymentModeDefault: (paymentMode: PaymentModeTypeBE) => boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Get payment mode display label
|
|
259
|
+
*/
|
|
260
|
+
export declare const getPaymentModeDisplayLabel: (paymentMode: PaymentModeTypeBE) => string;
|
|
261
|
+
/**
|
|
262
|
+
* Check if payment mode has payments associated
|
|
263
|
+
*/
|
|
264
|
+
export declare const hasPayments: (paymentMode: PaymentModeTypeBE) => boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Legacy Banking Detail Type
|
|
267
|
+
* TODO: Move to banking-details module
|
|
268
|
+
*/
|
|
46
269
|
export interface BankingDetailTypeBE {
|
|
47
270
|
accountNumber: string;
|
|
48
271
|
accountTitle: string;
|
|
@@ -58,6 +281,10 @@ export interface BankingDetailTypeBE {
|
|
|
58
281
|
swiftCode?: string;
|
|
59
282
|
updatedAt: string;
|
|
60
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Legacy Branch Type
|
|
286
|
+
* TODO: Move to branches module
|
|
287
|
+
*/
|
|
61
288
|
export interface BranchTypeBE {
|
|
62
289
|
branchAddress: string;
|
|
63
290
|
branchName: string;
|
|
@@ -72,6 +299,10 @@ export interface BranchTypeBE {
|
|
|
72
299
|
preferenceId: string;
|
|
73
300
|
updatedAt: string;
|
|
74
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Legacy Currency Type
|
|
304
|
+
* TODO: Move to currencies module
|
|
305
|
+
*/
|
|
75
306
|
export interface CurrencyTypeBE {
|
|
76
307
|
code: string;
|
|
77
308
|
createdAt: string;
|
|
@@ -83,6 +314,10 @@ export interface CurrencyTypeBE {
|
|
|
83
314
|
preferenceId: string;
|
|
84
315
|
updatedAt: string;
|
|
85
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Legacy Menu Order Type
|
|
319
|
+
* TODO: Move to preferences module
|
|
320
|
+
*/
|
|
86
321
|
export interface MenuOrderTypeBE {
|
|
87
322
|
createdAt: string;
|
|
88
323
|
id: string;
|
|
@@ -92,38 +327,10 @@ export interface MenuOrderTypeBE {
|
|
|
92
327
|
preferenceId: string;
|
|
93
328
|
updatedAt: string;
|
|
94
329
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export interface PaymentTypeBE {
|
|
100
|
-
amount: string;
|
|
101
|
-
attachment?: string;
|
|
102
|
-
balance: string;
|
|
103
|
-
createdAt: string;
|
|
104
|
-
currency: string;
|
|
105
|
-
date: string;
|
|
106
|
-
description?: string;
|
|
107
|
-
id: string;
|
|
108
|
-
paymentMode?: PaymentModeTypeBE;
|
|
109
|
-
paymentModeId: string;
|
|
110
|
-
paymentType: PAYMENT_TYPE;
|
|
111
|
-
quoteInvoice?: undefined;
|
|
112
|
-
quoteInvoiceId: string;
|
|
113
|
-
ref: string;
|
|
114
|
-
updatedAt: string;
|
|
115
|
-
}
|
|
116
|
-
export interface PaymentModeTypeBE {
|
|
117
|
-
createdAt: string;
|
|
118
|
-
enabled: boolean;
|
|
119
|
-
id: string;
|
|
120
|
-
isDefault: boolean;
|
|
121
|
-
label: string;
|
|
122
|
-
payments?: PaymentTypeBE[];
|
|
123
|
-
preference?: PreferenceTypeBE;
|
|
124
|
-
preferenceId: string;
|
|
125
|
-
updatedAt: string;
|
|
126
|
-
}
|
|
330
|
+
/**
|
|
331
|
+
* Legacy Tax Type
|
|
332
|
+
* TODO: Move to taxes module
|
|
333
|
+
*/
|
|
127
334
|
export interface TaxTypeBE {
|
|
128
335
|
createdAt: string;
|
|
129
336
|
description?: string;
|
|
@@ -136,39 +343,52 @@ export interface TaxTypeBE {
|
|
|
136
343
|
taxRate: string;
|
|
137
344
|
updatedAt: string;
|
|
138
345
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
346
|
+
/**
|
|
347
|
+
* Legacy Tax Interface
|
|
348
|
+
* TODO: Move to taxes module
|
|
349
|
+
*/
|
|
350
|
+
export interface Tax {
|
|
351
|
+
taxName: string;
|
|
352
|
+
taxValue: string;
|
|
144
353
|
id: string;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
354
|
+
description: string;
|
|
355
|
+
preferenceId: string;
|
|
356
|
+
enabled: boolean;
|
|
357
|
+
errors: {
|
|
358
|
+
[key: string]: string;
|
|
359
|
+
};
|
|
360
|
+
createdAt?: string;
|
|
361
|
+
updatedAt?: string;
|
|
362
|
+
loading: boolean;
|
|
363
|
+
isDefault: boolean;
|
|
364
|
+
btnDisableTax: boolean;
|
|
150
365
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
handleNextClick: () => void;
|
|
161
|
-
handlePageLimit: (k: string, v: object) => void;
|
|
162
|
-
handlePreviousClick: () => void;
|
|
163
|
-
handleSubmit: () => void;
|
|
164
|
-
headerActions: VistaTableHeaderActionItem[];
|
|
165
|
-
listError?: Error;
|
|
166
|
-
listLoading: boolean;
|
|
167
|
-
rowActions: RowActionItem[];
|
|
168
|
-
searchOnChange: (k: string, v: string) => void;
|
|
169
|
-
updateError?: Error;
|
|
170
|
-
updateLoading: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Legacy Menu Item Interface
|
|
368
|
+
* TODO: Move to preferences module
|
|
369
|
+
*/
|
|
370
|
+
export interface MenuItem {
|
|
371
|
+
preferenceId: string;
|
|
372
|
+
label: string;
|
|
373
|
+
order: number;
|
|
374
|
+
id: string;
|
|
171
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Legacy Currency Args
|
|
378
|
+
* TODO: Move to currencies module
|
|
379
|
+
*/
|
|
380
|
+
export type CurrencyArgs = {
|
|
381
|
+
id: string;
|
|
382
|
+
label: string;
|
|
383
|
+
enabled: boolean;
|
|
384
|
+
code: string;
|
|
385
|
+
isDefault: boolean;
|
|
386
|
+
preferenceId: string;
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Legacy Create Bank Detail Args
|
|
390
|
+
* TODO: Move to banking-details module
|
|
391
|
+
*/
|
|
172
392
|
export interface CreateBankDetailArg {
|
|
173
393
|
id: string;
|
|
174
394
|
accountNumber: string;
|
|
@@ -185,6 +405,10 @@ export interface CreateBankDetailArg {
|
|
|
185
405
|
loading: boolean;
|
|
186
406
|
isDefault: boolean;
|
|
187
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Legacy Create Branches Args
|
|
410
|
+
* TODO: Move to branches module
|
|
411
|
+
*/
|
|
188
412
|
export interface createBranchesArgs {
|
|
189
413
|
personName: string;
|
|
190
414
|
personEmail: string;
|
|
@@ -202,6 +426,10 @@ export interface createBranchesArgs {
|
|
|
202
426
|
loading: boolean;
|
|
203
427
|
isDefault: boolean;
|
|
204
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Legacy Create Taxes Args
|
|
431
|
+
* TODO: Move to taxes module
|
|
432
|
+
*/
|
|
205
433
|
export interface createTaxesArgs {
|
|
206
434
|
taxName: string;
|
|
207
435
|
taxValue: string;
|
|
@@ -217,24 +445,10 @@ export interface createTaxesArgs {
|
|
|
217
445
|
loading: boolean;
|
|
218
446
|
isDefault: boolean;
|
|
219
447
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
export interface MenuItem {
|
|
225
|
-
preferenceId: string;
|
|
226
|
-
label: string;
|
|
227
|
-
order: number;
|
|
228
|
-
id: string;
|
|
229
|
-
}
|
|
230
|
-
export type CurrencyArgs = {
|
|
231
|
-
id: string;
|
|
232
|
-
label: string;
|
|
233
|
-
enabled: boolean;
|
|
234
|
-
code: string;
|
|
235
|
-
isDefault: boolean;
|
|
236
|
-
preferenceId: string;
|
|
237
|
-
};
|
|
448
|
+
/**
|
|
449
|
+
* Legacy Update Currency Args
|
|
450
|
+
* TODO: Move to currencies module
|
|
451
|
+
*/
|
|
238
452
|
export interface updateCurrencyArgs {
|
|
239
453
|
id: string;
|
|
240
454
|
label: string;
|
|
@@ -243,9 +457,10 @@ export interface updateCurrencyArgs {
|
|
|
243
457
|
isDefault: boolean;
|
|
244
458
|
preferenceId: string;
|
|
245
459
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Legacy Branch Modal Enum
|
|
462
|
+
* TODO: Move to branches module
|
|
463
|
+
*/
|
|
249
464
|
export declare enum BRANCH_MODAL {
|
|
250
465
|
DUMMY = "DUMMY"
|
|
251
466
|
}
|
|
@@ -1,22 +1,173 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Payment Mode Module Types
|
|
4
|
+
*
|
|
5
|
+
* This module defines all TypeScript interfaces, types, and enums for the Payment Mode feature.
|
|
6
|
+
* Provides type safety and clear contracts for all payment mode-related operations.
|
|
7
|
+
*
|
|
8
|
+
* Type Categories:
|
|
9
|
+
* - Context Types (React context and state management)
|
|
10
|
+
* - Entity Types (Backend data structures)
|
|
11
|
+
* - State Types (Frontend component state)
|
|
12
|
+
* - API Types (Request/response interfaces)
|
|
13
|
+
* - UI Types (Drawer and component enums)
|
|
14
|
+
* - Utility Types (Helper and computed types)
|
|
15
|
+
*
|
|
16
|
+
* Advanced Features:
|
|
17
|
+
* - Payment mode management
|
|
18
|
+
* - CRUD operations support
|
|
19
|
+
* - Enhanced search and pagination
|
|
20
|
+
*
|
|
21
|
+
* Naming Conventions:
|
|
22
|
+
* - Interfaces: PascalCase with descriptive suffixes (Type, State, Args)
|
|
23
|
+
* - Enums: UPPER_SNAKE_CASE for values, PascalCase for enum names
|
|
24
|
+
* - Types: PascalCase following interface conventions
|
|
25
|
+
*/
|
|
2
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BRANCH_MODAL = exports.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
27
|
+
exports.BRANCH_MODAL = exports.hasPayments = exports.getPaymentModeDisplayLabel = exports.isPaymentModeDefault = exports.isPaymentModeEnabled = exports.isFetchPaymentModesArgs = exports.isPaymentType = exports.isPaymentModeDrawer = exports.isPaymentModeTypeBE = exports.PAYMENT_TYPE = exports.PAYMENT_MODE_DRAWER = void 0;
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// UI ENUMS (Component State Definitions)
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Payment Mode Drawer Types
|
|
33
|
+
*
|
|
34
|
+
* Enumeration of all available drawer states for payment mode UI.
|
|
35
|
+
*/
|
|
36
|
+
var PAYMENT_MODE_DRAWER;
|
|
37
|
+
(function (PAYMENT_MODE_DRAWER) {
|
|
38
|
+
PAYMENT_MODE_DRAWER["FORM_DRAWER"] = "FORM_DRAWER";
|
|
39
|
+
})(PAYMENT_MODE_DRAWER || (exports.PAYMENT_MODE_DRAWER = PAYMENT_MODE_DRAWER = {}));
|
|
40
|
+
/**
|
|
41
|
+
* Payment Types
|
|
42
|
+
*
|
|
43
|
+
* Enumeration of payment type classifications.
|
|
44
|
+
*/
|
|
10
45
|
var PAYMENT_TYPE;
|
|
11
46
|
(function (PAYMENT_TYPE) {
|
|
12
47
|
PAYMENT_TYPE["FULL_PAYMENT"] = "FULL_PAYMENT";
|
|
13
48
|
PAYMENT_TYPE["PARTIAL_PAYMENT"] = "PARTIAL_PAYMENT";
|
|
14
49
|
})(PAYMENT_TYPE || (exports.PAYMENT_TYPE = PAYMENT_TYPE = {}));
|
|
15
|
-
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// TYPE GUARDS (Runtime Type Checking)
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Type guard to check if object is a valid PaymentModeTypeBE
|
|
55
|
+
*/
|
|
56
|
+
var isPaymentModeTypeBE = function (obj) {
|
|
57
|
+
return (typeof obj === "object" &&
|
|
58
|
+
obj !== null &&
|
|
59
|
+
"id" in obj &&
|
|
60
|
+
"label" in obj &&
|
|
61
|
+
typeof obj.enabled === "boolean" &&
|
|
62
|
+
typeof obj.isDefault === "boolean");
|
|
63
|
+
};
|
|
64
|
+
exports.isPaymentModeTypeBE = isPaymentModeTypeBE;
|
|
65
|
+
/**
|
|
66
|
+
* Type guard to check if string is a valid payment mode drawer type
|
|
67
|
+
*/
|
|
68
|
+
var isPaymentModeDrawer = function (value) {
|
|
69
|
+
return Object.values(PAYMENT_MODE_DRAWER).includes(value);
|
|
70
|
+
};
|
|
71
|
+
exports.isPaymentModeDrawer = isPaymentModeDrawer;
|
|
72
|
+
/**
|
|
73
|
+
* Type guard to check if string is a valid payment type
|
|
74
|
+
*/
|
|
75
|
+
var isPaymentType = function (value) {
|
|
76
|
+
return Object.values(PAYMENT_TYPE).includes(value);
|
|
77
|
+
};
|
|
78
|
+
exports.isPaymentType = isPaymentType;
|
|
79
|
+
/**
|
|
80
|
+
* Type guard to check if object has valid payment mode filter structure
|
|
81
|
+
*/
|
|
82
|
+
var isFetchPaymentModesArgs = function (obj) {
|
|
83
|
+
return (typeof obj === "object" &&
|
|
84
|
+
obj !== null &&
|
|
85
|
+
typeof obj.currentPage === "number" &&
|
|
86
|
+
typeof obj.pageLimit === "number");
|
|
87
|
+
};
|
|
88
|
+
exports.isFetchPaymentModesArgs = isFetchPaymentModesArgs;
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// UTILITY FUNCTIONS (Type Helpers)
|
|
91
|
+
// ============================================================================
|
|
92
|
+
/**
|
|
93
|
+
* Check if payment mode is enabled
|
|
94
|
+
*/
|
|
95
|
+
var isPaymentModeEnabled = function (paymentMode) {
|
|
96
|
+
return paymentMode.enabled;
|
|
97
|
+
};
|
|
98
|
+
exports.isPaymentModeEnabled = isPaymentModeEnabled;
|
|
99
|
+
/**
|
|
100
|
+
* Check if payment mode is default
|
|
101
|
+
*/
|
|
102
|
+
var isPaymentModeDefault = function (paymentMode) {
|
|
103
|
+
return paymentMode.isDefault;
|
|
104
|
+
};
|
|
105
|
+
exports.isPaymentModeDefault = isPaymentModeDefault;
|
|
106
|
+
/**
|
|
107
|
+
* Get payment mode display label
|
|
108
|
+
*/
|
|
109
|
+
var getPaymentModeDisplayLabel = function (paymentMode) {
|
|
110
|
+
return paymentMode.label;
|
|
111
|
+
};
|
|
112
|
+
exports.getPaymentModeDisplayLabel = getPaymentModeDisplayLabel;
|
|
113
|
+
/**
|
|
114
|
+
* Check if payment mode has payments associated
|
|
115
|
+
*/
|
|
116
|
+
var hasPayments = function (paymentMode) {
|
|
117
|
+
return Boolean(paymentMode.payments && paymentMode.payments.length > 0);
|
|
118
|
+
};
|
|
119
|
+
exports.hasPayments = hasPayments;
|
|
120
|
+
/**
|
|
121
|
+
* Legacy Branch Modal Enum
|
|
122
|
+
* TODO: Move to branches module
|
|
123
|
+
*/
|
|
19
124
|
var BRANCH_MODAL;
|
|
20
125
|
(function (BRANCH_MODAL) {
|
|
21
126
|
BRANCH_MODAL["DUMMY"] = "DUMMY";
|
|
22
127
|
})(BRANCH_MODAL || (exports.BRANCH_MODAL = BRANCH_MODAL = {}));
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// OPTIMIZATION SUMMARY
|
|
130
|
+
// ============================================================================
|
|
131
|
+
/*
|
|
132
|
+
* Payment Mode Types File Optimizations Applied:
|
|
133
|
+
*
|
|
134
|
+
* 1. **Comprehensive Documentation**
|
|
135
|
+
* - Added detailed JSDoc comments for all interfaces and types
|
|
136
|
+
* - Organized types into logical categories with clear section headers
|
|
137
|
+
* - Explained purpose and usage for each type definition
|
|
138
|
+
*
|
|
139
|
+
* 2. **Enhanced Type Safety**
|
|
140
|
+
* - Added utility types for common operations (form fields, required fields, etc.)
|
|
141
|
+
* - Implemented runtime type guards for validation
|
|
142
|
+
* - Used more specific Record<string, string> for errors
|
|
143
|
+
* - Added comprehensive API response types for better backend integration
|
|
144
|
+
*
|
|
145
|
+
* 3. **Improved Organization**
|
|
146
|
+
* - Grouped related types into logical sections (Context, Entity, State, API, UI, Utility)
|
|
147
|
+
* - Separated payment mode specific types from legacy types
|
|
148
|
+
* - Consistent naming conventions throughout
|
|
149
|
+
* - Clear separation between entity, state, and utility types
|
|
150
|
+
*
|
|
151
|
+
* 4. **Developer Experience**
|
|
152
|
+
* - Utility types for common development tasks
|
|
153
|
+
* - Type guards for runtime validation
|
|
154
|
+
* - Helper functions for payment mode manipulation
|
|
155
|
+
* - Comprehensive interfaces with clear field descriptions
|
|
156
|
+
* - Better IDE support through detailed type definitions
|
|
157
|
+
*
|
|
158
|
+
* 5. **Legacy Type Management**
|
|
159
|
+
* - Moved unrelated types to legacy section with TODO comments
|
|
160
|
+
* - Clear migration path for future refactoring
|
|
161
|
+
* - Maintained backward compatibility while organizing properly
|
|
162
|
+
*
|
|
163
|
+
* 6. **Payment Mode-Specific Enhancements**
|
|
164
|
+
* - Payment mode utility functions (isPaymentModeEnabled, hasPayments, etc.)
|
|
165
|
+
* - Comprehensive API types for all operations
|
|
166
|
+
* - Enhanced form and state type definitions
|
|
167
|
+
*
|
|
168
|
+
* 7. **Maintainability**
|
|
169
|
+
* - Modular type structure for easy extension
|
|
170
|
+
* - Clear relationships between different type categories
|
|
171
|
+
* - Self-documenting code with comprehensive comments
|
|
172
|
+
* - Consistent patterns for future type additions
|
|
173
|
+
*/
|