@adiba-banking-cloud/backoffice 0.0.106 → 0.2.1

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.
@@ -1,4 +1,4 @@
1
- export { A as ApplicationMenu, o as ApplicationPanel, k as AvatarLabelPanel, B as BasicHeatmap, C as CalendarHeatmap, n as ConnectionPanel, D as DonutChart, z as Drawer, e as DynamicLogo, f as DynamicShigaLogo, E as EqualizerColumn, u as ErrorModal, F as File, d as Icons, v as InfoModal, I as InterpolatedHeatmap, L as LabelPanel, H as MaskedTilePanel, M as MultiAxisArea, P as PageTitle, q as PaymentMethod, r as PaymentMethodAdd, j as SearchPanel, h as SideMenu, b as SimpleArea, S as SimpleColumn, G as SimpleForm, w as SimpleModal, i as SimplePanel, s as SimpleTable, l as SimpleText, c as StackedArea, a as StackedColumn, p as SubscriptionPlans, x as SuccessModal, J as TilePanel, m as TitleWithIndex, T as TitledPanel, y as TwoFactorModal, U as UserMenu, t as theme, N as useManagedModals, K as useModal } from './index-CWjYoFnK.js';
1
+ export { A as ApplicationMenu, o as ApplicationPanel, k as AvatarLabelPanel, B as BasicHeatmap, C as CalendarHeatmap, n as ConnectionPanel, V as DEFAULT_API_TIMEOUT, Q as DEFAULT_PAGE_SIZE, D as DonutChart, z as Drawer, e as DynamicLogo, f as DynamicShigaLogo, E as EqualizerColumn, u as ErrorModal, F as File, d as Icons, v as InfoModal, I as InterpolatedHeatmap, L as LabelPanel, R as MAX_PAGE_SIZE, H as MaskedTilePanel, Y as ModalContentWrapper, M as MultiAxisArea, P as PageTitle, q as PaymentMethod, r as PaymentMethodAdd, j as SearchPanel, h as SideMenu, b as SimpleArea, S as SimpleColumn, G as SimpleForm, w as SimpleModal, i as SimplePanel, s as SimpleTable, l as SimpleText, c as StackedArea, a as StackedColumn, p as SubscriptionPlans, x as SuccessModal, J as TilePanel, m as TitleWithIndex, T as TitledPanel, y as TwoFactorModal, U as UserMenu, X as apiClient, W as createApiClient, t as theme, N as useManagedModals, K as useModal, O as useUrlFilters, Z as withProviders } from './index-D7Cza3cb.js';
2
2
  import '@mantine/modals';
3
3
  import 'react';
4
4
  import '@mantine/core';
@@ -18,3 +18,8 @@ import '@fontsource/poppins/500.css';
18
18
  import '@fontsource/poppins/600.css';
19
19
  import '@fontsource/poppins/700.css';
20
20
  import '@fontsource/poppins/800.css';
21
+ import 'axios';
22
+ import '@mantine/dates';
23
+ import '@mantine/dates/styles.css';
24
+ import '@tanstack/react-query';
25
+ import '@tanstack/react-query-devtools';
@@ -1,3 +1,8 @@
1
1
  export * from "./components";
2
2
  export * from "./shared/hooks/modals/useModal";
3
3
  export * from "./shared/hooks/modals/useManagedModals";
