@foris/avocado-not-front 1.4.7 → 1.5.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.
- package/dist/avocado-not-front.es.js +31252 -30684
- package/dist/avocado-not-front.umd.js +185 -185
- package/dist/services/axios/axiosInterceptors.d.ts +5 -0
- package/dist/services/axios/axiosServices.d.ts +5 -4
- package/dist/store/useStore.d.ts +8 -0
- package/dist/types/builder.type.d.ts +9 -1
- package/dist/utils/headers.util.d.ts +7 -0
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApiConfig } from '../../types/builder.type';
|
|
1
2
|
import type { AxiosCall } from './useFetchAndLoad';
|
|
2
3
|
export declare const loadAbort: () => AbortController;
|
|
3
4
|
/**
|
|
@@ -8,7 +9,7 @@ export declare const loadAbort: () => AbortController;
|
|
|
8
9
|
* @param abort
|
|
9
10
|
* @returns {call, controller }
|
|
10
11
|
*/
|
|
11
|
-
export declare const get: <T>(api: string, headers?:
|
|
12
|
+
export declare const get: <T>(api: string, headers?: ApiConfig['headers'] | Record<string, string>, params?: {}, abort?: boolean, userFlow?: string) => AxiosCall<T>;
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
14
15
|
* @param api
|
|
@@ -18,7 +19,7 @@ export declare const get: <T>(api: string, headers?: {}, params?: {}, abort?: bo
|
|
|
18
19
|
* @param abort
|
|
19
20
|
* @returns
|
|
20
21
|
*/
|
|
21
|
-
export declare const post: <T>(api: string, headers?:
|
|
22
|
+
export declare const post: <T>(api: string, headers?: ApiConfig['headers'] | Record<string, string>, data?: {}, params?: {}, abort?: boolean, userFlow?: string) => AxiosCall<T>;
|
|
22
23
|
/**
|
|
23
24
|
* Axios Put
|
|
24
25
|
* @param api
|
|
@@ -28,7 +29,7 @@ export declare const post: <T>(api: string, headers?: {}, data?: {}, params?: {}
|
|
|
28
29
|
* @param abort
|
|
29
30
|
* @returns {call, controller}
|
|
30
31
|
*/
|
|
31
|
-
export declare const put: <T>(api: string, headers?:
|
|
32
|
+
export declare const put: <T>(api: string, headers?: ApiConfig['headers'] | Record<string, string>, data?: {}, params?: {}, abort?: boolean, userFlow?: string) => AxiosCall<T>;
|
|
32
33
|
/**
|
|
33
34
|
* Axios Patch
|
|
34
35
|
* @param api
|
|
@@ -38,4 +39,4 @@ export declare const put: <T>(api: string, headers?: {}, data?: {}, params?: {},
|
|
|
38
39
|
* @param abort
|
|
39
40
|
* @returns {call, controller}
|
|
40
41
|
*/
|
|
41
|
-
export declare const patch: <T>(api: string, headers?:
|
|
42
|
+
export declare const patch: <T>(api: string, headers?: ApiConfig['headers'] | Record<string, string>, data?: {}, params?: {}, abort?: boolean, userFlow?: string) => AxiosCall<T>;
|
package/dist/store/useStore.d.ts
CHANGED
|
@@ -61,3 +61,11 @@ export declare const setModalOpen: (userFlow: string, isModalOpen: boolean) => v
|
|
|
61
61
|
* @param isDrawerOpen - The new isDrawerOpen state
|
|
62
62
|
*/
|
|
63
63
|
export declare const setDrawerOpen: (userFlow: string, isDrawerOpen: boolean) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Updates the headers in the apiConfig for a specific userFlow.
|
|
66
|
+
* This is used to update headers after token refresh or other authentication changes.
|
|
67
|
+
*
|
|
68
|
+
* @param userFlow - The identifier for the current userFlow
|
|
69
|
+
* @param headers - The new headers value (can be string, object, or function)
|
|
70
|
+
*/
|
|
71
|
+
export declare const updateApiConfigHeaders: (userFlow: string, headers: ApiConfig['headers']) => void;
|
|
@@ -12,9 +12,17 @@ export interface ApiConfig {
|
|
|
12
12
|
api: string;
|
|
13
13
|
/**
|
|
14
14
|
* The headers to be used in the API requests.
|
|
15
|
+
* Can be a string (JSON), a static object, or a function that returns headers dynamically.
|
|
16
|
+
* If it's a function, it will be evaluated on each request to get the latest headers.
|
|
15
17
|
* Typically contains authentication and content type details.
|
|
16
18
|
*/
|
|
17
|
-
headers: string;
|
|
19
|
+
headers: string | Record<string, string> | (() => Record<string, string>);
|
|
20
|
+
/**
|
|
21
|
+
* Optional callback function that is called when a 401 error is detected.
|
|
22
|
+
* This function should handle the token refresh and return the new headers.
|
|
23
|
+
* @returns Promise that resolves to the updated headers object
|
|
24
|
+
*/
|
|
25
|
+
onAuthenticationError?: () => Promise<Record<string, string>>;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
20
28
|
* Type definition for the page type. Determines if the page is a simple page or a form.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApiConfig } from '../types/builder.type';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes headers by evaluating if it's a function, parsing if it's a string, or returning as object
|
|
4
|
+
* @param headers - Headers value (string, object, or function)
|
|
5
|
+
* @returns Normalized headers as Record<string, string>
|
|
6
|
+
*/
|
|
7
|
+
export declare const normalizeHeaders: (headers: ApiConfig['headers'] | Record<string, string>) => Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"react-select-async-paginate": "0.7.3",
|
|
32
32
|
"recharts": "3.1.0",
|
|
33
33
|
"zustand": "4.5.4",
|
|
34
|
-
"@foris/avocado-
|
|
34
|
+
"@foris/avocado-suite": "1.2.1",
|
|
35
35
|
"@foris/avocado-icons": "1.16.0",
|
|
36
|
-
"@foris/avocado-
|
|
36
|
+
"@foris/avocado-core": "0.12.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@testing-library/jest-dom": "6.4.0",
|