@foris/avocado-not-front 0.6.0 → 0.8.0
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 +7823 -7567
- package/dist/avocado-not-front.umd.js +131 -131
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/dist/components/checkbox/Checkbox.d.ts +12 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/select/select.util.d.ts +8 -0
- package/dist/hooks/builder/usePage.d.ts +2 -2
- package/dist/hooks/useAction.d.ts +3 -2
- package/dist/store/useStore.d.ts +4 -4
- package/dist/types/builder.type.d.ts +14 -6
- package/dist/types/components.type.d.ts +65 -2
- package/dist/types/componentsCore.type.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BreadcrumbsNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront Breadcrumbs component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface BreadcrumbsNotFrontExtendedProps extends BreadcrumbsNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const BreadcrumbsNotFront: ({ userFlow, items, responseKey, }: BreadcrumbsNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default BreadcrumbsNotFront;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { CheckboxNotFrontProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Extended props for NotFront Checkbox component.
|
|
5
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
6
|
+
*/
|
|
7
|
+
interface CheckboxNotFrontExtendedProps extends CheckboxNotFrontProps {
|
|
8
|
+
userFlow: string;
|
|
9
|
+
pageId: string;
|
|
10
|
+
}
|
|
11
|
+
declare const CheckboxNotFront: FC<CheckboxNotFrontExtendedProps>;
|
|
12
|
+
export default CheckboxNotFront;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import Body from './body/Body';
|
|
2
|
+
import Breadcrumbs from './breadcrumbs/Breadcrumbs';
|
|
2
3
|
import Button from './button/Button';
|
|
4
|
+
import Checkbox from './checkbox/Checkbox';
|
|
3
5
|
import CodeEditor from './code-editor/CodeEditor';
|
|
4
6
|
import ContentWrapper from './content-wrapper/ContentWrapper';
|
|
5
7
|
import Header from './header/Header';
|
|
6
8
|
import Select from './select';
|
|
7
9
|
import TextField from './text-field/TextField';
|
|
8
|
-
export { Body, Button, CodeEditor, ContentWrapper, Header, Select, TextField };
|
|
10
|
+
export { Body, Breadcrumbs, Button, Checkbox, CodeEditor, ContentWrapper, Header, Select, TextField, };
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
* @returns A string with the full URL including query parameters.
|
|
8
8
|
*/
|
|
9
9
|
export declare const buildPaginatedURL: (baseUrl: string, search: string, page: number) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Converts an object of key-value pairs into a URI-encoded query string.
|
|
12
|
+
*
|
|
13
|
+
* @param {Record<string, any>} params - An object where keys and values represent query parameters.
|
|
14
|
+
* Values that are `null` or `undefined` will be skipped.
|
|
15
|
+
* @returns {string} A properly URI-encoded query string (e.g., "key1=value1&key2=value2").
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildQueryString: (params: Record<string, any>) => string;
|
|
10
18
|
/**
|
|
11
19
|
* Extracts and transforms a list of options from a JSON response using JSONPath expressions.
|
|
12
20
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiConfig,
|
|
1
|
+
import { ApiConfig, PageContent } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Custom hook to manage page rendering based on API or provided JSON configuration.
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import { ApiConfig, Page } from '../../types';
|
|
|
6
6
|
* @param jsonPage - Optional page configuration object.
|
|
7
7
|
* @returns JSX content to render the page (header and body).
|
|
8
8
|
*/
|
|
9
|
-
export declare const usePage: (userFlow: string, apiConfig: ApiConfig, jsonPage?:
|
|
9
|
+
export declare const usePage: (userFlow: string, apiConfig: ApiConfig, jsonPage?: PageContent | null) => JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { NotFrontDataSource } from '../types/componentsCore.type';
|
|
3
|
+
import { NextUIResponseData } from '../types/builder.type';
|
|
3
4
|
/**
|
|
4
5
|
* Custom hook that encapsulates actions related to navigation and data fetching for dynamic UI flows.
|
|
5
6
|
*/
|
|
6
7
|
export declare const useAction: () => {
|
|
7
|
-
getNextUI: (userFlow: string,
|
|
8
|
+
getNextUI: (userFlow: string, pageHash: string, entries: any, responseKey: string) => Promise<AxiosResponse<NextUIResponseData, any>>;
|
|
8
9
|
fetchDataSource: (dataSource: NotFrontDataSource) => Promise<AxiosResponse<any, any> | undefined>;
|
|
9
|
-
fetchAndGetNextUI: (userFlow: string,
|
|
10
|
+
fetchAndGetNextUI: (userFlow: string, pageHash: string, entries: any, responseKey: string, dataSource: NotFrontDataSource) => Promise<AxiosResponse<NextUIResponseData, any> | undefined>;
|
|
10
11
|
};
|
package/dist/store/useStore.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ApiConfig,
|
|
1
|
+
import type { ApiConfig, NextUIResponseData, PageContent } from '../types/builder.type';
|
|
2
2
|
export type NotFrontStore = Record<string, UserFlow>;
|
|
3
3
|
export type PageStore = {
|
|
4
|
-
page?:
|
|
4
|
+
page?: PageContent | null;
|
|
5
5
|
};
|
|
6
6
|
export type UserFlow = {
|
|
7
7
|
apiConfig: ApiConfig;
|
|
@@ -10,8 +10,8 @@ export type UserFlow = {
|
|
|
10
10
|
pages: Record<string, PageStore>;
|
|
11
11
|
};
|
|
12
12
|
export declare const useStore: import("zustand").UseBoundStore<import("zustand").StoreApi<NotFrontStore>>;
|
|
13
|
-
export declare const setNotFrontStore: (userFlowId: string,
|
|
14
|
-
export declare const setPage: (userFlow: string,
|
|
13
|
+
export declare const setNotFrontStore: (userFlowId: string, apiConfig: ApiConfig, page: PageContent) => void;
|
|
14
|
+
export declare const setPage: (userFlow: string, response: NextUIResponseData) => void;
|
|
15
15
|
/**
|
|
16
16
|
* Updates the `entries` object of a specific userFlow in the store.
|
|
17
17
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NotFrontComponent } from './components.type';
|
|
2
|
+
import { NotFrontDataSource } from './componentsCore.type';
|
|
2
3
|
/**
|
|
3
4
|
* Interface for the configuration required to interact with the API.
|
|
4
5
|
* This interface includes the necessary details for the API connection.
|
|
@@ -49,7 +50,8 @@ export interface ObjectNotFront {
|
|
|
49
50
|
* Interface for the page data used in the NotFront system.
|
|
50
51
|
* Contains a collection of components, a hash for caching, a title, and optional header and body objects.
|
|
51
52
|
*/
|
|
52
|
-
export
|
|
53
|
+
export type PageContent = {
|
|
54
|
+
type: 'page';
|
|
53
55
|
/**
|
|
54
56
|
* A collection of components to be rendered in the page.
|
|
55
57
|
* These components make up the structure of the page content.
|
|
@@ -60,11 +62,6 @@ export interface Page {
|
|
|
60
62
|
* Used for caching and page state management.
|
|
61
63
|
*/
|
|
62
64
|
hash: string;
|
|
63
|
-
/**
|
|
64
|
-
* The title of the page, displayed as the main header.
|
|
65
|
-
* This is typically used for the page's title in the browser.
|
|
66
|
-
*/
|
|
67
|
-
title: string;
|
|
68
65
|
/**
|
|
69
66
|
* An optional header object containing its components and properties.
|
|
70
67
|
* If not provided, the page will not render a header section.
|
|
@@ -75,4 +72,15 @@ export interface Page {
|
|
|
75
72
|
* If not provided, the page will not render a body section.
|
|
76
73
|
*/
|
|
77
74
|
body?: ObjectNotFront | null;
|
|
75
|
+
};
|
|
76
|
+
export type FetchContent = {
|
|
77
|
+
type: 'fetch';
|
|
78
|
+
hash: string;
|
|
79
|
+
responseKey: string;
|
|
80
|
+
dataSource: NotFrontDataSource;
|
|
81
|
+
};
|
|
82
|
+
export interface NextUIResponseData {
|
|
83
|
+
content: PageContent | FetchContent;
|
|
84
|
+
deprecatedStateKeys: string[];
|
|
85
|
+
sessionId: string;
|
|
78
86
|
}
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import { ButtonProps, CardNotificationProps, HeadingProps, SelectProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
1
|
+
import { ButtonProps, CardNotificationProps, HeadingProps, SelectProps, TextFieldProps, TextProps, CheckboxProps } from '../../../avocado-suite';
|
|
2
2
|
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource, NotFrontDataSourceSelect } from './componentsCore.type';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single breadcrumb item for the NotFront component
|
|
5
|
+
*/
|
|
6
|
+
export interface BreadcrumbsItemNotFront {
|
|
7
|
+
/**
|
|
8
|
+
* Visible label of the breadcrumb item.
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* Type of action to be triggered when the breadcrumb is clicked.
|
|
13
|
+
*/
|
|
14
|
+
actionType: NotFrontActionType;
|
|
15
|
+
/**
|
|
16
|
+
* Optional URL to redirect the user when the breadcrumb is clicked.
|
|
17
|
+
* Used only if `actionType` is `REDIRECT`.
|
|
18
|
+
*/
|
|
19
|
+
redirectUrl: string;
|
|
20
|
+
/**
|
|
21
|
+
* Unique page identifier associated with this breadcrumb
|
|
22
|
+
*/
|
|
23
|
+
hashCode: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for the props used in the ButtonNotFrontProps component.
|
|
27
|
+
*/
|
|
28
|
+
export interface BreadcrumbsNotFrontProps extends NotFrontBaseProps {
|
|
29
|
+
/**
|
|
30
|
+
* Identifier to specify that this is a breadcrumbs component.
|
|
31
|
+
*/
|
|
32
|
+
component: 'breadcrumbs';
|
|
33
|
+
/**
|
|
34
|
+
* List of breadcrumb items to render in order.
|
|
35
|
+
*/
|
|
36
|
+
items: BreadcrumbsItemNotFront[];
|
|
37
|
+
}
|
|
3
38
|
/**
|
|
4
39
|
* Interface for the props used in the ButtonNotFrontProps component.
|
|
5
40
|
*/
|
|
@@ -27,6 +62,28 @@ export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
|
|
|
27
62
|
*/
|
|
28
63
|
redirectUrl: string;
|
|
29
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Interface for the props used in the CheckboxNotFront component.
|
|
67
|
+
*/
|
|
68
|
+
export interface CheckboxNotFrontProps extends NotFrontBaseProps, CheckboxProps {
|
|
69
|
+
component: 'checkbox';
|
|
70
|
+
/**
|
|
71
|
+
* Defines the action triggered when the button is clicked.
|
|
72
|
+
*/
|
|
73
|
+
actionType: NotFrontActionType;
|
|
74
|
+
/**
|
|
75
|
+
* The text label displayed next to the checkbox.
|
|
76
|
+
*/
|
|
77
|
+
label: string;
|
|
78
|
+
/**
|
|
79
|
+
* Indicates if the checkbox input is mandatory.
|
|
80
|
+
*/
|
|
81
|
+
required: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Determines if the checkbox is initially checked.
|
|
84
|
+
*/
|
|
85
|
+
value: boolean;
|
|
86
|
+
}
|
|
30
87
|
/**
|
|
31
88
|
* Interface for the props used in the CardNotificationNotFront component.
|
|
32
89
|
*/
|
|
@@ -103,6 +160,10 @@ export interface SelectNotFrontProps extends NotFrontBaseProps, SelectProps {
|
|
|
103
160
|
* Indicates whether the component is mandatory.
|
|
104
161
|
*/
|
|
105
162
|
required: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Support multiple selected options
|
|
165
|
+
*/
|
|
166
|
+
isMulti: boolean;
|
|
106
167
|
}
|
|
107
168
|
/**
|
|
108
169
|
* Interface for the props used in the TextNotFront component.
|
|
@@ -128,13 +189,15 @@ export interface TextFieldNotFrontProps extends NotFrontBaseProps, TextFieldProp
|
|
|
128
189
|
/**
|
|
129
190
|
* Union type representing all possible NotFront component prop types.
|
|
130
191
|
*/
|
|
131
|
-
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | SelectNotFrontProps |
|
|
192
|
+
export type NotFrontComponent = BreadcrumbsNotFrontProps | ButtonNotFrontProps | CardNotificationNotFrontProps | CheckboxNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | SelectNotFrontProps | TextFieldNotFrontProps | TextNotFrontProps;
|
|
132
193
|
/**
|
|
133
194
|
* Mapping of component identifiers (as strings) to their corresponding prop types.
|
|
134
195
|
*/
|
|
135
196
|
export type NotFrontComponentTypeMap = {
|
|
197
|
+
breadcrumbs: BreadcrumbsNotFrontProps;
|
|
136
198
|
button: ButtonNotFrontProps;
|
|
137
199
|
cardNotification: CardNotificationNotFrontProps;
|
|
200
|
+
checkbox: CheckboxNotFrontProps;
|
|
138
201
|
code: CodeEditorNotFrontProps;
|
|
139
202
|
heading: HeadingNotFrontProps;
|
|
140
203
|
select: SelectNotFrontProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"zustand": "4.5.4",
|
|
32
32
|
"@foris/avocado-core": "0.10.0",
|
|
33
33
|
"@foris/avocado-icons": "1.13.0",
|
|
34
|
-
"@foris/avocado-suite": "0.
|
|
34
|
+
"@foris/avocado-suite": "0.33.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@testing-library/jest-dom": "6.4.0",
|