@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.
Files changed (181) hide show
  1. package/README.md +128 -19
  2. package/components/theme-provider.d.ts +9 -0
  3. package/components/theme-provider.js +122 -0
  4. package/components/theme-switcher.d.ts +4 -0
  5. package/components/theme-switcher.js +60 -0
  6. package/components/ui/badge.d.ts +9 -0
  7. package/components/ui/badge.js +82 -0
  8. package/components/ui/button.d.ts +10 -0
  9. package/components/ui/button.js +91 -0
  10. package/components/ui/card.d.ts +9 -0
  11. package/components/ui/card.js +94 -0
  12. package/components/ui/checkbox.d.ts +9 -0
  13. package/components/ui/checkbox.js +87 -0
  14. package/components/ui/combobox.d.ts +70 -0
  15. package/components/ui/combobox.js +315 -0
  16. package/components/ui/command.d.ts +18 -0
  17. package/components/ui/command.js +115 -0
  18. package/components/ui/dialog.d.ts +15 -0
  19. package/components/ui/dialog.js +118 -0
  20. package/components/ui/drawer.d.ts +13 -0
  21. package/components/ui/drawer.js +115 -0
  22. package/components/ui/dropdown-menu.d.ts +25 -0
  23. package/components/ui/dropdown-menu.js +148 -0
  24. package/components/ui/enhanced-table-footer-action.d.ts +34 -0
  25. package/components/ui/enhanced-table-footer-action.js +117 -0
  26. package/components/ui/enhanced-table-footer-page.d.ts +32 -0
  27. package/components/ui/enhanced-table-footer-page.js +140 -0
  28. package/components/ui/enhanced-table-footer-pagination.d.ts +36 -0
  29. package/components/ui/enhanced-table-footer-pagination.js +122 -0
  30. package/components/ui/enhanced-table-header-action.d.ts +7 -0
  31. package/components/ui/enhanced-table-header-action.js +21 -0
  32. package/components/ui/enhanced-table-header-search.d.ts +12 -0
  33. package/components/ui/enhanced-table-header-search.js +17 -0
  34. package/components/ui/enhanced-table.d.ts +65 -0
  35. package/components/ui/enhanced-table.js +87 -0
  36. package/components/ui/form.d.ts +24 -0
  37. package/components/ui/form.js +125 -0
  38. package/components/ui/input.d.ts +8 -0
  39. package/components/ui/input.js +86 -0
  40. package/components/ui/label.d.ts +7 -0
  41. package/components/ui/label.js +68 -0
  42. package/components/ui/popover.d.ts +7 -0
  43. package/components/ui/popover.js +82 -0
  44. package/components/ui/select.d.ts +15 -0
  45. package/components/ui/select.js +127 -0
  46. package/components/ui/separator.d.ts +4 -0
  47. package/components/ui/separator.js +66 -0
  48. package/components/ui/sonner.d.ts +4 -0
  49. package/components/ui/sonner.js +54 -0
  50. package/components/ui/switch.d.ts +9 -0
  51. package/components/ui/switch.js +89 -0
  52. package/components/ui/table.d.ts +10 -0
  53. package/components/ui/table.js +101 -0
  54. package/components/ui/textarea.d.ts +8 -0
  55. package/components/ui/textarea.js +86 -0
  56. package/global-modules/bank/actions.d.ts +200 -0
  57. package/global-modules/bank/actions.js +124 -0
  58. package/global-modules/bank/bank.d.ts +2 -0
  59. package/global-modules/bank/bank.js +87 -0
  60. package/global-modules/bank/constants.d.ts +45 -0
  61. package/global-modules/bank/constants.js +98 -0
  62. package/global-modules/bank/context.d.ts +41 -0
  63. package/global-modules/bank/context.js +419 -0
  64. package/global-modules/bank/drawer.d.ts +31 -0
  65. package/global-modules/bank/drawer.js +114 -0
  66. package/global-modules/bank/form.d.ts +22 -0
  67. package/global-modules/bank/form.js +68 -0
  68. package/global-modules/bank/reducer.d.ts +25 -0
  69. package/global-modules/bank/reducer.js +161 -0
  70. package/global-modules/bank/types.d.ts +217 -0
  71. package/global-modules/bank/types.js +81 -0
  72. package/global-modules/bank/validate.d.ts +13 -0
  73. package/global-modules/bank/validate.js +22 -0
  74. package/global-modules/branch/actions.d.ts +154 -37
  75. package/global-modules/branch/actions.js +148 -6
  76. package/global-modules/branch/branch.d.ts +2 -2
  77. package/global-modules/branch/branch.js +46 -32
  78. package/global-modules/branch/constants.d.ts +34 -24
  79. package/global-modules/branch/constants.js +101 -122
  80. package/global-modules/branch/context.d.ts +33 -2
  81. package/global-modules/branch/context.js +195 -164
  82. package/global-modules/branch/drawer.d.ts +26 -3
  83. package/global-modules/branch/drawer.js +101 -6
  84. package/global-modules/branch/form.d.ts +15 -1
  85. package/global-modules/branch/form.js +54 -71
  86. package/global-modules/branch/reducer.d.ts +23 -2
  87. package/global-modules/branch/reducer.js +148 -118
  88. package/global-modules/branch/types.d.ts +196 -69
  89. package/global-modules/branch/types.js +66 -7
  90. package/global-modules/branch/validate.d.ts +1 -1
  91. package/global-modules/branch/validate.js +15 -11
  92. package/global-modules/payment-mode/actions.d.ts +154 -37
  93. package/global-modules/payment-mode/actions.js +148 -6
  94. package/global-modules/payment-mode/constants.d.ts +34 -17
  95. package/global-modules/payment-mode/constants.js +90 -66
  96. package/global-modules/payment-mode/context.d.ts +33 -2
  97. package/global-modules/payment-mode/context.js +185 -163
  98. package/global-modules/payment-mode/drawer.d.ts +26 -3
  99. package/global-modules/payment-mode/drawer.js +104 -9
  100. package/global-modules/payment-mode/form.d.ts +16 -2
  101. package/global-modules/payment-mode/form.js +45 -74
  102. package/global-modules/payment-mode/payment-mode.d.ts +25 -2
  103. package/global-modules/payment-mode/payment-mode.js +90 -23
  104. package/global-modules/payment-mode/reducer.d.ts +23 -2
  105. package/global-modules/payment-mode/reducer.js +140 -114
  106. package/global-modules/payment-mode/types.d.ts +327 -112
  107. package/global-modules/payment-mode/types.js +162 -11
  108. package/global-modules/payment-mode/validate.d.ts +1 -1
  109. package/global-modules/payment-mode/validate.js +7 -5
  110. package/global-modules/preferences/actions.d.ts +126 -27
  111. package/global-modules/preferences/actions.js +128 -4
  112. package/global-modules/preferences/constants.d.ts +46 -31
  113. package/global-modules/preferences/constants.js +129 -66
  114. package/global-modules/preferences/context.d.ts +2 -2
  115. package/global-modules/preferences/context.js +43 -43
  116. package/global-modules/preferences/currency.js +15 -10
  117. package/global-modules/preferences/preferences.d.ts +2 -2
  118. package/global-modules/preferences/preferences.js +3 -5
  119. package/global-modules/preferences/validate.d.ts +1 -1
  120. package/global-modules/preferences/validate.js +7 -7
  121. package/global-modules/tax/actions.d.ts +155 -38
  122. package/global-modules/tax/actions.js +149 -7
  123. package/global-modules/tax/constants.d.ts +31 -39
  124. package/global-modules/tax/constants.js +83 -114
  125. package/global-modules/tax/context.d.ts +33 -2
  126. package/global-modules/tax/context.js +146 -132
  127. package/global-modules/tax/drawer.d.ts +26 -3
  128. package/global-modules/tax/drawer.js +101 -6
  129. package/global-modules/tax/form.d.ts +20 -3
  130. package/global-modules/tax/form.js +101 -74
  131. package/global-modules/tax/reducer.d.ts +23 -2
  132. package/global-modules/tax/reducer.js +143 -24
  133. package/global-modules/tax/tax.d.ts +25 -2
  134. package/global-modules/tax/tax.js +92 -28
  135. package/global-modules/tax/types.d.ts +332 -102
  136. package/global-modules/tax/types.js +179 -11
  137. package/global-modules/tax/validate.d.ts +1 -1
  138. package/global-modules/tax/validate.js +9 -8
  139. package/hooks/use-rtl.d.ts +44 -0
  140. package/hooks/use-rtl.js +75 -0
  141. package/i18n/navigation.d.ts +340 -0
  142. package/i18n/navigation.js +9 -0
  143. package/i18n/request.d.ts +2 -0
  144. package/i18n/request.js +95 -0
  145. package/i18n/routing.d.ts +18 -0
  146. package/i18n/routing.js +9 -0
  147. package/index.d.ts +26 -0
  148. package/index.js +42 -0
  149. package/lib/themes.d.ts +147 -0
  150. package/lib/themes.js +150 -0
  151. package/lib/toast-utils.d.ts +44 -0
  152. package/lib/toast-utils.js +212 -0
  153. package/lib/utils.d.ts +2 -0
  154. package/lib/utils.js +12 -0
  155. package/package.json +21 -3
  156. package/supabase/supabase.d.ts +80 -1
  157. package/supabase/supabase.js +281 -6
  158. package/global-modules/branch/form-elements.d.ts +0 -3
  159. package/global-modules/branch/form-elements.js +0 -41
  160. package/global-modules/payment-mode/form-elements.d.ts +0 -3
  161. package/global-modules/payment-mode/form-elements.js +0 -41
  162. package/global-modules/preferences/bank.d.ts +0 -2
  163. package/global-modules/preferences/bank.js +0 -11
  164. package/global-modules/preferences/branch-drawer.js +0 -36
  165. package/global-modules/preferences/branch-form-elements.js +0 -30
  166. package/global-modules/preferences/branch-form.d.ts +0 -0
  167. package/global-modules/preferences/branch-form.js +0 -33
  168. package/global-modules/preferences/branch.d.ts +0 -0
  169. package/global-modules/preferences/branch.js +0 -106
  170. package/global-modules/preferences/payment-mode-drawer.d.ts +0 -0
  171. package/global-modules/preferences/payment-mode-drawer.js +0 -36
  172. package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -0
  173. package/global-modules/preferences/payment-mode-form-elements.js +0 -30
  174. package/global-modules/preferences/payment-mode-form.d.ts +0 -0
  175. package/global-modules/preferences/payment-mode-form.js +0 -33
  176. package/global-modules/preferences/payment-mode.d.ts +0 -0
  177. package/global-modules/preferences/payment-mode.js +0 -94
  178. package/global-modules/tax/form-elements.d.ts +0 -3
  179. package/global-modules/tax/form-elements.js +0 -41
  180. /package/{global-modules/preferences/branch-drawer.d.ts → constants.d.ts} +0 -0
  181. /package/{global-modules/preferences/branch-form-elements.d.ts → constants.js} +0 -0
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Bank Actions
3
+ *
4
+ * This module defines all action types and interfaces for the Bank 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 (banks, pagination)
13
+ * - Search Actions (queries)
14
+ * - Union Type Export
15
+ * - Action Creators (helper functions)
16
+ * - Type Utilities (guards and helpers)
17
+ *
18
+ * Naming Convention: Bank{Operation}{Target}Action
19
+ * Examples: BankSetInputFieldAction, BankResetFormAction
20
+ */
21
+ import { BANK_DRAWER, BankForm, BankTypeBE } from "./types";
22
+ export declare enum BANK_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_BANKS = "SET_BANKS",
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 BankResetErrorsAction = {
40
+ type: BANK_ACTION_TYPES.RESET_ERRORS;
41
+ };
42
+ /**
43
+ * Reset entire form to initial state
44
+ */
45
+ export type BankResetFormAction = {
46
+ type: BANK_ACTION_TYPES.RESET_FORM;
47
+ };
48
+ /**
49
+ * Update individual form field dynamically
50
+ */
51
+ export type BankSetInputFieldAction = {
52
+ type: BANK_ACTION_TYPES.SET_INPUT_FIELD;
53
+ payload: {
54
+ key: keyof BankForm;
55
+ value: string | string[] | boolean | number | number[];
56
+ };
57
+ };
58
+ /**
59
+ * Set entire form data (used when editing existing bank)
60
+ */
61
+ export type BankSetFormAction = {
62
+ type: BANK_ACTION_TYPES.SET_FORM;
63
+ payload: {
64
+ form: BankTypeBE;
65
+ };
66
+ };
67
+ /**
68
+ * Set form validation errors
69
+ */
70
+ export type BankSetErrorsAction = {
71
+ type: BANK_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 BankSetDisableSaveButtonAction = {
80
+ type: BANK_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 BankSetDrawerAction = {
89
+ type: BANK_ACTION_TYPES.SET_DRAWER;
90
+ payload: {
91
+ drawer: null | BANK_DRAWER;
92
+ };
93
+ };
94
+ /**
95
+ * Set banks list data
96
+ */
97
+ export type BankSetBanksAction = {
98
+ type: BANK_ACTION_TYPES.SET_BANKS;
99
+ payload: {
100
+ banks: BankTypeBE[];
101
+ };
102
+ };
103
+ /**
104
+ * Set total count of banks (for pagination)
105
+ */
106
+ export type BankSetCountAction = {
107
+ type: BANK_ACTION_TYPES.SET_COUNT;
108
+ payload: {
109
+ count: number;
110
+ };
111
+ };
112
+ /**
113
+ * Update current page number
114
+ */
115
+ export type BankSetCurrentPageAction = {
116
+ type: BANK_ACTION_TYPES.SET_CURRENT_PAGE;
117
+ payload: {
118
+ currentPage: number;
119
+ };
120
+ };
121
+ /**
122
+ * Update page limit (items per page)
123
+ */
124
+ export type BankSetPageLimitAction = {
125
+ type: BANK_ACTION_TYPES.SET_PAGE_LIMIT;
126
+ payload: {
127
+ pageLimit: number;
128
+ };
129
+ };
130
+ /**
131
+ * Update search query for banks
132
+ */
133
+ export type BankSetSearchQueryAction = {
134
+ type: BANK_ACTION_TYPES.SET_SEARCH_QUERY;
135
+ payload: {
136
+ searchQuery: string;
137
+ };
138
+ };
139
+ /**
140
+ * All bank-related actions grouped by functionality
141
+ */
142
+ export type BankActions = BankResetErrorsAction | BankResetFormAction | BankSetInputFieldAction | BankSetFormAction | BankSetErrorsAction | BankSetDisableSaveButtonAction | BankSetDrawerAction | BankSetBanksAction | BankSetCountAction | BankSetCurrentPageAction | BankSetPageLimitAction | BankSetSearchQueryAction;
143
+ /**
144
+ * Type guard for reset actions
145
+ */
146
+ export type BankResetActions = BankResetErrorsAction | BankResetFormAction;
147
+ /**
148
+ * Type guard for form-related actions
149
+ */
150
+ export type BankFormActions = BankSetInputFieldAction | BankSetFormAction | BankSetErrorsAction;
151
+ /**
152
+ * Type guard for UI state actions
153
+ */
154
+ export type BankUIActions = BankSetDisableSaveButtonAction | BankSetDrawerAction;
155
+ /**
156
+ * Type guard for list management actions
157
+ */
158
+ export type BankListActions = BankSetBanksAction | BankSetCountAction | BankSetCurrentPageAction | BankSetPageLimitAction;
159
+ /**
160
+ * Action creators for common bank operations
161
+ * These provide type-safe action creation with better developer experience
162
+ */
163
+ export declare const bankActionCreators: {
164
+ readonly resetErrors: () => BankResetErrorsAction;
165
+ readonly resetForm: () => BankResetFormAction;
166
+ readonly setInputField: (key: keyof BankForm, value: string | string[] | boolean | number | number[]) => BankSetInputFieldAction;
167
+ readonly setForm: (form: BankTypeBE) => BankSetFormAction;
168
+ readonly setErrors: (errors: Record<string, string>) => BankSetErrorsAction;
169
+ readonly setDisableSaveButton: (disableSaveButton: boolean) => BankSetDisableSaveButtonAction;
170
+ readonly setDrawer: (drawer: null | BANK_DRAWER) => BankSetDrawerAction;
171
+ readonly setBanks: (banks: BankTypeBE[]) => BankSetBanksAction;
172
+ readonly setCount: (count: number) => BankSetCountAction;
173
+ readonly setCurrentPage: (currentPage: number) => BankSetCurrentPageAction;
174
+ readonly setPageLimit: (pageLimit: number) => BankSetPageLimitAction;
175
+ readonly setSearchQuery: (searchQuery: string) => BankSetSearchQueryAction;
176
+ };
177
+ /**
178
+ * Extract action type from action object
179
+ */
180
+ export type ActionType<T extends BankActions> = T["type"];
181
+ /**
182
+ * Extract payload type from action object
183
+ */
184
+ export type ActionPayload<T extends BankActions> = T extends {
185
+ payload: infer P;
186
+ } ? P : never;
187
+ /**
188
+ * Utility type to check if action has payload
189
+ */
190
+ export type HasPayload<T extends BankActions> = T extends {
191
+ payload: unknown;
192
+ } ? true : false;
193
+ /**
194
+ * Runtime type guards for action validation
195
+ */
196
+ export declare const isBankAction: (action: unknown) => action is BankActions;
197
+ /**
198
+ * Type guard for reset actions
199
+ */
200
+ export declare const isResetAction: (action: BankActions) => action is BankResetActions;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Bank Actions
4
+ *
5
+ * This module defines all action types and interfaces for the Bank 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 (banks, pagination)
14
+ * - Search Actions (queries)
15
+ * - Union Type Export
16
+ * - Action Creators (helper functions)
17
+ * - Type Utilities (guards and helpers)
18
+ *
19
+ * Naming Convention: Bank{Operation}{Target}Action
20
+ * Examples: BankSetInputFieldAction, BankResetFormAction
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.isResetAction = exports.isBankAction = exports.bankActionCreators = exports.BANK_ACTION_TYPES = void 0;
24
+ // ============================================================================
25
+ // ACTION TYPES ENUM
26
+ // ============================================================================
27
+ var BANK_ACTION_TYPES;
28
+ (function (BANK_ACTION_TYPES) {
29
+ // Reset Actions
30
+ BANK_ACTION_TYPES["RESET_ERRORS"] = "RESET_ERRORS";
31
+ BANK_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
32
+ // Form Data Actions
33
+ BANK_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
34
+ BANK_ACTION_TYPES["SET_FORM"] = "SET_FORM";
35
+ BANK_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
36
+ // UI State Actions
37
+ BANK_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
38
+ BANK_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
39
+ // List Management Actions
40
+ BANK_ACTION_TYPES["SET_BANKS"] = "SET_BANKS";
41
+ BANK_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
42
+ BANK_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
43
+ BANK_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
44
+ // Search Actions
45
+ BANK_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
46
+ })(BANK_ACTION_TYPES || (exports.BANK_ACTION_TYPES = BANK_ACTION_TYPES = {}));
47
+ // ============================================================================
48
+ // ACTION CREATORS (Optional Helper Functions)
49
+ // ============================================================================
50
+ /**
51
+ * Action creators for common bank operations
52
+ * These provide type-safe action creation with better developer experience
53
+ */
54
+ exports.bankActionCreators = {
55
+ // Reset Actions
56
+ resetErrors: function () { return ({
57
+ type: BANK_ACTION_TYPES.RESET_ERRORS,
58
+ }); },
59
+ resetForm: function () { return ({
60
+ type: BANK_ACTION_TYPES.RESET_FORM,
61
+ }); },
62
+ // Form Actions
63
+ setInputField: function (key, value) { return ({
64
+ type: BANK_ACTION_TYPES.SET_INPUT_FIELD,
65
+ payload: { key: key, value: value },
66
+ }); },
67
+ setForm: function (form) { return ({
68
+ type: BANK_ACTION_TYPES.SET_FORM,
69
+ payload: { form: form },
70
+ }); },
71
+ setErrors: function (errors) { return ({
72
+ type: BANK_ACTION_TYPES.SET_ERRORS,
73
+ payload: { errors: errors },
74
+ }); },
75
+ // UI Actions
76
+ setDisableSaveButton: function (disableSaveButton) { return ({
77
+ type: BANK_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
78
+ payload: { disableSaveButton: disableSaveButton },
79
+ }); },
80
+ setDrawer: function (drawer) { return ({
81
+ type: BANK_ACTION_TYPES.SET_DRAWER,
82
+ payload: { drawer: drawer },
83
+ }); },
84
+ // List Actions
85
+ setBanks: function (banks) { return ({
86
+ type: BANK_ACTION_TYPES.SET_BANKS,
87
+ payload: { banks: banks },
88
+ }); },
89
+ setCount: function (count) { return ({
90
+ type: BANK_ACTION_TYPES.SET_COUNT,
91
+ payload: { count: count },
92
+ }); },
93
+ setCurrentPage: function (currentPage) { return ({
94
+ type: BANK_ACTION_TYPES.SET_CURRENT_PAGE,
95
+ payload: { currentPage: currentPage },
96
+ }); },
97
+ setPageLimit: function (pageLimit) { return ({
98
+ type: BANK_ACTION_TYPES.SET_PAGE_LIMIT,
99
+ payload: { pageLimit: pageLimit },
100
+ }); },
101
+ // Search Actions
102
+ setSearchQuery: function (searchQuery) { return ({
103
+ type: BANK_ACTION_TYPES.SET_SEARCH_QUERY,
104
+ payload: { searchQuery: searchQuery },
105
+ }); },
106
+ };
107
+ /**
108
+ * Runtime type guards for action validation
109
+ */
110
+ var isBankAction = function (action) {
111
+ return (typeof action === "object" &&
112
+ action !== null &&
113
+ "type" in action &&
114
+ Object.values(BANK_ACTION_TYPES).includes(action.type));
115
+ };
116
+ exports.isBankAction = isBankAction;
117
+ /**
118
+ * Type guard for reset actions
119
+ */
120
+ var isResetAction = function (action) {
121
+ return (action.type === BANK_ACTION_TYPES.RESET_ERRORS ||
122
+ action.type === BANK_ACTION_TYPES.RESET_FORM);
123
+ };
124
+ exports.isResetAction = isResetAction;
@@ -0,0 +1,2 @@
1
+ import { FC } from "react";
2
+ export declare const Bank: FC;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Bank = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var next_intl_1 = require("next-intl");
9
+ var util_functions_1 = require("@react-pakistan/util-functions");
10
+ var use_rtl_1 = require("@/hooks/use-rtl");
11
+ var enhanced_table_1 = require("@/components/ui/enhanced-table");
12
+ var sonner_1 = require("@/components/ui/sonner");
13
+ var theme_switcher_1 = require("@/components/theme-switcher");
14
+ var constants_1 = require("./constants");
15
+ var context_1 = require("./context");
16
+ var drawer_1 = require("./drawer");
17
+ var Bank = function () {
18
+ var _a = (0, context_1.useBankStateContext)(), banks = _a.banks, count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
19
+ var t = (0, next_intl_1.useTranslations)("bankPage");
20
+ var isRTL = (0, use_rtl_1.useRTL)();
21
+ var translationMap = {
22
+ formLabelBankName: t("formLabelBankName"),
23
+ formLabelBankAddress: t("formLabelBankAddress"),
24
+ formLabelAccountTitle: t("formLabelAccountTitle"),
25
+ formLabelAccountNumber: t("formLabelAccountNumber"),
26
+ formLabelIBAN: t("formLabelIBAN"),
27
+ formLabelSwiftCode: t("formLabelSwiftCode"),
28
+ headingFormCreate: t("headingFormCreate"),
29
+ srCloseDrawer: t("srCloseDrawer"),
30
+ cancelBtn: t("cancelBtn"),
31
+ saveBtn: t("saveBtn"),
32
+ enableDescription: t("enableDescription"),
33
+ setAsDefault: t("setAsDefault"),
34
+ defaultDescription: t("defaultDescription"),
35
+ };
36
+ var tableHeadItems = [
37
+ {
38
+ label: t("tableColumnHeaderId"),
39
+ width: "5%",
40
+ },
41
+ {
42
+ label: t("tableColumnHeaderBankName"),
43
+ width: "15%",
44
+ },
45
+ {
46
+ label: t("tableColumnHeaderBankAddress"),
47
+ width: "15%",
48
+ },
49
+ {
50
+ label: t("tableColumnHeaderAccountTitle"),
51
+ width: "15%",
52
+ },
53
+ {
54
+ label: t("tableColumnHeaderAccountNumber"),
55
+ width: "15%",
56
+ },
57
+ {
58
+ label: t("tableColumnHeaderIBAN"),
59
+ width: "10%",
60
+ },
61
+ {
62
+ label: t("tableColumnHeaderSwiftCode"),
63
+ width: "10%",
64
+ },
65
+ {
66
+ label: t("tableColumnHeaderEnabled"),
67
+ width: "5%",
68
+ },
69
+ {
70
+ label: t("tableColumnHeaderIsDefault"),
71
+ width: "5%",
72
+ },
73
+ {
74
+ label: t("tableColumnHeaderActions"),
75
+ width: "5%",
76
+ },
77
+ ];
78
+ var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
79
+ return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
80
+ react_1.default.createElement("div", { className: "flex items-center justify-between ".concat(isRTL ? "flex-row-reverse" : "") },
81
+ react_1.default.createElement("div", null),
82
+ react_1.default.createElement(theme_switcher_1.ThemeSwitcher, null)),
83
+ react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "bank-search", searchPlaceholder: t("tableHeaderSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: banks, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: Number(totalPages) }),
84
+ react_1.default.createElement(drawer_1.BankDrawer, { isRTL: isRTL, translationMap: translationMap }),
85
+ react_1.default.createElement(sonner_1.Toaster, null)));
86
+ };
87
+ exports.Bank = Bank;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Bank Constants
3
+ *
4
+ * This module defines all constants used throughout the Bank 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
+ * - Toast Messages (user feedback)
12
+ *
13
+ * Naming Convention: Descriptive names with clear purpose
14
+ */
15
+ import { VISTA_TABLE_CELL_TYPE } from "@appcorp/app-corp-vista/type/vista-table-type";
16
+ /**
17
+ * Default page limit for pagination
18
+ */
19
+ export declare const pageLimit: number;
20
+ /**
21
+ * API endpoints for bank operations
22
+ */
23
+ export declare const BANK_API_ROUTES: {
24
+ readonly BANK: "/api/bank";
25
+ readonly BANKS: "/api/banks";
26
+ readonly BANK_BY_ID: "/api/bank/bank-by-id";
27
+ };
28
+ /**
29
+ * Table column definitions for bank listing
30
+ */
31
+ export declare const tableBodyCols: {
32
+ componentType: VISTA_TABLE_CELL_TYPE;
33
+ key: string;
34
+ }[];
35
+ /**
36
+ * Toast error messages for user feedback
37
+ */
38
+ export declare const toastErrors: {
39
+ fetchInvoiceError: string;
40
+ formSubmittedSuccess: string;
41
+ genericError: string;
42
+ networkError: string;
43
+ submitFormError: string;
44
+ validationError: string;
45
+ };
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * Bank Constants
4
+ *
5
+ * This module defines all constants used throughout the Bank 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
+ * - Toast Messages (user feedback)
13
+ *
14
+ * Naming Convention: Descriptive names with clear purpose
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.toastErrors = exports.tableBodyCols = exports.BANK_API_ROUTES = exports.pageLimit = void 0;
18
+ var vista_table_type_1 = require("@appcorp/app-corp-vista/type/vista-table-type");
19
+ // ============================================================================
20
+ // PAGE CONFIGURATION
21
+ // ============================================================================
22
+ /**
23
+ * Default page limit for pagination
24
+ */
25
+ exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
26
+ // ============================================================================
27
+ // API ROUTES
28
+ // ============================================================================
29
+ /**
30
+ * API endpoints for bank operations
31
+ */
32
+ exports.BANK_API_ROUTES = {
33
+ BANK: "/api/bank",
34
+ BANKS: "/api/banks",
35
+ BANK_BY_ID: "/api/bank/bank-by-id",
36
+ };
37
+ // ============================================================================
38
+ // TABLE CONFIGURATION
39
+ // ============================================================================
40
+ /**
41
+ * Table column definitions for bank listing
42
+ */
43
+ exports.tableBodyCols = [
44
+ {
45
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ID,
46
+ key: "id",
47
+ },
48
+ {
49
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOLD_TEXT,
50
+ key: "bankName",
51
+ },
52
+ {
53
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
54
+ key: "accountNumber",
55
+ },
56
+ {
57
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
58
+ key: "accountTitle",
59
+ },
60
+ {
61
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
62
+ key: "iban",
63
+ },
64
+ {
65
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
66
+ key: "swiftCode",
67
+ },
68
+ {
69
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
70
+ key: "enabled",
71
+ },
72
+ {
73
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.BOOLEAN,
74
+ key: "isDefault",
75
+ },
76
+ {
77
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.TEXT,
78
+ key: "createdAt",
79
+ },
80
+ {
81
+ componentType: vista_table_type_1.VISTA_TABLE_CELL_TYPE.ACTIONS,
82
+ key: "action",
83
+ },
84
+ ];
85
+ // ============================================================================
86
+ // TOAST MESSAGES
87
+ // ============================================================================
88
+ /**
89
+ * Toast error messages for user feedback
90
+ */
91
+ exports.toastErrors = {
92
+ fetchInvoiceError: "Error Fetching Invoice",
93
+ formSubmittedSuccess: "Form Submitted Successfully",
94
+ genericError: "Something Went Wrong",
95
+ networkError: "Network Error Occurred",
96
+ submitFormError: "Error Submitting Form",
97
+ validationError: "Validation Failed",
98
+ };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Bank State Context
3
+ *
4
+ * This module provides comprehensive state management for the Bank 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 (useBankState)
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 { BankContextType, BankState } from "./types";
34
+ type State = BankContextType & BankState;
35
+ interface StateProviderProps {
36
+ children: ReactNode;
37
+ }
38
+ export declare const BankStateContext: React.Context<State>;
39
+ export declare const BankStateContextProvider: FC<StateProviderProps>;
40
+ export declare const useBankStateContext: () => State;
41
+ export {};