4
+ export * from "./shared/hooks";
5
+ export * from "./shared/api";
6
+ export * from "./shared/components";
7
+ export * from "./shared/types";
8
+ export * from "./shared/hocs";
@@ -0,0 +1,24 @@
1
+ import { AxiosRequestConfig } from "axios";
2
+ import type { ApiResponse } from "./types";
3
+ export interface ApiClientConfig {
4
+ baseURL?: string;
5
+ timeout?: number;
6
+ headers?: Record<string, string>;
7
+ }
8
+ export interface IApiClient {
9
+ get<T>(url: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
10
+ post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
11
+ put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
12
+ delete<T>(url: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
13
+ }
14
+ /**
15
+ * Factory function to create a configured API client instance
16
+ * @param config - Configuration options for the API client
17
+ * @returns Configured ApiClient instance
18
+ */
19
+ export declare function createApiClient(config?: ApiClientConfig): IApiClient;
20
+ /**
21
+ * Default API client instance with default configuration
22
+ * For custom configuration, use createApiClient() instead
23
+ */
24
+ export declare const apiClient: IApiClient;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Default pagination page size
3
+ */
4
+ export declare const DEFAULT_PAGE_SIZE = 10;
5
+ /**
6
+ * Maximum allowed page size for pagination
7
+ */
8
+ export declare const MAX_PAGE_SIZE = 100;
9
+ /**
10
+ * Default API request timeout in milliseconds
11
+ */
12
+ export declare const DEFAULT_API_TIMEOUT = 30000;
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./constants";
3
+ export * from "./client";
@@ -0,0 +1,26 @@
1
+ export interface ApiResponse<T> {
2
+ status: "success" | "error";
3
+ code: number;
4
+ message: string;
5
+ data?: T;
6
+ total?: number;
7
+ page?: number;
8
+ limit?: number;
9
+ error?: string;
10
+ }
11
+ export interface ApiError {
12
+ status: "error";
13
+ code: number;
14
+ message: string;
15
+ error: string;
16
+ }
17
+ /**
18
+ * Paginated API response
19
+ * Combines ApiResponse structure with pagination metadata
20
+ */
21
+ export interface PaginatedApiResponse<T> extends Omit<ApiResponse<T[]>, "data" | "total" | "page" | "limit"> {
22
+ data: T[];
23
+ total: number;
24
+ page: number;
25
+ limit: number;
26
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import "@mantine/dates/styles.css";
3
+ /**
4
+ * Wrapper component for modal content to ensure MantineProvider context is available
5
+ * This is needed because modals rendered by the appshell may not have access to the pilet's provider
6
+ */
7
+ export declare const ModalContentWrapper: React.FC<{
8
+ children: React.ReactNode;
9
+ }>;
@@ -0,0 +1 @@
1
+ export * from "./ModalContentWrapper";
@@ -0,0 +1 @@
1
+ export * from "./withProviders";
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { theme } from "../../components/theme";
3
+ import { QueryClient } from "@tanstack/react-query";
4
+ import "@mantine/dates/styles.css";
5
+ export interface WithProvidersOptions {
6
+ /**
7
+ * Custom QueryClient instance (optional)
8
+ * If not provided, uses default configuration
9
+ */
10
+ queryClient?: QueryClient;
11
+ /**
12
+ * Whether to show React Query Devtools in development (default: true)
13
+ */
14
+ enableDevtools?: boolean;
15
+ /**
16
+ * Mantine theme override (optional)
17
+ */
18
+ theme?: typeof theme;
19
+ /**
20
+ * DatesProvider settings override (optional)
21
+ */
22
+ datesSettings?: {
23
+ locale: string;
24
+ timezone: string;
25
+ };
26
+ }
27
+ /**
28
+ * Higher-order component that wraps a component with all necessary providers:
29
+ * - QueryClientProvider (React Query)
30
+ * - MantineProvider (Mantine UI)
31
+ * - DatesProvider (Mantine Dates)
32
+ *
33
+ * @param Component - Component to wrap
34
+ * @param options - Optional configuration
35
+ * @returns Wrapped component with all providers
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * // Using default configuration
40
+ * const WrappedComponent = withProviders(MyComponent);
41
+ *
42
+ * // Using custom QueryClient
43
+ * const customQueryClient = new QueryClient({ ... });
44
+ * const WrappedComponent = withProviders(MyComponent, {
45
+ * queryClient: customQueryClient,
46
+ * });
47
+ * ```
48
+ */
49
+ export declare function withProviders<P extends object>(Component: React.ComponentType<P>, options?: WithProvidersOptions): React.ComponentType<P>;
@@ -0,0 +1 @@
1
+ export * from "./useUrlFilters";
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Configuration for URL filter hook
3
+ */
4
+ export interface UseUrlFiltersOptions<TFilters extends Record<string, any>> {
5
+ /**
6
+ * Default page size (defaults to DEFAULT_PAGE_SIZE from constants)
7
+ */
8
+ defaultPageSize?: number;
9
+ /**
10
+ * Function to parse filter values from URL search params
11
+ * @param searchParams - URLSearchParams object
12
+ * @returns Parsed filter object
13
+ */
14
+ parseFilters: (searchParams: URLSearchParams) => Partial<TFilters>;
15
+ /**
16
+ * Function to serialize filter values to URL search params
17
+ * @param filters - Filter object
18
+ * @param params - URLSearchParams object to update
19
+ */
20
+ serializeFilters: (filters: Partial<TFilters>, params: URLSearchParams) => void;
21
+ /**
22
+ * Function to check if any filters are active (excluding pagination)
23
+ * @param filters - Filter object
24
+ * @returns true if any filters are active
25
+ */
26
+ hasActiveFilters?: (filters: TFilters) => boolean;
27
+ /**
28
+ * Function to convert filters to API parameters
29
+ * @param filters - Filter object
30
+ * @returns API parameters object
31
+ */
32
+ toApiParams?: (filters: TFilters) => Record<string, any>;
33
+ }
34
+ /**
35
+ * Return type for useUrlFilters hook
36
+ */
37
+ export interface UseUrlFiltersReturn<TFilters extends Record<string, any>> {
38
+ /**
39
+ * Current filter values (includes page and limit)
40
+ */
41
+ filters: TFilters;
42
+ /**
43
+ * Update filters in URL
44
+ * @param newFilters - Partial filter object to update
45
+ */
46
+ updateFilters: (newFilters: Partial<TFilters>) => void;
47
+ /**
48
+ * Clear all filters (resets to default page and limit)
49
+ */
50
+ clearFilters: () => void;
51
+ /**
52
+ * Whether any filters are currently active (excluding pagination)
53
+ */
54
+ hasActiveFilters: boolean;
55
+ /**
56
+ * API parameters derived from filters (if toApiParams provided)
57
+ */
58
+ apiParams?: Record<string, any>;
59
+ }
60
+ /**
61
+ * Generic hook for managing URL-based filters with pagination
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * interface MyFilters {
66
+ * page: number;
67
+ * limit: number;
68
+ * name?: string;
69
+ * status?: string;
70
+ * }
71
+ *
72
+ * const { filters, updateFilters, clearFilters } = useUrlFilters<MyFilters>({
73
+ * parseFilters: (params) => ({
74
+ * page: parseInt(params.get('page') || '1', 10),
75
+ * limit: parseInt(params.get('limit') || '10', 10),
76
+ * name: params.get('name') || undefined,
77
+ * status: params.get('status') || undefined,
78
+ * }),
79
+ * serializeFilters: (filters, params) => {
80
+ * if (filters.page) params.set('page', String(filters.page));
81
+ * if (filters.limit) params.set('limit', String(filters.limit));
82
+ * if (filters.name) params.set('name', filters.name);
83
+ * if (filters.status) params.set('status', filters.status);
84
+ * },
85
+ * });
86
+ * ```
87
+ */
88
+ export declare function useUrlFilters<TFilters extends Record<string, any>>(options: UseUrlFiltersOptions<TFilters>): UseUrlFiltersReturn<TFilters>;
@@ -0,0 +1 @@
1
+ export * from "./pagination";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Standard pagination parameters for API requests
3
+ */
4
+ export interface PaginationParams {
5
+ page?: number;
6
+ limit?: number;
7
+ }
8
+ /**
9
+ * Standard paginated response structure
10
+ */
11
+ export interface PaginatedResponse<T> {
12
+ data: T[];
13
+ total: number;
14
+ page: number;
15
+ limit: number;
16
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adiba-banking-cloud/backoffice",
3
3
  "author": "TUROG Technologies",
4
- "version": "0.0.106",
4
+ "version": "0.2.1",
5
5
  "description": "An ADIBA component library for backoffice and dashboard applications",
6
6
  "license": "ISC",
7
7
  "main": "build/index.cjs.js",
@@ -32,21 +32,28 @@
32
32
  "@hello-pangea/dnd": "^16.5.0",
33
33
  "@lottiefiles/dotlottie-react": "^0.14.1",
34
34
  "@mantine/core": "^7.12.2",
35
+ "@mantine/dates": "^7.12.2",
35
36
  "@mantine/form": "^7.17.8",
36
37
  "@mantine/hooks": "^7.12.2",
37
38
  "@mantine/modals": "^7.17.8",
39
+ "axios": "^1.6.0",
38
40
  "highcharts-react-official": "^3.2.2",
39
41
  "highcharts-rounded-corners": "^1.0.7",
40
42
  "iconsax-react": "^0.0.8",
41
43
  "react": ">=18",
42
44
  "react-dom": ">=18",
43
- "react-router-dom": "^7.6.2"
45
+ "react-router-dom": "^7.6.2",
46
+ "@tanstack/react-query": "^5.0.0",
47
+ "@tanstack/react-query-devtools": "^5.0.0"
44
48
  },
45
49
  "repository": {
46
50
  "type": "git",
47
51
  "url": "git+https://github.com/turog-technologies/adiba-common-libraries.git"
48
52
  },
49
53
  "devDependencies": {
54
+ "@tanstack/react-query": "^5.0.0",
55
+ "@tanstack/react-query-devtools": "^5.0.0",
56
+ "axios": "^1.6.0",
50
57
  "@babel/core": "^7.21.3",
51
58
  "@babel/plugin-transform-runtime": "^7.21.0",
52
59
  "@babel/preset-env": "^7.20.2",
@@ -58,6 +65,7 @@
58
65
  "@hello-pangea/dnd": "^16.5.0",
59
66
  "@lottiefiles/dotlottie-react": "^0.14.1",
60
67
  "@mantine/core": "^7.12.2",
68
+ "@mantine/dates": "^7.12.2",
61
69
  "@mantine/form": "^7.17.8",
62
70
  "@mantine/hooks": "^7.12.2",
63
71
  "@mantine/modals": "^7.17.8",