@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.
Files changed (40) hide show
  1. package/global-modules/bank/constants.d.ts +2 -2
  2. package/global-modules/bank/constants.js +11 -11
  3. package/global-modules/bank/drawer.js +1 -1
  4. package/global-modules/bank/types.d.ts +2 -22
  5. package/global-modules/branch/constants.d.ts +2 -2
  6. package/global-modules/branch/constants.js +11 -11
  7. package/global-modules/branch/types.d.ts +9 -106
  8. package/global-modules/currency/actions.d.ts +203 -0
  9. package/global-modules/currency/actions.js +153 -0
  10. package/global-modules/currency/constants.d.ts +33 -0
  11. package/global-modules/currency/constants.js +71 -0
  12. package/global-modules/currency/context.d.ts +41 -0
  13. package/global-modules/currency/context.js +422 -0
  14. package/global-modules/currency/currency.d.ts +8 -0
  15. package/global-modules/currency/currency.js +57 -0
  16. package/global-modules/currency/drawer.d.ts +27 -0
  17. package/global-modules/currency/drawer.js +76 -0
  18. package/global-modules/currency/form.d.ts +19 -0
  19. package/global-modules/currency/form.js +52 -0
  20. package/global-modules/currency/reducer.d.ts +25 -0
  21. package/global-modules/currency/reducer.js +153 -0
  22. package/global-modules/currency/types.d.ts +163 -0
  23. package/global-modules/currency/types.js +44 -0
  24. package/global-modules/currency/validate.d.ts +9 -0
  25. package/global-modules/currency/validate.js +18 -0
  26. package/global-modules/payment-mode/constants.d.ts +2 -2
  27. package/global-modules/payment-mode/constants.js +7 -7
  28. package/global-modules/payment-mode/types.d.ts +12 -223
  29. package/global-modules/payment-mode/types.js +1 -9
  30. package/global-modules/preferences/context.js +27 -27
  31. package/global-modules/preferences/preferences.js +2 -3
  32. package/global-modules/preferences/types.d.ts +14 -240
  33. package/global-modules/preferences/types.js +3 -6
  34. package/global-modules/tax/constants.d.ts +2 -2
  35. package/global-modules/tax/constants.js +9 -9
  36. package/global-modules/tax/context.js +3 -2
  37. package/global-modules/tax/types.d.ts +9 -254
  38. package/global-modules/tax/types.js +1 -9
  39. package/i18n/routing.d.ts +1 -1
  40. package/package.json +2 -2
@@ -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 { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
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: COMPONENT_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 enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
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: enhanced_table_1.COMPONENT_TYPE.ID,
45
+ key: "id",
46
+ },
47
+ {
48
+ componentType: enhanced_table_1.COMPONENT_TYPE.BOLD_TEXT,
49
+ key: "label",
50
+ },
51
+ {
52
+ componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
53
+ key: "code",
54
+ },
55
+ {
56
+ componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
57
+ key: "enabled",
58
+ },
59
+ {
60
+ componentType: enhanced_table_1.COMPONENT_TYPE.BOOLEAN,
61
+ key: "isDefault",
62
+ },
63
+ {
64
+ componentType: enhanced_table_1.COMPONENT_TYPE.CREATED_UPDATED_AT,
65
+ key: "createdAt",
66
+ },
67
+ {
68
+ componentType: enhanced_table_1.COMPONENT_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 {};