@appcorp/stellar-solutions-modules 0.1.56 → 0.1.59
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/constants.d.ts +2 -2
- package/global-modules/bank/constants.js +11 -11
- package/global-modules/bank/drawer.js +1 -1
- package/global-modules/bank/types.d.ts +2 -22
- package/global-modules/branch/constants.d.ts +2 -2
- package/global-modules/branch/constants.js +11 -11
- 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/constants.d.ts +2 -2
- package/global-modules/payment-mode/constants.js +7 -7
- 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 +27 -27
- package/global-modules/preferences/preferences.js +2 -3
- package/global-modules/preferences/types.d.ts +14 -240
- package/global-modules/preferences/types.js +3 -6
- package/global-modules/tax/constants.d.ts +2 -2
- package/global-modules/tax/constants.js +9 -9
- 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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Naming Convention: Descriptive names with clear purpose
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
16
16
|
/**
|
|
17
17
|
* Default page limit for pagination
|
|
18
18
|
*/
|
|
@@ -29,7 +29,7 @@ export declare const BANK_API_ROUTES: {
|
|
|
29
29
|
* Table column definitions for bank listing
|
|
30
30
|
*/
|
|
31
31
|
export declare const tableBodyCols: {
|
|
32
|
-
componentType:
|
|
32
|
+
componentType: COMPONENT_TYPE;
|
|
33
33
|
key: string;
|
|
34
34
|
}[];
|
|
35
35
|
/**
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.toastErrors = exports.tableBodyCols = exports.BANK_API_ROUTES = exports.pageLimit = void 0;
|
|
18
|
-
var
|
|
18
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// PAGE CONFIGURATION
|
|
21
21
|
// ============================================================================
|
|
@@ -42,43 +42,43 @@ exports.BANK_API_ROUTES = {
|
|
|
42
42
|
*/
|
|
43
43
|
exports.tableBodyCols = [
|
|
44
44
|
{
|
|
45
|
-
componentType:
|
|
45
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ID,
|
|
46
46
|
key: "id",
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
componentType:
|
|
49
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOLD_TEXT,
|
|
50
50
|
key: "bankName",
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
componentType:
|
|
53
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
54
54
|
key: "bankAddress",
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
componentType:
|
|
57
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
58
58
|
key: "accountTitle",
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
componentType:
|
|
61
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
62
62
|
key: "accountNumber",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
componentType:
|
|
65
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
66
66
|
key: "iban",
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
componentType:
|
|
69
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
70
70
|
key: "swiftCode",
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
componentType:
|
|
73
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
|
|
74
74
|
key: "enabled",
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
componentType:
|
|
77
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
|
|
78
78
|
key: "isDefault",
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
componentType:
|
|
81
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ACTIONS,
|
|
82
82
|
key: "action",
|
|
83
83
|
},
|
|
84
84
|
];
|
|
@@ -61,7 +61,7 @@ var BankDrawer = function (_a) {
|
|
|
61
61
|
return (react_1.default.createElement(drawer_1.Drawer, { open: isDrawerOpen, onOpenChange: function (open) { return !open && closeDrawer(); }, direction: drawerDirection },
|
|
62
62
|
react_1.default.createElement(drawer_1.DrawerContent, { className: "h-full ".concat(DRAWER_WIDTH, " ").concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
63
63
|
react_1.default.createElement(drawer_1.DrawerHeader, { className: "flex-row items-center justify-between border-b pb-4 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
64
|
-
react_1.default.createElement(drawer_1.DrawerTitle, { className: "text-xl font-semibold flex items-center ".concat(isRTL ? "flex-row-reverse gap-2" : "gap-2") }, t("
|
|
64
|
+
react_1.default.createElement(drawer_1.DrawerTitle, { className: "text-xl font-semibold flex items-center ".concat(isRTL ? "flex-row-reverse gap-2" : "gap-2") }, t("drawerTitleBank")),
|
|
65
65
|
react_1.default.createElement(drawer_1.DrawerClose, { asChild: true },
|
|
66
66
|
react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "h-8 w-8" },
|
|
67
67
|
react_1.default.createElement(lucide_react_1.X, { className: "h-4 w-4" }),
|
|
@@ -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
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Naming Convention: Descriptive names with clear purpose
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
16
16
|
/**
|
|
17
17
|
* Default page limit for pagination
|
|
18
18
|
*/
|
|
@@ -29,6 +29,6 @@ export declare const BRANCH_API_ROUTES: {
|
|
|
29
29
|
* Table column definitions for branch listing
|
|
30
30
|
*/
|
|
31
31
|
export declare const tableBodyCols: {
|
|
32
|
-
componentType:
|
|
32
|
+
componentType: COMPONENT_TYPE;
|
|
33
33
|
key: string;
|
|
34
34
|
}[];
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.tableBodyCols = exports.BRANCH_API_ROUTES = exports.pageLimit = void 0;
|
|
18
|
-
var
|
|
18
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// PAGE CONFIGURATION
|
|
21
21
|
// ============================================================================
|
|
@@ -42,43 +42,43 @@ exports.BRANCH_API_ROUTES = {
|
|
|
42
42
|
*/
|
|
43
43
|
exports.tableBodyCols = [
|
|
44
44
|
{
|
|
45
|
-
componentType:
|
|
45
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ID,
|
|
46
46
|
key: "id",
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
componentType:
|
|
49
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOLD_TEXT,
|
|
50
50
|
key: "branchName",
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
componentType:
|
|
53
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
54
54
|
key: "branchAddress",
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
componentType:
|
|
57
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
58
58
|
key: "personName",
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
componentType:
|
|
61
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
62
62
|
key: "personPhone",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
componentType:
|
|
65
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
66
66
|
key: "personEmail",
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
componentType:
|
|
69
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
|
|
70
70
|
key: "enabled",
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
componentType:
|
|
73
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
|
|
74
74
|
key: "isDefault",
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
componentType:
|
|
77
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.CREATED_UPDATED_AT,
|
|
78
78
|
key: "createdAt",
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
componentType:
|
|
81
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ACTIONS,
|
|
82
82
|
key: "action",
|
|
83
83
|
},
|
|
84
84
|
];
|
|
@@ -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;
|