@appcorp/stellar-solutions-modules 0.1.56 → 0.1.58
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/global-modules/bank/types.d.ts +2 -22
- package/global-modules/branch/types.d.ts +9 -106
- package/global-modules/currency/actions.d.ts +203 -0
- package/global-modules/currency/actions.js +153 -0
- package/global-modules/currency/constants.d.ts +33 -0
- package/global-modules/currency/constants.js +71 -0
- package/global-modules/currency/context.d.ts +41 -0
- package/global-modules/currency/context.js +422 -0
- package/global-modules/currency/currency.d.ts +8 -0
- package/global-modules/currency/currency.js +57 -0
- package/global-modules/currency/drawer.d.ts +27 -0
- package/global-modules/currency/drawer.js +76 -0
- package/global-modules/currency/form.d.ts +19 -0
- package/global-modules/currency/form.js +52 -0
- package/global-modules/currency/reducer.d.ts +25 -0
- package/global-modules/currency/reducer.js +153 -0
- package/global-modules/currency/types.d.ts +163 -0
- package/global-modules/currency/types.js +44 -0
- package/global-modules/currency/validate.d.ts +9 -0
- package/global-modules/currency/validate.js +18 -0
- package/global-modules/payment-mode/types.d.ts +12 -223
- package/global-modules/payment-mode/types.js +1 -9
- package/global-modules/preferences/context.js +2 -1
- package/global-modules/preferences/types.d.ts +14 -240
- package/global-modules/preferences/types.js +3 -6
- package/global-modules/tax/context.js +3 -2
- package/global-modules/tax/types.d.ts +9 -254
- package/global-modules/tax/types.js +1 -9
- package/i18n/routing.d.ts +1 -1
- package/package.json +2 -2
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { Dispatch } from "react";
|
|
26
26
|
import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
27
27
|
import { BankActions } from "./actions";
|
|
28
|
-
import {
|
|
28
|
+
import { BankBE as BankTypeBE } from "@react-pakistan/util-functions/api/stellar-solutions/type";
|
|
29
29
|
/**
|
|
30
30
|
* Bank Context Interface
|
|
31
31
|
*
|
|
@@ -53,27 +53,7 @@ export interface BankContextType {
|
|
|
53
53
|
headerActions: HeaderAction[];
|
|
54
54
|
rowActions: RowAction[];
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
* Bank Backend Entity
|
|
58
|
-
*
|
|
59
|
-
* Represents the complete bank data structure as received from the API.
|
|
60
|
-
* Includes all bank-specific fields and account details.
|
|
61
|
-
*/
|
|
62
|
-
export interface BankTypeBE {
|
|
63
|
-
accountNumber: string;
|
|
64
|
-
accountTitle: string;
|
|
65
|
-
bankAddress?: string;
|
|
66
|
-
bankName: string;
|
|
67
|
-
createdAt: string;
|
|
68
|
-
enabled: boolean;
|
|
69
|
-
iban?: string;
|
|
70
|
-
id: string;
|
|
71
|
-
isDefault: boolean;
|
|
72
|
-
swiftCode?: string;
|
|
73
|
-
updatedAt: string;
|
|
74
|
-
preference: PreferenceTypeBE;
|
|
75
|
-
preferenceId: string;
|
|
76
|
-
}
|
|
56
|
+
export type { BankTypeBE };
|
|
77
57
|
/**
|
|
78
58
|
* Bank Component State
|
|
79
59
|
*
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import { Dispatch } from "react";
|
|
26
26
|
import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
27
27
|
import { BranchActions } from "./actions";
|
|
28
|
+
import { BankBE as BankTypeBE, BranchBE as BranchTypeBE, CurrencyBE as CurrencyTypeBE, MenuOrderBE as MenuOrderTypeBE, PaymentBE as PaymentTypeBE, PaymentModeBE as PaymentModeTypeBE, PreferenceBE as PreferenceTypeBE, TaxBE as TaxTypeBE } from "@react-pakistan/util-functions/api/stellar-solutions/type";
|
|
28
29
|
/**
|
|
29
30
|
* Branch Context Interface
|
|
30
31
|
*
|
|
@@ -52,46 +53,14 @@ export interface BranchContextType {
|
|
|
52
53
|
headerActions: HeaderAction[];
|
|
53
54
|
rowActions: RowAction[];
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
* Banking Detail Backend Entity
|
|
57
|
-
*
|
|
58
|
-
* Represents banking detail data structure with branch relationship.
|
|
59
|
-
*/
|
|
60
|
-
export interface BankingDetailTypeBE {
|
|
61
|
-
accountNumber: string;
|
|
62
|
-
accountTitle: string;
|
|
63
|
-
bankAddress?: string;
|
|
64
|
-
bankName: string;
|
|
65
|
-
createdAt: string;
|
|
66
|
-
enabled: boolean;
|
|
67
|
-
iban?: string;
|
|
68
|
-
id: string;
|
|
69
|
-
isDefault: boolean;
|
|
70
|
-
preference: PreferenceTypeBE;
|
|
71
|
-
preferenceId: string;
|
|
72
|
-
swiftCode?: string;
|
|
73
|
-
updatedAt: string;
|
|
74
|
-
}
|
|
56
|
+
export type { BankTypeBE };
|
|
75
57
|
/**
|
|
76
58
|
* Branch Backend Entity
|
|
77
59
|
*
|
|
78
60
|
* Represents the complete branch data structure as received from the API.
|
|
79
61
|
* Includes all branch-specific fields, contact person details, and relationships.
|
|
80
62
|
*/
|
|
81
|
-
export
|
|
82
|
-
branchAddress: string;
|
|
83
|
-
branchName: string;
|
|
84
|
-
createdAt: string;
|
|
85
|
-
enabled: boolean;
|
|
86
|
-
id: string;
|
|
87
|
-
isDefault: boolean;
|
|
88
|
-
personEmail: string;
|
|
89
|
-
personName: string;
|
|
90
|
-
personPhone: string;
|
|
91
|
-
preference: PreferenceTypeBE;
|
|
92
|
-
preferenceId: string;
|
|
93
|
-
updatedAt: string;
|
|
94
|
-
}
|
|
63
|
+
export type { BranchTypeBE };
|
|
95
64
|
/**
|
|
96
65
|
* Branch Component State
|
|
97
66
|
*
|
|
@@ -117,26 +86,8 @@ export interface BranchState {
|
|
|
117
86
|
personPhone: string;
|
|
118
87
|
preferenceId: string;
|
|
119
88
|
}
|
|
120
|
-
export
|
|
121
|
-
|
|
122
|
-
createdAt: string;
|
|
123
|
-
enabled: boolean;
|
|
124
|
-
id: string;
|
|
125
|
-
isDefault: boolean;
|
|
126
|
-
label: string;
|
|
127
|
-
preference?: PreferenceTypeBE;
|
|
128
|
-
preferenceId: string;
|
|
129
|
-
updatedAt: string;
|
|
130
|
-
}
|
|
131
|
-
export interface MenuOrderTypeBE {
|
|
132
|
-
createdAt: string;
|
|
133
|
-
id: string;
|
|
134
|
-
label: string;
|
|
135
|
-
order: number;
|
|
136
|
-
preference: PreferenceTypeBE;
|
|
137
|
-
preferenceId: string;
|
|
138
|
-
updatedAt: string;
|
|
139
|
-
}
|
|
89
|
+
export type { CurrencyTypeBE };
|
|
90
|
+
export type { MenuOrderTypeBE };
|
|
140
91
|
/**
|
|
141
92
|
* Fetch Branches API Arguments
|
|
142
93
|
*
|
|
@@ -193,58 +144,10 @@ export declare enum PAYMENT_TYPE {
|
|
|
193
144
|
FULL_PAYMENT = "FULL_PAYMENT",
|
|
194
145
|
PARTIAL_PAYMENT = "PARTIAL_PAYMENT"
|
|
195
146
|
}
|
|
196
|
-
export
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
createdAt: string;
|
|
201
|
-
currency: string;
|
|
202
|
-
date: string;
|
|
203
|
-
description?: string;
|
|
204
|
-
id: string;
|
|
205
|
-
paymentMode?: PaymentModeTypeBE;
|
|
206
|
-
paymentModeId: string;
|
|
207
|
-
paymentType: PAYMENT_TYPE;
|
|
208
|
-
quoteInvoice?: undefined;
|
|
209
|
-
quoteInvoiceId: string;
|
|
210
|
-
ref: string;
|
|
211
|
-
updatedAt: string;
|
|
212
|
-
}
|
|
213
|
-
export interface PaymentModeTypeBE {
|
|
214
|
-
createdAt: string;
|
|
215
|
-
enabled: boolean;
|
|
216
|
-
id: string;
|
|
217
|
-
isDefault: boolean;
|
|
218
|
-
label: string;
|
|
219
|
-
payments?: PaymentTypeBE[];
|
|
220
|
-
preference?: PreferenceTypeBE;
|
|
221
|
-
preferenceId: string;
|
|
222
|
-
updatedAt: string;
|
|
223
|
-
}
|
|
224
|
-
export interface TaxTypeBE {
|
|
225
|
-
createdAt: string;
|
|
226
|
-
description?: string;
|
|
227
|
-
enabled: boolean;
|
|
228
|
-
id: string;
|
|
229
|
-
isDefault: boolean;
|
|
230
|
-
preference: PreferenceTypeBE;
|
|
231
|
-
preferenceId: string;
|
|
232
|
-
taxName: string;
|
|
233
|
-
taxRate: string;
|
|
234
|
-
updatedAt: string;
|
|
235
|
-
}
|
|
236
|
-
export interface PreferenceTypeBE {
|
|
237
|
-
bankingDetails: BankingDetailTypeBE[];
|
|
238
|
-
branches: BranchTypeBE[];
|
|
239
|
-
createdAt: string;
|
|
240
|
-
currencies: CurrencyTypeBE[];
|
|
241
|
-
id: string;
|
|
242
|
-
menuOrder: MenuOrderTypeBE[];
|
|
243
|
-
onboarding: boolean;
|
|
244
|
-
paymentModes: PaymentModeTypeBE[];
|
|
245
|
-
taxes: TaxTypeBE[];
|
|
246
|
-
updatedAt: string;
|
|
247
|
-
}
|
|
147
|
+
export type { PaymentTypeBE };
|
|
148
|
+
export type { PaymentModeTypeBE };
|
|
149
|
+
export type { TaxTypeBE };
|
|
150
|
+
export type { PreferenceTypeBE };
|
|
248
151
|
export interface CreateBankDetailArg {
|
|
249
152
|
id: string;
|
|
250
153
|
accountNumber: string;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency Actions
|
|
3
|
+
*
|
|
4
|
+
* This module defines all action types and interfaces for the Currency state management.
|
|
5
|
+
* Actions are organized by functionality and follow consistent naming patterns.
|
|
6
|
+
*
|
|
7
|
+
* Organization:
|
|
8
|
+
* - Action Types Enum (grouped by functionality)
|
|
9
|
+
* - Reset Actions (form/error reset)
|
|
10
|
+
* - Form Data Actions (input fields, form state)
|
|
11
|
+
* - UI State Actions (drawers, buttons)
|
|
12
|
+
* - List Management Actions (currencies, pagination)
|
|
13
|
+
* - Search Actions (queries)
|
|
14
|
+
* - Union Type Export
|
|
15
|
+
* - Action Creators (helper functions)
|
|
16
|
+
* - Type Utilities (guards and helpers)
|
|
17
|
+
*
|
|
18
|
+
* Naming Convention: Currency{Operation}{Target}Action
|
|
19
|
+
* Examples: CurrencySetInputFieldAction, CurrencyResetFormAction
|
|
20
|
+
*/
|
|
21
|
+
import { CURRENCY_DRAWER, CurrencyForm, CurrencyTypeBE } from "./types";
|
|
22
|
+
export declare enum CURRENCY_ACTION_TYPES {
|
|
23
|
+
RESET_ERRORS = "RESET_ERRORS",
|
|
24
|
+
RESET_FORM = "RESET_FORM",
|
|
25
|
+
SET_INPUT_FIELD = "SET_INPUT_FIELD",
|
|
26
|
+
SET_FORM = "SET_FORM",
|
|
27
|
+
SET_ERRORS = "SET_ERRORS",
|
|
28
|
+
SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
|
|
29
|
+
SET_DRAWER = "SET_DRAWER",
|
|
30
|
+
SET_CURRENCIES = "SET_CURRENCIES",
|
|
31
|
+
SET_COUNT = "SET_COUNT",
|
|
32
|
+
SET_CURRENT_PAGE = "SET_CURRENT_PAGE",
|
|
33
|
+
SET_PAGE_LIMIT = "SET_PAGE_LIMIT",
|
|
34
|
+
SET_SEARCH_QUERY = "SET_SEARCH_QUERY"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reset form validation errors
|
|
38
|
+
*/
|
|
39
|
+
export type CurrencyResetErrorsAction = {
|
|
40
|
+
type: CURRENCY_ACTION_TYPES.RESET_ERRORS;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Reset entire form to initial state
|
|
44
|
+
*/
|
|
45
|
+
export type CurrencyResetFormAction = {
|
|
46
|
+
type: CURRENCY_ACTION_TYPES.RESET_FORM;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Update individual form field dynamically
|
|
50
|
+
*/
|
|
51
|
+
export type CurrencySetInputFieldAction = {
|
|
52
|
+
type: CURRENCY_ACTION_TYPES.SET_INPUT_FIELD;
|
|
53
|
+
payload: {
|
|
54
|
+
key: keyof CurrencyForm;
|
|
55
|
+
value: string | string[] | boolean | number | number[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Set entire form data (used when editing existing currency)
|
|
60
|
+
*/
|
|
61
|
+
export type CurrencySetFormAction = {
|
|
62
|
+
type: CURRENCY_ACTION_TYPES.SET_FORM;
|
|
63
|
+
payload: {
|
|
64
|
+
form: CurrencyTypeBE;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Set form validation errors
|
|
69
|
+
*/
|
|
70
|
+
export type CurrencySetErrorsAction = {
|
|
71
|
+
type: CURRENCY_ACTION_TYPES.SET_ERRORS;
|
|
72
|
+
payload: {
|
|
73
|
+
errors: Record<string, string>;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Control save button state (enabled/disabled)
|
|
78
|
+
*/
|
|
79
|
+
export type CurrencySetDisableSaveButtonAction = {
|
|
80
|
+
type: CURRENCY_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON;
|
|
81
|
+
payload: {
|
|
82
|
+
disableSaveButton: boolean;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Manage drawer state (open/closed with specific drawer type)
|
|
87
|
+
*/
|
|
88
|
+
export type CurrencySetDrawerAction = {
|
|
89
|
+
type: CURRENCY_ACTION_TYPES.SET_DRAWER;
|
|
90
|
+
payload: {
|
|
91
|
+
drawer: null | CURRENCY_DRAWER;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Set currencies list data
|
|
96
|
+
*/
|
|
97
|
+
export type CurrencySetCurrenciesAction = {
|
|
98
|
+
type: CURRENCY_ACTION_TYPES.SET_CURRENCIES;
|
|
99
|
+
payload: {
|
|
100
|
+
currencies: CurrencyTypeBE[];
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Set total count of currencies (for pagination)
|
|
105
|
+
*/
|
|
106
|
+
export type CurrencySetCountAction = {
|
|
107
|
+
type: CURRENCY_ACTION_TYPES.SET_COUNT;
|
|
108
|
+
payload: {
|
|
109
|
+
count: number;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Update current page number
|
|
114
|
+
*/
|
|
115
|
+
export type CurrencySetCurrentPageAction = {
|
|
116
|
+
type: CURRENCY_ACTION_TYPES.SET_CURRENT_PAGE;
|
|
117
|
+
payload: {
|
|
118
|
+
currentPage: number;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Update page limit (items per page)
|
|
123
|
+
*/
|
|
124
|
+
export type CurrencySetPageLimitAction = {
|
|
125
|
+
type: CURRENCY_ACTION_TYPES.SET_PAGE_LIMIT;
|
|
126
|
+
payload: {
|
|
127
|
+
pageLimit: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Update search query for filtering currencies
|
|
132
|
+
*/
|
|
133
|
+
export type CurrencySetSearchQueryAction = {
|
|
134
|
+
type: CURRENCY_ACTION_TYPES.SET_SEARCH_QUERY;
|
|
135
|
+
payload: {
|
|
136
|
+
searchQuery: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Currency Actions Union Type
|
|
141
|
+
*
|
|
142
|
+
* Combines all possible currency actions into a single discriminated union.
|
|
143
|
+
* Used by the reducer to maintain type safety across all action handlers.
|
|
144
|
+
*/
|
|
145
|
+
export type CurrencyActions = CurrencyResetErrorsAction | CurrencyResetFormAction | CurrencySetInputFieldAction | CurrencySetFormAction | CurrencySetErrorsAction | CurrencySetDisableSaveButtonAction | CurrencySetDrawerAction | CurrencySetCurrenciesAction | CurrencySetCountAction | CurrencySetCurrentPageAction | CurrencySetPageLimitAction | CurrencySetSearchQueryAction;
|
|
146
|
+
/**
|
|
147
|
+
* Create a reset errors action
|
|
148
|
+
*/
|
|
149
|
+
export declare const createResetErrorsAction: () => CurrencyResetErrorsAction;
|
|
150
|
+
/**
|
|
151
|
+
* Create a reset form action
|
|
152
|
+
*/
|
|
153
|
+
export declare const createResetFormAction: () => CurrencyResetFormAction;
|
|
154
|
+
/**
|
|
155
|
+
* Create a set input field action
|
|
156
|
+
*/
|
|
157
|
+
export declare const createSetInputFieldAction: (key: keyof CurrencyForm, value: string | string[] | boolean | number | number[]) => CurrencySetInputFieldAction;
|
|
158
|
+
/**
|
|
159
|
+
* Create a set form action
|
|
160
|
+
*/
|
|
161
|
+
export declare const createSetFormAction: (form: CurrencyTypeBE) => CurrencySetFormAction;
|
|
162
|
+
/**
|
|
163
|
+
* Create a set errors action
|
|
164
|
+
*/
|
|
165
|
+
export declare const createSetErrorsAction: (errors: Record<string, string>) => CurrencySetErrorsAction;
|
|
166
|
+
/**
|
|
167
|
+
* Create a set disable save button action
|
|
168
|
+
*/
|
|
169
|
+
export declare const createSetDisableSaveButtonAction: (disableSaveButton: boolean) => CurrencySetDisableSaveButtonAction;
|
|
170
|
+
/**
|
|
171
|
+
* Create a set drawer action
|
|
172
|
+
*/
|
|
173
|
+
export declare const createSetDrawerAction: (drawer: null | CURRENCY_DRAWER) => CurrencySetDrawerAction;
|
|
174
|
+
/**
|
|
175
|
+
* Create a set currencies action
|
|
176
|
+
*/
|
|
177
|
+
export declare const createSetCurrenciesAction: (currencies: CurrencyTypeBE[]) => CurrencySetCurrenciesAction;
|
|
178
|
+
/**
|
|
179
|
+
* Create a set count action
|
|
180
|
+
*/
|
|
181
|
+
export declare const createSetCountAction: (count: number) => CurrencySetCountAction;
|
|
182
|
+
/**
|
|
183
|
+
* Create a set current page action
|
|
184
|
+
*/
|
|
185
|
+
export declare const createSetCurrentPageAction: (currentPage: number) => CurrencySetCurrentPageAction;
|
|
186
|
+
/**
|
|
187
|
+
* Create a set page limit action
|
|
188
|
+
*/
|
|
189
|
+
export declare const createSetPageLimitAction: (pageLimit: number) => CurrencySetPageLimitAction;
|
|
190
|
+
/**
|
|
191
|
+
* Create a set search query action
|
|
192
|
+
*/
|
|
193
|
+
export declare const createSetSearchQueryAction: (searchQuery: string) => CurrencySetSearchQueryAction;
|
|
194
|
+
/**
|
|
195
|
+
* Type guard to check if an action is a Currency action
|
|
196
|
+
*/
|
|
197
|
+
export declare const isCurrencyAction: (action: unknown) => action is CurrencyActions;
|
|
198
|
+
/**
|
|
199
|
+
* Helper to extract action payload type
|
|
200
|
+
*/
|
|
201
|
+
export type CurrencyActionPayload<T extends CurrencyActions> = T extends {
|
|
202
|
+
payload: infer P;
|
|
203
|
+
} ? P : never;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Currency Actions
|
|
4
|
+
*
|
|
5
|
+
* This module defines all action types and interfaces for the Currency state management.
|
|
6
|
+
* Actions are organized by functionality and follow consistent naming patterns.
|
|
7
|
+
*
|
|
8
|
+
* Organization:
|
|
9
|
+
* - Action Types Enum (grouped by functionality)
|
|
10
|
+
* - Reset Actions (form/error reset)
|
|
11
|
+
* - Form Data Actions (input fields, form state)
|
|
12
|
+
* - UI State Actions (drawers, buttons)
|
|
13
|
+
* - List Management Actions (currencies, pagination)
|
|
14
|
+
* - Search Actions (queries)
|
|
15
|
+
* - Union Type Export
|
|
16
|
+
* - Action Creators (helper functions)
|
|
17
|
+
* - Type Utilities (guards and helpers)
|
|
18
|
+
*
|
|
19
|
+
* Naming Convention: Currency{Operation}{Target}Action
|
|
20
|
+
* Examples: CurrencySetInputFieldAction, CurrencyResetFormAction
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.isCurrencyAction = exports.createSetSearchQueryAction = exports.createSetPageLimitAction = exports.createSetCurrentPageAction = exports.createSetCountAction = exports.createSetCurrenciesAction = exports.createSetDrawerAction = exports.createSetDisableSaveButtonAction = exports.createSetErrorsAction = exports.createSetFormAction = exports.createSetInputFieldAction = exports.createResetFormAction = exports.createResetErrorsAction = exports.CURRENCY_ACTION_TYPES = void 0;
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// ACTION TYPES ENUM
|
|
26
|
+
// ============================================================================
|
|
27
|
+
var CURRENCY_ACTION_TYPES;
|
|
28
|
+
(function (CURRENCY_ACTION_TYPES) {
|
|
29
|
+
// Reset Actions
|
|
30
|
+
CURRENCY_ACTION_TYPES["RESET_ERRORS"] = "RESET_ERRORS";
|
|
31
|
+
CURRENCY_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
|
|
32
|
+
// Form Data Actions
|
|
33
|
+
CURRENCY_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
|
|
34
|
+
CURRENCY_ACTION_TYPES["SET_FORM"] = "SET_FORM";
|
|
35
|
+
CURRENCY_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
|
|
36
|
+
// UI State Actions
|
|
37
|
+
CURRENCY_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
38
|
+
CURRENCY_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
|
|
39
|
+
// List Management Actions
|
|
40
|
+
CURRENCY_ACTION_TYPES["SET_CURRENCIES"] = "SET_CURRENCIES";
|
|
41
|
+
CURRENCY_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
|
|
42
|
+
CURRENCY_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
|
|
43
|
+
CURRENCY_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
|
|
44
|
+
// Search Actions
|
|
45
|
+
CURRENCY_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
|
|
46
|
+
})(CURRENCY_ACTION_TYPES || (exports.CURRENCY_ACTION_TYPES = CURRENCY_ACTION_TYPES = {}));
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// ACTION CREATORS (Helper Functions)
|
|
49
|
+
// ============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Create a reset errors action
|
|
52
|
+
*/
|
|
53
|
+
var createResetErrorsAction = function () { return ({
|
|
54
|
+
type: CURRENCY_ACTION_TYPES.RESET_ERRORS,
|
|
55
|
+
}); };
|
|
56
|
+
exports.createResetErrorsAction = createResetErrorsAction;
|
|
57
|
+
/**
|
|
58
|
+
* Create a reset form action
|
|
59
|
+
*/
|
|
60
|
+
var createResetFormAction = function () { return ({
|
|
61
|
+
type: CURRENCY_ACTION_TYPES.RESET_FORM,
|
|
62
|
+
}); };
|
|
63
|
+
exports.createResetFormAction = createResetFormAction;
|
|
64
|
+
/**
|
|
65
|
+
* Create a set input field action
|
|
66
|
+
*/
|
|
67
|
+
var createSetInputFieldAction = function (key, value) { return ({
|
|
68
|
+
type: CURRENCY_ACTION_TYPES.SET_INPUT_FIELD,
|
|
69
|
+
payload: { key: key, value: value },
|
|
70
|
+
}); };
|
|
71
|
+
exports.createSetInputFieldAction = createSetInputFieldAction;
|
|
72
|
+
/**
|
|
73
|
+
* Create a set form action
|
|
74
|
+
*/
|
|
75
|
+
var createSetFormAction = function (form) { return ({
|
|
76
|
+
type: CURRENCY_ACTION_TYPES.SET_FORM,
|
|
77
|
+
payload: { form: form },
|
|
78
|
+
}); };
|
|
79
|
+
exports.createSetFormAction = createSetFormAction;
|
|
80
|
+
/**
|
|
81
|
+
* Create a set errors action
|
|
82
|
+
*/
|
|
83
|
+
var createSetErrorsAction = function (errors) { return ({
|
|
84
|
+
type: CURRENCY_ACTION_TYPES.SET_ERRORS,
|
|
85
|
+
payload: { errors: errors },
|
|
86
|
+
}); };
|
|
87
|
+
exports.createSetErrorsAction = createSetErrorsAction;
|
|
88
|
+
/**
|
|
89
|
+
* Create a set disable save button action
|
|
90
|
+
*/
|
|
91
|
+
var createSetDisableSaveButtonAction = function (disableSaveButton) { return ({
|
|
92
|
+
type: CURRENCY_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
93
|
+
payload: { disableSaveButton: disableSaveButton },
|
|
94
|
+
}); };
|
|
95
|
+
exports.createSetDisableSaveButtonAction = createSetDisableSaveButtonAction;
|
|
96
|
+
/**
|
|
97
|
+
* Create a set drawer action
|
|
98
|
+
*/
|
|
99
|
+
var createSetDrawerAction = function (drawer) { return ({
|
|
100
|
+
type: CURRENCY_ACTION_TYPES.SET_DRAWER,
|
|
101
|
+
payload: { drawer: drawer },
|
|
102
|
+
}); };
|
|
103
|
+
exports.createSetDrawerAction = createSetDrawerAction;
|
|
104
|
+
/**
|
|
105
|
+
* Create a set currencies action
|
|
106
|
+
*/
|
|
107
|
+
var createSetCurrenciesAction = function (currencies) { return ({
|
|
108
|
+
type: CURRENCY_ACTION_TYPES.SET_CURRENCIES,
|
|
109
|
+
payload: { currencies: currencies },
|
|
110
|
+
}); };
|
|
111
|
+
exports.createSetCurrenciesAction = createSetCurrenciesAction;
|
|
112
|
+
/**
|
|
113
|
+
* Create a set count action
|
|
114
|
+
*/
|
|
115
|
+
var createSetCountAction = function (count) { return ({
|
|
116
|
+
type: CURRENCY_ACTION_TYPES.SET_COUNT,
|
|
117
|
+
payload: { count: count },
|
|
118
|
+
}); };
|
|
119
|
+
exports.createSetCountAction = createSetCountAction;
|
|
120
|
+
/**
|
|
121
|
+
* Create a set current page action
|
|
122
|
+
*/
|
|
123
|
+
var createSetCurrentPageAction = function (currentPage) { return ({
|
|
124
|
+
type: CURRENCY_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
125
|
+
payload: { currentPage: currentPage },
|
|
126
|
+
}); };
|
|
127
|
+
exports.createSetCurrentPageAction = createSetCurrentPageAction;
|
|
128
|
+
/**
|
|
129
|
+
* Create a set page limit action
|
|
130
|
+
*/
|
|
131
|
+
var createSetPageLimitAction = function (pageLimit) { return ({
|
|
132
|
+
type: CURRENCY_ACTION_TYPES.SET_PAGE_LIMIT,
|
|
133
|
+
payload: { pageLimit: pageLimit },
|
|
134
|
+
}); };
|
|
135
|
+
exports.createSetPageLimitAction = createSetPageLimitAction;
|
|
136
|
+
/**
|
|
137
|
+
* Create a set search query action
|
|
138
|
+
*/
|
|
139
|
+
var createSetSearchQueryAction = function (searchQuery) { return ({
|
|
140
|
+
type: CURRENCY_ACTION_TYPES.SET_SEARCH_QUERY,
|
|
141
|
+
payload: { searchQuery: searchQuery },
|
|
142
|
+
}); };
|
|
143
|
+
exports.createSetSearchQueryAction = createSetSearchQueryAction;
|
|
144
|
+
// ============================================================================
|
|
145
|
+
// TYPE UTILITIES (Guards and Helpers)
|
|
146
|
+
// ============================================================================
|
|
147
|
+
/**
|
|
148
|
+
* Type guard to check if an action is a Currency action
|
|
149
|
+
*/
|
|
150
|
+
var isCurrencyAction = function (action) {
|
|
151
|
+
return Object.values(CURRENCY_ACTION_TYPES).includes(action === null || action === void 0 ? void 0 : action.type);
|
|
152
|
+
};
|
|
153
|
+
exports.isCurrencyAction = isCurrencyAction;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency Constants
|
|
3
|
+
*
|
|
4
|
+
* This module defines all constants used throughout the Currency module.
|
|
5
|
+
* Constants are organized by functionality and follow consistent naming patterns.
|
|
6
|
+
*
|
|
7
|
+
* Organization:
|
|
8
|
+
* - Page Configuration (pagination, limits)
|
|
9
|
+
* - API Routes (backend endpoints)
|
|
10
|
+
* - Table Configuration (column definitions)
|
|
11
|
+
*
|
|
12
|
+
* Naming Convention: Descriptive names with clear purpose
|
|
13
|
+
*/
|
|
14
|
+
import { VISTA_TABLE_CELL_TYPE } from "@appcorp/app-corp-vista/type/vista-table-type";
|
|
15
|
+
/**
|
|
16
|
+
* Default page limit for pagination
|
|
17
|
+
*/
|
|
18
|
+
export declare const pageLimit: number;
|
|
19
|
+
/**
|
|
20
|
+
* API endpoints for currency operations
|
|
21
|
+
*/
|
|
22
|
+
export declare const CURRENCY_API_ROUTES: {
|
|
23
|
+
readonly CURRENCIES: "/api/currencies";
|
|
24
|
+
readonly CURRENCY: "/api/currency";
|
|
25
|
+
readonly CURRENCY_BY_ID: "/api/currency/currency-by-id";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Table column definitions for currency listing
|
|
29
|
+
*/
|
|
30
|
+
export declare const tableBodyCols: {
|
|
31
|
+
componentType: VISTA_TABLE_CELL_TYPE;
|
|
32
|
+
key: string;
|
|
33
|
+
}[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Currency Constants
|
|
4
|
+
*
|
|
5
|
+
* This module defines all constants used throughout the Currency module.
|
|
6
|
+
* Constants are organized by functionality and follow consistent naming patterns.
|
|
7
|
+
*
|
|
8
|
+
* Organization:
|
|
9
|
+
* - Page Configuration (pagination, limits)
|
|
10
|
+
* - API Routes (backend endpoints)
|
|
11
|
+
* - Table Configuration (column definitions)
|
|
12
|
+
*
|
|
13
|
+
* Naming Convention: Descriptive names with clear purpose
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.tableBodyCols = exports.CURRENCY_API_ROUTES = exports.pageLimit = void 0;
|
|
17
|
+
var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// PAGE CONFIGURATION
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* Default page limit for pagination
|
|
23
|
+
*/
|
|
24
|
+
exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// API ROUTES
|
|
27
|
+
// ============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* API endpoints for currency operations
|
|
30
|
+
*/
|
|
31
|
+
exports.CURRENCY_API_ROUTES = {
|
|
32
|
+
CURRENCIES: "/api/currencies",
|
|
33
|
+
CURRENCY: "/api/currency",
|
|
34
|
+
CURRENCY_BY_ID: "/api/currency/currency-by-id",
|
|
35
|
+
};
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// TABLE CONFIGURATION
|
|
38
|
+
// ============================================================================
|
|
39
|
+
/**
|
|
40
|
+
* Table column definitions for currency listing
|
|
41
|
+
*/
|
|
42
|
+
exports.tableBodyCols = [
|
|
43
|
+
{
|
|
44
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
|
|
45
|
+
key: "id",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
|
|
49
|
+
key: "label",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
|
|
53
|
+
key: "code",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
|
|
57
|
+
key: "enabled",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
|
|
61
|
+
key: "isDefault",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.CREATED_UPDATED_AT,
|
|
65
|
+
key: "createdAt",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
|
|
69
|
+
key: "action",
|
|
70
|
+
},
|
|
71
|
+
];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency State Context
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive state management for the Currency feature including:
|
|
5
|
+
* - CRUD operations (create, read, update, delete)
|
|
6
|
+
* - Form validation and error handling
|
|
7
|
+
* - Search and filtering functionality
|
|
8
|
+
* - Pagination controls
|
|
9
|
+
* - Internationalization support
|
|
10
|
+
* - Theme-aware toast notifications
|
|
11
|
+
*
|
|
12
|
+
* Organization:
|
|
13
|
+
* - Types & Interfaces
|
|
14
|
+
* - Main Hook (useCurrencyState)
|
|
15
|
+
* - State & Core Hooks
|
|
16
|
+
* - Debounced Values
|
|
17
|
+
* - API Parameters (memoized)
|
|
18
|
+
* - API Callbacks (with error handling)
|
|
19
|
+
* - Module Entity Hook
|
|
20
|
+
* - Effects (list refresh)
|
|
21
|
+
* - Drawer & Modal Handlers
|
|
22
|
+
* - CRUD Operation Handlers
|
|
23
|
+
* - Form Handlers
|
|
24
|
+
* - Pagination Handlers
|
|
25
|
+
* - Search Handlers
|
|
26
|
+
* - Table Actions (memoized)
|
|
27
|
+
* - Return State
|
|
28
|
+
* - Context Setup
|
|
29
|
+
* - Provider Component
|
|
30
|
+
* - Custom Hook
|
|
31
|
+
*/
|
|
32
|
+
import React, { FC, ReactNode } from "react";
|
|
33
|
+
import { CurrencyContextType, CurrencyState } from "./types";
|
|
34
|
+
type State = CurrencyContextType & CurrencyState;
|
|
35
|
+
interface StateProviderProps {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare const CurrencyStateContext: React.Context<State>;
|
|
39
|
+
export declare const CurrencyStateContextProvider: FC<StateProviderProps>;
|
|
40
|
+
export declare const useCurrencyStateContext: () => State;
|
|
41
|
+
export {};
|