finance-shared 0.0.9 → 0.0.10

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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
2
2
  import { ActionCreatorWithPayload } from '@reduxjs/toolkit';
3
3
  import { Breakpoint } from '@mui/material';
4
+ import { Context } from 'react';
4
5
  import { default as default_2 } from 'react';
5
6
  import { default as i18n } from 'i18next';
6
7
  import { JSX } from 'react/jsx-runtime';
@@ -9,6 +10,7 @@ import { MemoExoticComponent } from 'react';
9
10
  import { PayloadAction } from '@reduxjs/toolkit';
10
11
  import * as React_2 from 'react';
11
12
  import { ReactElement } from 'react';
13
+ import { ReactNode } from 'react';
12
14
  import { Slice } from '@reduxjs/toolkit';
13
15
  import { SliceSelectors } from '@reduxjs/toolkit';
14
16
  import { TextFieldProps } from '@mui/material';
@@ -244,6 +246,13 @@ export declare interface FinanceApplicationAutocompleteProps {
244
246
  }>>;
245
247
  }
246
248
 
249
+ export declare const FinanceSharedProvider: default_2.FC<FinanceSharedProviderProps>;
250
+
251
+ export declare interface FinanceSharedProviderProps {
252
+ children: ReactNode;
253
+ config: Partial<LibraryConfig>;
254
+ }
255
+
247
256
  export declare function formatAmount({ num, showCurrency }: FormatAmountProps): string;
248
257
 
249
258
  declare interface FormatAmountProps {
@@ -293,8 +302,6 @@ export declare const getActiveFinanceDetail: (state: any) => any;
293
302
 
294
303
  export declare const getApplicationDetailById: (id: string) => (dispatch: any) => Promise<any>;
295
304
 
296
- export declare const getConfig: () => SharedLibConfig;
297
-
298
305
  export declare const getDocumentSignJPDF: (state: any) => any;
299
306
 
300
307
  export declare const getDocumentSignJPDFLoading: (state: any) => any;
@@ -376,6 +383,15 @@ declare type initialStateProps = {
376
383
  };
377
384
  };
378
385
 
386
+ declare interface LibraryConfig {
387
+ apiUrl: string;
388
+ tokenConfig: TokenConfig;
389
+ }
390
+ export { LibraryConfig }
391
+ export { LibraryConfig as SharedLibConfig }
392
+
393
+ export declare const LibraryConfigContext: Context<LibraryConfig>;
394
+
379
395
  export declare interface MediaDialogProps {
380
396
  filePath?: string;
381
397
  isMobile?: boolean;
@@ -532,8 +548,6 @@ declare type SearchableAutocompleteProps = {
532
548
 
533
549
  export declare const setActiveFinanceDetail: ActionCreatorWithPayload<any, "dialogs/setActiveFinanceDetail">;
534
550
 
535
- export declare const setConfig: (c: SharedLibConfig) => void;
536
-
537
551
  export declare const setDocumentSignJPDF: ActionCreatorWithPayload<string, "dialogs/setDocumentSignJPDF">;
538
552
 
539
553
  export declare const setIsChangeDetectDialogOpen: (value: boolean) => (dispatch: any) => Promise<void>;
@@ -556,10 +570,6 @@ export declare const setRemarkList: ActionCreatorWithPayload<RemarkType_2[], "di
556
570
 
557
571
  export declare const setSelectedMediaFilePath: ActionCreatorWithPayload<string, "dialogs/setSelectedMediaFilePath">;
558
572
 
559
- export declare interface SharedLibConfig {
560
- apiUrl: string;
561
- }
562
-
563
573
  export declare const showMessage: ActionCreatorWithPayload<Partial<{
564
574
  variant: "success" | "error" | "warning" | "info";
565
575
  anchorOrigin: {
@@ -585,8 +595,22 @@ declare interface TenantAutocompleteProps {
585
595
  autoSelectFirst?: boolean;
586
596
  }
587
597
 
598
+ export declare interface TokenConfig {
599
+ accessToken: string;
600
+ refreshToken: string;
601
+ }
602
+
588
603
  export declare const updateRemark: (requestData: RemarkType_2) => (dispatch: any) => Promise<void>;
589
604
 
590
605
  export declare const updateUserStatus: (requestData: any, listApiFunc: () => void) => (dispatch: any) => Promise<void>;
591
606
 
607
+ /**
608
+ * Hook to access the library configuration within React components.
609
+ * Must be used within a FinanceSharedProvider.
610
+ *
611
+ * @example
612
+ * const { apiUrl, tokenConfig } = useLibraryConfig();
613
+ */
614
+ export declare const useLibraryConfig: () => LibraryConfig;
615
+
592
616
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finance-shared",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/"
@@ -43,7 +43,6 @@
43
43
  "@mui/base": "5.0.0-beta.9",
44
44
  "@mui/icons-material": "6.4.0",
45
45
  "@mui/material": "6.4.0",
46
- "@mui/styles": "5.15.6",
47
46
  "@mui/system": "6.4.0",
48
47
  "@mui/x-date-pickers": "6.10.2",
49
48
  "@reduxjs/toolkit": "^2.9.0",
@@ -73,7 +72,6 @@
73
72
  "@mui/base": "5.0.0-beta.9",
74
73
  "@mui/icons-material": "6.4.0",
75
74
  "@mui/material": "6.4.0",
76
- "@mui/styles": "5.15.6",
77
75
  "@mui/system": "6.4.0",
78
76
  "@mui/x-date-pickers": "6.10.2",
79
77
  "@reduxjs/toolkit": "^2.9.0",