oiu-core1 0.1.15
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/README.md +143 -0
- package/dist/assets/oiu-core.css +1 -0
- package/dist/auth/AuthenticationProvider.d.ts +16 -0
- package/dist/auth/AuthenticationProvider.d.ts.map +1 -0
- package/dist/auth/AuthorizationProvider.d.ts +22 -0
- package/dist/auth/AuthorizationProvider.d.ts.map +1 -0
- package/dist/auth/Context.d.ts +5 -0
- package/dist/auth/Context.d.ts.map +1 -0
- package/dist/auth/OAuthService/index.d.ts +58 -0
- package/dist/auth/OAuthService/index.d.ts.map +1 -0
- package/dist/auth/OAuthService/utils.d.ts +23 -0
- package/dist/auth/OAuthService/utils.d.ts.map +1 -0
- package/dist/auth/_type.d.ts +157 -0
- package/dist/auth/_type.d.ts.map +1 -0
- package/dist/auth/index.d.ts +17 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/utils.d.ts +42 -0
- package/dist/auth/utils.d.ts.map +1 -0
- package/dist/components/Col/index.d.ts +17 -0
- package/dist/components/Col/index.d.ts.map +1 -0
- package/dist/components/ConfigLoader/index.d.ts +24 -0
- package/dist/components/ConfigLoader/index.d.ts.map +1 -0
- package/dist/components/ErrorCode/index.d.ts +16 -0
- package/dist/components/ErrorCode/index.d.ts.map +1 -0
- package/dist/components/FormErrorSummary/Content.d.ts +10 -0
- package/dist/components/FormErrorSummary/Content.d.ts.map +1 -0
- package/dist/components/FormErrorSummary/WithErrorFieldsMap.d.ts +28 -0
- package/dist/components/FormErrorSummary/WithErrorFieldsMap.d.ts.map +1 -0
- package/dist/components/FormErrorSummary/index.d.ts +11 -0
- package/dist/components/FormErrorSummary/index.d.ts.map +1 -0
- package/dist/components/LangProvider/index.d.ts +31 -0
- package/dist/components/LangProvider/index.d.ts.map +1 -0
- package/dist/components/Pagination/index.d.ts +18 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Row/index.d.ts +15 -0
- package/dist/components/Row/index.d.ts.map +1 -0
- package/dist/components/SearchWithCard/index.d.ts +35 -0
- package/dist/components/SearchWithCard/index.d.ts.map +1 -0
- package/dist/components/Wait/_type.d.ts +33 -0
- package/dist/components/Wait/_type.d.ts.map +1 -0
- package/dist/components/Wait/index.d.ts +9 -0
- package/dist/components/Wait/index.d.ts.map +1 -0
- package/dist/components/_types.d.ts +4 -0
- package/dist/components/_types.d.ts.map +1 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/hoc/index.d.ts +3 -0
- package/dist/hoc/index.d.ts.map +1 -0
- package/dist/hoc/withError.d.ts +21 -0
- package/dist/hoc/withError.d.ts.map +1 -0
- package/dist/hoc/wl.d.ts +31 -0
- package/dist/hoc/wl.d.ts.map +1 -0
- package/dist/index-BRODpY4Y.js +2659 -0
- package/dist/init.d.ts +63 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/language/index.d.ts +75 -0
- package/dist/language/index.d.ts.map +1 -0
- package/dist/main-DEwdbtUG.js +23410 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +12 -0
- package/dist/redux/apiSlices/index.d.ts +19 -0
- package/dist/redux/apiSlices/index.d.ts.map +1 -0
- package/dist/redux/index.d.ts +18 -0
- package/dist/redux/index.d.ts.map +1 -0
- package/dist/redux/slices/appSlice.d.ts +67 -0
- package/dist/redux/slices/appSlice.d.ts.map +1 -0
- package/dist/redux/slices/errorSlice.d.ts +57 -0
- package/dist/redux/slices/errorSlice.d.ts.map +1 -0
- package/dist/redux/slices/langSlice.d.ts +41 -0
- package/dist/redux/slices/langSlice.d.ts.map +1 -0
- package/dist/theme/UITheme.d.ts +26 -0
- package/dist/theme/UITheme.d.ts.map +1 -0
- package/dist/theme/index.d.ts +16 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/utils/_types.d.ts +32 -0
- package/dist/utils/_types.d.ts.map +1 -0
- package/dist/utils/config.d.ts +32 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/promise.d.ts +14 -0
- package/dist/utils/promise.d.ts.map +1 -0
- package/dist/utils/string.d.ts +15 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/sys.d.ts +3 -0
- package/dist/utils/sys.d.ts.map +1 -0
- package/dist/utils/url.d.ts +47 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
## Guide for creation
|
|
2
|
+
1. `npm create vite@latest . -- --template react-ts`
|
|
3
|
+
2. Create the tsconfig.build.json (this is the file used in the build process)
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"extends": "./tsconfig.json",
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"declarationDir": "./dist",
|
|
12
|
+
"outDir": "./dist",
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
},
|
|
18
|
+
"include": ["lib"]
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
3. Update vite.config.ts with the build configuration
|
|
22
|
+
```js
|
|
23
|
+
import { defineConfig } from 'vite';
|
|
24
|
+
import react from '@vitejs/plugin-react';
|
|
25
|
+
import { dirname, resolve } from 'node:path';
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// https://vite.dev/config/
|
|
30
|
+
|
|
31
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
32
|
+
console.log('Vite build path:', __dirname);
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
plugins: [react()],
|
|
36
|
+
resolve: {
|
|
37
|
+
alias: {
|
|
38
|
+
'@': resolve(__dirname, 'src'),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
build: {
|
|
42
|
+
copyPublicDir: false,
|
|
43
|
+
lib: {
|
|
44
|
+
entry: resolve(__dirname, 'lib/main.ts'),
|
|
45
|
+
formats: ['es'],
|
|
46
|
+
},
|
|
47
|
+
rollupOptions: {
|
|
48
|
+
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
49
|
+
output: {
|
|
50
|
+
globals: {
|
|
51
|
+
react: 'React',
|
|
52
|
+
'react-dom': 'ReactDOM',
|
|
53
|
+
},
|
|
54
|
+
assetFileNames: 'assets/[name][extname]',
|
|
55
|
+
entryFileNames: '[name].js',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
4. Add CSS module d.ts (css-modules.d.ts)
|
|
62
|
+
5. `npm publish` (for that you need to enable the 2fa in your npm account if you use the public registry)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# React + TypeScript + Vite
|
|
68
|
+
|
|
69
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
70
|
+
|
|
71
|
+
Currently, two official plugins are available:
|
|
72
|
+
|
|
73
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
74
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
75
|
+
|
|
76
|
+
## React Compiler
|
|
77
|
+
|
|
78
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
79
|
+
|
|
80
|
+
## Expanding the ESLint configuration
|
|
81
|
+
|
|
82
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
export default defineConfig([
|
|
86
|
+
globalIgnores(['dist']),
|
|
87
|
+
{
|
|
88
|
+
files: ['**/*.{ts,tsx}'],
|
|
89
|
+
extends: [
|
|
90
|
+
// Other configs...
|
|
91
|
+
|
|
92
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
93
|
+
tseslint.configs.recommendedTypeChecked,
|
|
94
|
+
// Alternatively, use this for stricter rules
|
|
95
|
+
tseslint.configs.strictTypeChecked,
|
|
96
|
+
// Optionally, add this for stylistic rules
|
|
97
|
+
tseslint.configs.stylisticTypeChecked,
|
|
98
|
+
|
|
99
|
+
// Other configs...
|
|
100
|
+
],
|
|
101
|
+
languageOptions: {
|
|
102
|
+
parserOptions: {
|
|
103
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
104
|
+
tsconfigRootDir: import.meta.dirname,
|
|
105
|
+
},
|
|
106
|
+
// other options...
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
])
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
// eslint.config.js
|
|
116
|
+
import reactX from 'eslint-plugin-react-x'
|
|
117
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
118
|
+
|
|
119
|
+
export default defineConfig([
|
|
120
|
+
globalIgnores(['dist']),
|
|
121
|
+
{
|
|
122
|
+
files: ['**/*.{ts,tsx}'],
|
|
123
|
+
extends: [
|
|
124
|
+
// Other configs...
|
|
125
|
+
// Enable lint rules for React
|
|
126
|
+
reactX.configs['recommended-typescript'],
|
|
127
|
+
// Enable lint rules for React DOM
|
|
128
|
+
reactDom.configs.recommended,
|
|
129
|
+
],
|
|
130
|
+
languageOptions: {
|
|
131
|
+
parserOptions: {
|
|
132
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
133
|
+
tsconfigRootDir: import.meta.dirname,
|
|
134
|
+
},
|
|
135
|
+
// other options...
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
])
|
|
139
|
+
```
|
|
140
|
+
## Publish NPM
|
|
141
|
+
1. npm login
|
|
142
|
+
2. npm run build
|
|
143
|
+
3. npm publish
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._overlay_1ol4o_1{min-width:100%}._dummy_1ol4o_7{min-height:100vh}.wait-overlay{position:inherit}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { IAuthService } from './_type';
|
|
3
|
+
/** Props for the AuthenticationProvider component. */
|
|
4
|
+
export type AuthenticationProviderProps = PropsWithChildren<{
|
|
5
|
+
/** Optional CSS class name to apply to the Wait component wrapper */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** The authentication service to be used for managing user identity. */
|
|
8
|
+
service?: IAuthService;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Store the authentication service in context and manage the identity state.
|
|
12
|
+
* @param param0
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function AuthenticationProvider({ className, service, children }: AuthenticationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=AuthenticationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationProvider.d.ts","sourceRoot":"","sources":["../../lib/auth/AuthenticationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAKnF,OAAO,EAAE,YAAY,EAAY,MAAM,SAAS,CAAC;AAOjD,sDAAsD;AACtD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IACxD,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE,YAAY,CAAA;CACzB,CAAC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,2BAA2B,2CA2CnG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { MongoAbility } from '@casl/ability';
|
|
3
|
+
import { Identity, Permission } from './_type';
|
|
4
|
+
export type PermissionFn<TIdentity extends Identity> = (identity?: TIdentity) => {
|
|
5
|
+
allowed: Permission[];
|
|
6
|
+
denied: Permission[];
|
|
7
|
+
};
|
|
8
|
+
export type AuthorizationProviderProps<TIdentity extends Identity> = PropsWithChildren<{
|
|
9
|
+
/** Optional CSS class name to apply to the Wait component wrapper */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Get permission for the current identity */
|
|
12
|
+
getPermissionFor: PermissionFn<TIdentity>;
|
|
13
|
+
/** Default ability to be use */
|
|
14
|
+
defaultAbility?: MongoAbility;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Set context for the permissions associate with the user.
|
|
18
|
+
* @param param0
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function AuthorizationProvider<TIdentity extends Identity>({ className, children, getPermissionFor, defaultAbility }: AuthorizationProviderProps<TIdentity>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=AuthorizationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthorizationProvider.d.ts","sourceRoot":"","sources":["../../lib/auth/AuthorizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AAGxE,OAAO,EAAsC,YAAY,EAAE,MAAM,eAAe,CAAC;AAKjF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAa/C,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,KAAK;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AACjI,MAAM,MAAM,0BAA0B,CAAC,SAAS,SAAS,QAAQ,IAAI,iBAAiB,CAAC;IACnF,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,gBAAgB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,gCAAgC;IAChC,cAAc,CAAC,EAAE,YAAY,CAAC;CACjC,CAAC,CAAC;AACH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,QAAQ,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,0BAA0B,CAAC,SAAS,CAAC,2CA0CjK"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MongoAbility } from "@casl/ability";
|
|
2
|
+
import { IAuthService } from './_type';
|
|
3
|
+
export declare const AuthContext: import("react").Context<IAuthService>;
|
|
4
|
+
export declare const AbilityContext: import("react").Context<MongoAbility<import("@casl/ability").AbilityTuple, import("@casl/ability").MongoQuery>>;
|
|
5
|
+
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../lib/auth/Context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,eAAO,MAAM,WAAW,uCAAqD,CAAC;AAC9E,eAAO,MAAM,cAAc,iHAAqD,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AsyncStorage, SigninPopupArgs, SigninRedirectArgs, SigninSilentArgs, SignoutPopupArgs, SignoutRedirectArgs, UserManagerSettings } from 'oidc-client-ts';
|
|
2
|
+
import { State } from '../../utils/url';
|
|
3
|
+
import { Options } from './utils';
|
|
4
|
+
import { AuthResult, AuthService, Identity } from '../_type';
|
|
5
|
+
/**
|
|
6
|
+
* Initialize a new instance of the Auth service
|
|
7
|
+
* @param settings
|
|
8
|
+
* @param store
|
|
9
|
+
* @param options
|
|
10
|
+
*/
|
|
11
|
+
export default function CreateOAuthService(settings: UserManagerSettings, store: AsyncStorage | Storage, options: Options): OAuthService;
|
|
12
|
+
declare class OAuthService extends AuthService {
|
|
13
|
+
private _userManager;
|
|
14
|
+
private _popUpPolicy;
|
|
15
|
+
private _onIdentityCreated?;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize a new instance of the Auth service
|
|
18
|
+
* @param prefix
|
|
19
|
+
* @param settings
|
|
20
|
+
* @param store
|
|
21
|
+
* @param popupPolicy Popup policy to use for authentication. By default pop ups are disabled
|
|
22
|
+
* because they don't work properly on Edge. If you want to enable pop up authentication simply set this flag to false.
|
|
23
|
+
*/
|
|
24
|
+
constructor(settings: UserManagerSettings, store: AsyncStorage | Storage, options: Options);
|
|
25
|
+
/** @inheritdoc */
|
|
26
|
+
getUnsafeInstance(): unknown;
|
|
27
|
+
/** @inheritdoc */
|
|
28
|
+
getUser(): Promise<unknown | null>;
|
|
29
|
+
/** @inheritdoc */
|
|
30
|
+
getIdentity(): Promise<Identity | undefined>;
|
|
31
|
+
/** @inheritdoc */
|
|
32
|
+
clear(identity?: boolean): Promise<void>;
|
|
33
|
+
/** @inheritdoc */
|
|
34
|
+
signIn(state?: unknown, args?: unknown, onFeedback?: (feedback: string) => void, explicit?: boolean): Promise<AuthResult>;
|
|
35
|
+
/** @inheritdoc */
|
|
36
|
+
completeSignIn(url?: string): Promise<AuthResult>;
|
|
37
|
+
/** @inheritdoc */
|
|
38
|
+
silentSignIn(state?: unknown, args?: unknown): Promise<AuthResult | undefined>;
|
|
39
|
+
/** @inheritdoc */
|
|
40
|
+
completeSilentSignin(url?: string): Promise<AuthResult>;
|
|
41
|
+
/** @inheritdoc */
|
|
42
|
+
signOut(state?: State): Promise<AuthResult>;
|
|
43
|
+
/** @inheritdoc */
|
|
44
|
+
completeSignOut(url?: string): Promise<AuthResult>;
|
|
45
|
+
protected trySilentSignIn(state?: unknown, args?: SigninSilentArgs): Promise<AuthResult | undefined>;
|
|
46
|
+
protected tryRedirectSignIn(state?: unknown, args?: SigninRedirectArgs): Promise<AuthResult>;
|
|
47
|
+
protected tryPopUpSignIn(state?: unknown, args?: SigninPopupArgs): Promise<AuthResult>;
|
|
48
|
+
protected tryPopUpSignOut(state?: unknown, args?: SignoutPopupArgs): Promise<AuthResult>;
|
|
49
|
+
protected tryRedirectSignOut(state?: unknown, args?: SignoutRedirectArgs): Promise<AuthResult>;
|
|
50
|
+
private _getIdentity;
|
|
51
|
+
private _createArguments;
|
|
52
|
+
private _success;
|
|
53
|
+
private _error;
|
|
54
|
+
private _redirect;
|
|
55
|
+
private _updateState;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/auth/OAuthService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EAGnB,mBAAmB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,OAAO,EAAe,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAoB,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAA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ACL,eAAe,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;cAwB/C,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;cAe1F,iBAAiB,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;cAWlF,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;cAiB5E,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;cAU9E,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAapG,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,MAAM;IAGd,OAAO,CAAC,SAAS;IAGjB,OAAO,CAAC,YAAY;CAOvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { User } from 'oidc-client-ts';
|
|
2
|
+
import { Identity } from '../_type';
|
|
3
|
+
export declare enum PopupPolicy {
|
|
4
|
+
/** Alwais use popup and if not allowed the authentication will fail */
|
|
5
|
+
Always = 1,
|
|
6
|
+
/** Never use popups always redirection */
|
|
7
|
+
Never = 2,
|
|
8
|
+
/** Use popups and if it fails use redirection */
|
|
9
|
+
RedirectIfFails = 3
|
|
10
|
+
}
|
|
11
|
+
export type Options = {
|
|
12
|
+
/** Prefix use to store the authentication this allow use multiples authentications */
|
|
13
|
+
prefix: string;
|
|
14
|
+
popupPolicy?: PopupPolicy;
|
|
15
|
+
/** Trigger when a new identity is created
|
|
16
|
+
* This is useful when you want to add custom properties to the identity or do some side effect when the user is authenticated
|
|
17
|
+
* @param identity The identity created from the user and the jwt
|
|
18
|
+
* @param user The user returned by the oidc-client-ts library
|
|
19
|
+
* @param jwt The decoded jwt token
|
|
20
|
+
*/
|
|
21
|
+
onIdentityCreated?: (identity: Identity, user: User, jwt: unknown) => void;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/auth/OAuthService/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,oBAAY,WAAW;IACnB,uEAAuE;IACvE,MAAM,IAAI;IACV,0CAA0C;IAC1C,KAAK,IAAI;IACT,iDAAiD;IACjD,eAAe,IAAI;CACtB;AACD,MAAM,MAAM,OAAO,GAAG;IAClB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9E,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { State } from "../utils/url";
|
|
2
|
+
import { Guid } from "../utils/_types";
|
|
3
|
+
export type Permission = {
|
|
4
|
+
/** Action */
|
|
5
|
+
I: string;
|
|
6
|
+
/** Subject */
|
|
7
|
+
a: string;
|
|
8
|
+
/** Extra field to parametrize permission */
|
|
9
|
+
f?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Base type from the principal */
|
|
12
|
+
export type Principal = {
|
|
13
|
+
id: Guid;
|
|
14
|
+
username: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
roles: string[];
|
|
18
|
+
};
|
|
19
|
+
/** Identity information of the customer */
|
|
20
|
+
export type Identity<T = Principal> = {
|
|
21
|
+
/** The id_token returned from the OIDC provider */
|
|
22
|
+
id_token?: string;
|
|
23
|
+
/** The session state value returned from the OIDC provider (opaque) */
|
|
24
|
+
session_state?: string | null;
|
|
25
|
+
/** The access token returned from the OIDC provider. */
|
|
26
|
+
access_token?: string;
|
|
27
|
+
/** Refresh token returned from the OIDC provider (if requested) */
|
|
28
|
+
refresh_token?: string;
|
|
29
|
+
/** The token_type returned from the OIDC provider */
|
|
30
|
+
token_type: string;
|
|
31
|
+
/** The scope returned from the OIDC provider */
|
|
32
|
+
scope?: string;
|
|
33
|
+
/** The claims represented by a combination of the id_token and the user info endpoint */
|
|
34
|
+
profile: T;
|
|
35
|
+
/** The expires at returned from the OIDC provider */
|
|
36
|
+
expires_at: number;
|
|
37
|
+
};
|
|
38
|
+
/** Status of the autentication process */
|
|
39
|
+
export declare enum AuthResultStatus {
|
|
40
|
+
Redirect = 0,
|
|
41
|
+
Success = 1,
|
|
42
|
+
Fail = 2
|
|
43
|
+
}
|
|
44
|
+
/** Auth result */
|
|
45
|
+
export type AuthResult = {
|
|
46
|
+
status: AuthResultStatus;
|
|
47
|
+
state?: State;
|
|
48
|
+
message?: string;
|
|
49
|
+
};
|
|
50
|
+
type CallbackFn = (event: string, identity?: Identity) => void;
|
|
51
|
+
export interface IAuthService {
|
|
52
|
+
/**
|
|
53
|
+
* Get the unsafe instance of the authentication service. Do not use this method unless you know what you are doing.
|
|
54
|
+
*/
|
|
55
|
+
getUnsafeInstance(): unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Indicate if customer is autenticate
|
|
58
|
+
*/
|
|
59
|
+
isAuthenticated(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Get identity information
|
|
62
|
+
*/
|
|
63
|
+
getIdentity(): Promise<Identity | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* Initialize sign in process
|
|
66
|
+
* @param state
|
|
67
|
+
* @param args
|
|
68
|
+
*/
|
|
69
|
+
getUser(): Promise<unknown | null>;
|
|
70
|
+
/** Clear the identity information
|
|
71
|
+
* @param identity: if true, clear the identity information and remove the token from the storage
|
|
72
|
+
*/
|
|
73
|
+
clear(identity?: boolean): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Start the sign in process
|
|
76
|
+
* @param state state to be passed to the authentication provider
|
|
77
|
+
* @param args arguments to be passed to the authentication provider
|
|
78
|
+
* @param onFeedback Provide feedback to the authentication process. Like error message or any other information
|
|
79
|
+
* @param explicit Indicate the silent sign in is not allow and the user must be see the login page
|
|
80
|
+
*/
|
|
81
|
+
signIn(state?: unknown, args?: unknown, onFeedback?: (feedback: string) => void, explicit?: boolean): Promise<AuthResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Complete sign in process (this is use in case the sign out requiere 2 stages)
|
|
84
|
+
* @param url
|
|
85
|
+
*/
|
|
86
|
+
completeSignIn(url?: string): Promise<AuthResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Try to sign in silently. This is use to refresh the token or get the user information
|
|
89
|
+
* @param state
|
|
90
|
+
* @param args
|
|
91
|
+
*/
|
|
92
|
+
silentSignIn(state?: unknown, args?: unknown): Promise<AuthResult | undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* Complete silent sign in process (this is use in case the sign out requiere 2 stages)
|
|
95
|
+
* @param url
|
|
96
|
+
*/
|
|
97
|
+
completeSilentSignin(url?: string): Promise<AuthResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Initialize the sign out process
|
|
100
|
+
* @param state
|
|
101
|
+
*/
|
|
102
|
+
signOut(state?: unknown): Promise<AuthResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Complete sign out process (this is use in case the sign out requiere 2 stages)
|
|
105
|
+
* @param url
|
|
106
|
+
*/
|
|
107
|
+
completeSignOut(url?: string): Promise<AuthResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Subscribe to identity back changes. If activate silence refresh token or any other approach to update the identity
|
|
110
|
+
* @param callback
|
|
111
|
+
*/
|
|
112
|
+
subscribe(callback: CallbackFn): number;
|
|
113
|
+
/**
|
|
114
|
+
* Unsubscribe to identity back changes. If activate silence refresh token or any other approach to update the identity
|
|
115
|
+
* @param subscriptionId
|
|
116
|
+
*/
|
|
117
|
+
unsubscribe(subscriptionId: number): void;
|
|
118
|
+
}
|
|
119
|
+
export declare abstract class AuthService implements IAuthService {
|
|
120
|
+
protected _identity?: Identity;
|
|
121
|
+
private _callbacks;
|
|
122
|
+
private _nextSubscriptionId;
|
|
123
|
+
constructor();
|
|
124
|
+
abstract getUnsafeInstance(): unknown;
|
|
125
|
+
abstract getIdentity(): Promise<Identity | undefined>;
|
|
126
|
+
abstract getUser(): Promise<unknown | null>;
|
|
127
|
+
abstract clear(identity?: boolean): Promise<void>;
|
|
128
|
+
abstract signIn(state?: unknown, args?: unknown, onFeedback?: (feedback: string) => void, explicit?: boolean): Promise<AuthResult>;
|
|
129
|
+
abstract completeSignIn(url?: string): Promise<AuthResult>;
|
|
130
|
+
abstract silentSignIn(state?: unknown, args?: unknown): Promise<AuthResult | undefined>;
|
|
131
|
+
abstract completeSilentSignin(url?: string): Promise<AuthResult>;
|
|
132
|
+
abstract signOut(state?: unknown): Promise<AuthResult>;
|
|
133
|
+
abstract completeSignOut(url?: string): Promise<AuthResult>;
|
|
134
|
+
/** @inheritdoc */
|
|
135
|
+
isAuthenticated(): Promise<boolean>;
|
|
136
|
+
/** @inheritdoc */
|
|
137
|
+
unsubscribe(subscriptionId: number): void;
|
|
138
|
+
/** @inheritdoc */
|
|
139
|
+
subscribe(callback: CallbackFn): number;
|
|
140
|
+
protected _notifySubscribers(event: string, identity?: Identity): void;
|
|
141
|
+
}
|
|
142
|
+
/** Dummy authentication service for testing purposes */
|
|
143
|
+
export declare class DummyAuthService extends AuthService {
|
|
144
|
+
constructor(identity?: Identity);
|
|
145
|
+
getUnsafeInstance(): unknown;
|
|
146
|
+
getIdentity(): Promise<Identity | undefined>;
|
|
147
|
+
getUser(): Promise<unknown | null>;
|
|
148
|
+
clear(identity?: boolean): Promise<void>;
|
|
149
|
+
signIn(): Promise<AuthResult>;
|
|
150
|
+
completeSignIn(url?: string): Promise<AuthResult>;
|
|
151
|
+
silentSignIn(): Promise<AuthResult | undefined>;
|
|
152
|
+
completeSilentSignin(url?: string): Promise<AuthResult>;
|
|
153
|
+
signOut(): Promise<AuthResult>;
|
|
154
|
+
completeSignOut(url?: string): Promise<AuthResult>;
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_type.d.ts","sourceRoot":"","sources":["../../lib/auth/_type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,MAAM,MAAM,UAAU,GAAG;IACrB,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,cAAc;IACd,CAAC,EAAE,MAAM,CAAC;IACV,4CAA4C;IAC5C,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AACF,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG;IACpB,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;CASnB,CAAC;AACF,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,SAAS,IAAI;IAClC,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mEAA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C,UAAU,CAAC;IAGvD,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IAG9B,eAAe,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAGrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './_type';
|
|
2
|
+
export * from './utils';
|
|
3
|
+
export * from './AuthenticationProvider';
|
|
4
|
+
export * from './AuthorizationProvider';
|
|
5
|
+
export * from './OAuthService/utils';
|
|
6
|
+
import type { Options } from './OAuthService/utils';
|
|
7
|
+
import type { IAuthService } from './_type';
|
|
8
|
+
import type { AsyncStorage, UserManagerSettings } from 'oidc-client-ts';
|
|
9
|
+
/**
|
|
10
|
+
* Create new OAuthService instance
|
|
11
|
+
* @param settings
|
|
12
|
+
* @param store
|
|
13
|
+
* @param options
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function CreateOAuthService(settings: UserManagerSettings, store: AsyncStorage | Storage, options: Options): Promise<IAuthService>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sBAAsB,CAAC;AAErC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIxE;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,YAAY,GAAG,OAAO,EAC7B,OAAO,EAAE,OAAO,GACjB,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { IAuthService, Identity, Permission } from './_type';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to retrieve the current auth service
|
|
5
|
+
* @returns {IAuthService} The current authentication service
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAuthentication(): IAuthService;
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve the current identity in the system
|
|
10
|
+
* @returns {Identity | undefined} The current identity
|
|
11
|
+
*/
|
|
12
|
+
export declare function useIdentity<TIdentity extends Identity = Identity>(): TIdentity | undefined;
|
|
13
|
+
/** Function to check if the user has the permission */
|
|
14
|
+
export type AllowedFn = (permission: Permission) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Hook to retrieve the authorization ability and check permissions
|
|
17
|
+
* @returns Object with the ability and a function to check if the user has the permission.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useAuthorization: () => {
|
|
20
|
+
can: (action: string, subject: import("@casl/ability").Subject, field?: string) => boolean;
|
|
21
|
+
allowed: AllowedFn;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Allow create new permission with unique id
|
|
25
|
+
* @param f
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare function createPermission(f?: string): Permission;
|
|
29
|
+
/**
|
|
30
|
+
* Props for the Allowed component.
|
|
31
|
+
*/
|
|
32
|
+
export type AllowedProps = PropsWithChildren<{
|
|
33
|
+
/** Permission to be checked. */
|
|
34
|
+
permission: Permission;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Component to check if the user has the permission to see the children.
|
|
38
|
+
* @param props: AllowedProps with the permission to be checked and the children to be rendered if the permission is granted.
|
|
39
|
+
* @returns The children if the permission is granted, otherwise nothing.
|
|
40
|
+
*/
|
|
41
|
+
export declare const Allowed: import("react").MemoExoticComponent<({ permission, children }: AllowedProps) => import("react/jsx-runtime").JSX.Element>;
|
|
42
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/auth/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAM3F,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM7D;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD;AACD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,KAAK,SAAS,GAAG,SAAS,CAE1F;AAED,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;AAC5D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;CAc5B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAGvD;AAQD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;IACzC,gCAAgC;IAChC,UAAU,EAAE,UAAU,CAAC;CAC1B,CAAC,CAAC;AACH;;;;GAIG;AACH,eAAO,MAAM,OAAO,iEAAmC,YAAY,6CAQjE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { Breakpoint } from '../_types';
|
|
3
|
+
type ColSpanType = number | string;
|
|
4
|
+
export type ColProps = Partial<Record<Breakpoint, ColSpanType>> & {
|
|
5
|
+
span?: ColSpanType;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Column component to be used in the Grid layout
|
|
9
|
+
* @param props
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function Col<TProps extends ColProps = ColProps>(props: TProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare namespace Col {
|
|
14
|
+
var component: ComponentType<ColProps>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Col/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnC,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG;IAC9D,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB,CAAA;AACD;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,2CAKpE;yBALe,GAAG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { OIUConfig, FillFn } from '../../utils/config';
|
|
3
|
+
export type ConfigLoaderProps<TRemoteConfig, TConfig extends OIUConfig> = PropsWithChildren<{
|
|
4
|
+
/** Optional CSS class name to apply to the Wait component wrapper */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Populate the local configuration from the remote configuration and return the OIUConfig */
|
|
7
|
+
fill: FillFn<TRemoteConfig, TConfig>;
|
|
8
|
+
/** Get reference to the local configuration to be populated */
|
|
9
|
+
getRef: () => TConfig;
|
|
10
|
+
/** Custom function to load the remote configuration, by default is taken from window.config */
|
|
11
|
+
customLoad?: () => Promise<TRemoteConfig>;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function invoked when the configuration has finished loading.
|
|
14
|
+
* @param firstTime Indicates if this is the first time the configuration is loaded.
|
|
15
|
+
*/
|
|
16
|
+
onLoad?: (firstTime: boolean) => void;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Load the configuration and once is fully loaded, render the children.
|
|
20
|
+
* @param param0
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function ConfigLoader<TRemoteConfig, TConfig extends OIUConfig>({ className, getRef, fill, customLoad, children, onLoad }: ConfigLoaderProps<TRemoteConfig, TConfig>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/ConfigLoader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAyB,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI9E,MAAM,MAAM,iBAAiB,CAAC,aAAa,EAAE,OAAO,SAAS,SAAS,IAAI,iBAAiB,CAAC;IACxF,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACrC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC,CAAC;AACH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,OAAO,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,2CA4B1K"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IntlShape } from 'react-intl';
|
|
2
|
+
import { ErrorStore } from '../../redux/slices/errorSlice';
|
|
3
|
+
export type ErrorCodeProps = {
|
|
4
|
+
code: number;
|
|
5
|
+
args?: unknown[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Return an error code text from the loaded errors in redux. This component asume the error are already loaded
|
|
9
|
+
* @param param0
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function ErrorCode({ code, args }: ErrorCodeProps): string;
|
|
13
|
+
export declare namespace ErrorCode {
|
|
14
|
+
var text: (_intl: IntlShape, code: number, errors: ErrorStore["errors"], ...args: unknown[]) => string | undefined;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/ErrorCode/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAiB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI1E,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AACF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,cAAc,UAQvD;yBARe,SAAS;sBAiBA,SAAS,QAAQ,MAAM,UAAU,UAAU,CAAC,QAAQ,CAAC,WAAW,OAAO,EAAE,KAAG,MAAM,GAAG,SAAS"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { IBadResModel } from '../../redux/slices/errorSlice';
|
|
3
|
+
export type ContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/** Antd form instance */
|
|
5
|
+
form?: FormInstance;
|
|
6
|
+
/** Indicate the error associated with every form field */
|
|
7
|
+
errors: IBadResModel;
|
|
8
|
+
};
|
|
9
|
+
export default function Content({ form, errors, ...html }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../lib/components/FormErrorSummary/Content.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,MAAM,CAAC;AAGjD,OAAO,EAAc,YAAY,EAAiB,MAAM,+BAA+B,CAAC;AAQxF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,yBAAyB;IACzB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0DAA0D;IAC1D,MAAM,EAAE,YAAY,CAAC;CACxB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,2CAoEtE"}
|