@bluealba/pae-ui-react-core 3.0.2-develop-1171
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/LICENSE +134 -0
- package/README.md +368 -0
- package/dist/index.cjs.js +252 -0
- package/dist/index.css +1 -0
- package/dist/index.esm.js +9741 -0
- package/dist/index.systemjs.js +253 -0
- package/dist/index.umd.js +253 -0
- package/dist/src/MicrofrontendProps.d.ts +9 -0
- package/dist/src/components/ApplicationIcon.d.ts +7 -0
- package/dist/src/components/Authorized.d.ts +12 -0
- package/dist/src/components/ExtendExtensionPoint.d.ts +20 -0
- package/dist/src/components/ExtensionPoint.d.ts +39 -0
- package/dist/src/components/ModulePlaceHolder/BaseContainer.d.ts +4 -0
- package/dist/src/components/ModulePlaceHolder/BaseError.d.ts +7 -0
- package/dist/src/components/ModulePlaceHolder/BaseLoading.d.ts +7 -0
- package/dist/src/components/ModulePlaceHolder/ModulePlaceHolder.d.ts +22 -0
- package/dist/src/components/ModulePlaceHolder/index.d.ts +2 -0
- package/dist/src/components/PAEModule.d.ts +18 -0
- package/dist/src/components/PlatformEventListener.d.ts +12 -0
- package/dist/src/components/common/Alert/Alert.d.ts +16 -0
- package/dist/src/components/common/Alert/index.d.ts +2 -0
- package/dist/src/components/common/Badge/Badge.d.ts +9 -0
- package/dist/src/components/common/Badge/Badge.stories.d.ts +20 -0
- package/dist/src/components/common/Badge/Badges.d.ts +6 -0
- package/dist/src/components/common/Button/Button.d.ts +10 -0
- package/dist/src/components/common/Button/Button.stories.d.ts +45 -0
- package/dist/src/components/common/ConfirmDialog/ConfirmDialog.d.ts +11 -0
- package/dist/src/components/common/ConfirmDialog/ConfirmDialog.stories.d.ts +14 -0
- package/dist/src/components/common/CopyToClipboardButton/CopyToClipboardButton.d.ts +7 -0
- package/dist/src/components/common/CopyToClipboardButton/CopyToClipboardButton.stories.d.ts +15 -0
- package/dist/src/components/common/Dialog/Dialog.d.ts +26 -0
- package/dist/src/components/common/Dialog/Dialog.stories.d.ts +14 -0
- package/dist/src/components/common/Dialog/index.d.ts +2 -0
- package/dist/src/components/common/Dialog/subComponents/Actions.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Close.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Content.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Description.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Footer.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Header.d.ts +6 -0
- package/dist/src/components/common/Dialog/subComponents/Title.d.ts +6 -0
- package/dist/src/components/common/DropdownList/DropdownList.d.ts +8 -0
- package/dist/src/components/common/DropdownList/index.d.ts +3 -0
- package/dist/src/components/common/EmptyState/EmptyState.d.ts +7 -0
- package/dist/src/components/common/EmptyState/EmptyState.stories.d.ts +16 -0
- package/dist/src/components/common/EmptyState/EmptyStateIcon.d.ts +7 -0
- package/dist/src/components/common/ErrorState/ErrorState.d.ts +9 -0
- package/dist/src/components/common/ErrorState/ErrorState.stories.d.ts +11 -0
- package/dist/src/components/common/ErrorState/WarningIcon.d.ts +6 -0
- package/dist/src/components/common/ErrorState/index.d.ts +2 -0
- package/dist/src/components/common/FieldGroup/FieldGroup.d.ts +7 -0
- package/dist/src/components/common/Icon/ArrowDown.d.ts +7 -0
- package/dist/src/components/common/Icon/ChevronLeft.d.ts +7 -0
- package/dist/src/components/common/Icon/ChevronRight.d.ts +7 -0
- package/dist/src/components/common/Icon/ClipboardCheckIcon.d.ts +13 -0
- package/dist/src/components/common/Icon/ClipboardIcon.d.ts +14 -0
- package/dist/src/components/common/Icon/EyeIcon.d.ts +13 -0
- package/dist/src/components/common/Icon/HorizontalDots.d.ts +7 -0
- package/dist/src/components/common/Input/Input.d.ts +7 -0
- package/dist/src/components/common/Input/Input.stories.d.ts +23 -0
- package/dist/src/components/common/InputError/InputError.d.ts +6 -0
- package/dist/src/components/common/Label/Label.d.ts +7 -0
- package/dist/src/components/common/List/List.d.ts +26 -0
- package/dist/src/components/common/List/List.stories.d.ts +27 -0
- package/dist/src/components/common/List/index.d.ts +2 -0
- package/dist/src/components/common/List/subComponents/Action.d.ts +6 -0
- package/dist/src/components/common/List/subComponents/Actions.d.ts +6 -0
- package/dist/src/components/common/List/subComponents/Description.d.ts +6 -0
- package/dist/src/components/common/List/subComponents/Icon.d.ts +6 -0
- package/dist/src/components/common/List/subComponents/Item.d.ts +8 -0
- package/dist/src/components/common/List/subComponents/Title.d.ts +6 -0
- package/dist/src/components/common/Pagination/Pagination.d.ts +31 -0
- package/dist/src/components/common/PasswordInput/PasswordInput.d.ts +8 -0
- package/dist/src/components/common/PasswordInput/PasswordInput.stories.d.ts +20 -0
- package/dist/src/components/common/Pill/Pill.d.ts +8 -0
- package/dist/src/components/common/Pill/Pill.stories.d.ts +26 -0
- package/dist/src/components/common/PluralizeCounter/PluralizeCounter.d.ts +9 -0
- package/dist/src/components/common/PluralizeCounter/PluralizeCounter.stories.d.ts +14 -0
- package/dist/src/components/common/SearchAutocomplete/AutocompleteHighlighter.d.ts +8 -0
- package/dist/src/components/common/SearchAutocomplete/AutocompleteItem.d.ts +7 -0
- package/dist/src/components/common/SearchAutocomplete/SearchAutocomplete.d.ts +27 -0
- package/dist/src/components/common/SearchAutocomplete/SearchAutocomplete.stories.d.ts +51 -0
- package/dist/src/components/common/SearchAutocomplete/hooks/useAutocomplete.d.ts +13 -0
- package/dist/src/components/common/SearchAutocomplete/types.d.ts +12 -0
- package/dist/src/components/common/SearchInput/SearchInput.d.ts +9 -0
- package/dist/src/components/common/SearchInput/SearchInput.stories.d.ts +30 -0
- package/dist/src/components/common/Select/Option.d.ts +6 -0
- package/dist/src/components/common/Select/Select.d.ts +13 -0
- package/dist/src/components/common/Select/Select.stories.d.ts +20 -0
- package/dist/src/components/common/Show/Show.d.ts +32 -0
- package/dist/src/components/common/Skeleton/Skeleton.d.ts +11 -0
- package/dist/src/components/common/Skeleton/Skeleton.stories.d.ts +11 -0
- package/dist/src/components/common/Skeleton/SkeletonList.d.ts +10 -0
- package/dist/src/components/common/Skeleton/SkeletonList.stories.d.ts +11 -0
- package/dist/src/components/common/Spinner/Spinner.d.ts +10 -0
- package/dist/src/components/common/Spinner/Spinner.stories.d.ts +11 -0
- package/dist/src/components/common/Switch/Switch.d.ts +15 -0
- package/dist/src/components/common/Switch/Switch.stories.d.ts +8 -0
- package/dist/src/components/common/Table/Table.d.ts +43 -0
- package/dist/src/components/common/Table/Table.stories.d.ts +65 -0
- package/dist/src/components/common/Table/TablePagination.d.ts +9 -0
- package/dist/src/components/common/Table/generatePagination.d.ts +1 -0
- package/dist/src/components/common/Table/table.test.d.ts +1 -0
- package/dist/src/components/common/Tabs/Tabs.d.ts +30 -0
- package/dist/src/components/common/TextArea/TextArea.d.ts +6 -0
- package/dist/src/components/common/TextArea/TextArea.stories.d.ts +17 -0
- package/dist/src/components/common/Tooltip/Tooltip.d.ts +15 -0
- package/dist/src/components/common/Tooltip/Tooltip.stories.d.ts +35 -0
- package/dist/src/components/common/index.d.ts +58 -0
- package/dist/src/components/index.d.ts +6 -0
- package/dist/src/constants/index.d.ts +5 -0
- package/dist/src/core/PlatformEvents.d.ts +13 -0
- package/dist/src/core/gateway/GatewayHttpHeaders.d.ts +10 -0
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/getGlobalState.d.ts +1 -0
- package/dist/src/hocs/authorized.d.ts +4 -0
- package/dist/src/hocs/extensionPoint.d.ts +17 -0
- package/dist/src/hocs/index.d.ts +2 -0
- package/dist/src/hooks/applications/ApplicationMenu.d.ts +18 -0
- package/dist/src/hooks/applications/PlatformApplication.d.ts +10 -0
- package/dist/src/hooks/applications/useApplicationIcon.d.ts +4 -0
- package/dist/src/hooks/applications/useApplicationJSModule.d.ts +18 -0
- package/dist/src/hooks/applications/useApplicationMenu.d.ts +11 -0
- package/dist/src/hooks/applications/useApplicationUIModule.d.ts +4 -0
- package/dist/src/hooks/applications/useApplications.d.ts +4 -0
- package/dist/src/hooks/applications/useCurrentApplication.d.ts +8 -0
- package/dist/src/hooks/applications/useCurrentApplication.test.d.ts +1 -0
- package/dist/src/hooks/applications/useCurrentApplicationName.d.ts +6 -0
- package/dist/src/hooks/applications/useCurrentJSModule.d.ts +9 -0
- package/dist/src/hooks/catalog/useCatalog.d.ts +14 -0
- package/dist/src/hooks/catalog/useMutableCatalog.d.ts +28 -0
- package/dist/src/hooks/catalog/userCatalog.test.d.ts +1 -0
- package/dist/src/hooks/commons/useObservable.d.ts +8 -0
- package/dist/src/hooks/commons/useResource.d.ts +21 -0
- package/dist/src/hooks/commons/useResourceActions.d.ts +56 -0
- package/dist/src/hooks/commons/useSubjectObservable.d.ts +11 -0
- package/dist/src/hooks/customizations/useDynamicFonts.d.ts +13 -0
- package/dist/src/hooks/customizations/useDynamicStyleSheet.d.ts +1 -0
- package/dist/src/hooks/customizations/useGetPlatformTheme.d.ts +3 -0
- package/dist/src/hooks/customizations/usePAECustomizationsLoadingState.d.ts +2 -0
- package/dist/src/hooks/customizations/usePlatformCustomization.d.ts +8 -0
- package/dist/src/hooks/customizations/utils.d.ts +2 -0
- package/dist/src/hooks/events/usePlatformEventListener.d.ts +2 -0
- package/dist/src/hooks/extensions/useExtendExtensionPoint.d.ts +11 -0
- package/dist/src/hooks/extensions/useExtensionPoint.d.ts +16 -0
- package/dist/src/hooks/habits/ApplicationEvent.d.ts +4 -0
- package/dist/src/hooks/habits/mapEvent.d.ts +17 -0
- package/dist/src/hooks/habits/trackEvents.d.ts +9 -0
- package/dist/src/hooks/habits/useTrackEvent.d.ts +5 -0
- package/dist/src/hooks/habits/useTrackEvents.d.ts +9 -0
- package/dist/src/hooks/habits/useTrackEvents.test.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +42 -0
- package/dist/src/hooks/module/useModule.d.ts +6 -0
- package/dist/src/hooks/module/useModuleCommonPaths.d.ts +9 -0
- package/dist/src/hooks/module/useModuleConfig.d.ts +5 -0
- package/dist/src/hooks/module/useModuleConfigByName.d.ts +5 -0
- package/dist/src/hooks/module/useModuleMetadata.d.ts +8 -0
- package/dist/src/hooks/routing/useLocation.d.ts +7 -0
- package/dist/src/hooks/tenants/constants.d.ts +21 -0
- package/dist/src/hooks/tenants/getClientTenantStrategy.d.ts +4 -0
- package/dist/src/hooks/tenants/strategies/cookie.d.ts +7 -0
- package/dist/src/hooks/tenants/strategies/queryParams.d.ts +7 -0
- package/dist/src/hooks/tenants/strategies/sessionStorage.d.ts +7 -0
- package/dist/src/hooks/tenants/strategies/subdomain.d.ts +9 -0
- package/dist/src/hooks/tenants/strategies/tenantStrategy.interface.d.ts +6 -0
- package/dist/src/hooks/tenants/useTenants.d.ts +8 -0
- package/dist/src/hooks/useAppStatus.d.ts +6 -0
- package/dist/src/hooks/useAppsState.d.ts +18 -0
- package/dist/src/hooks/useAuth.d.ts +14 -0
- package/dist/src/hooks/useAuth.test.d.ts +1 -0
- package/dist/src/hooks/useHasNoSession.d.ts +2 -0
- package/dist/src/hooks/useNotifications.d.ts +4 -0
- package/dist/src/hooks/useOperations.d.ts +1 -0
- package/dist/src/hooks/usePAEState.d.ts +7 -0
- package/dist/src/hooks/useServiceBaseURL.d.ts +6 -0
- package/dist/src/hooks/useServiceInvoker.d.ts +20 -0
- package/dist/src/hooks/useServiceInvoker.test.d.ts +1 -0
- package/dist/src/hooks/useUIApplications.d.ts +5 -0
- package/dist/src/hooks/userState/UserState.d.ts +7 -0
- package/dist/src/hooks/userState/UserStateApiClient.d.ts +9 -0
- package/dist/src/hooks/userState/useUserState.d.ts +24 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/model/ModuleMetadata.d.ts +6 -0
- package/dist/src/test-utils/setupTestEnvironment.d.ts +15 -0
- package/dist/src/types.d.ts +37 -0
- package/dist/src/utils/Request.d.ts +7 -0
- package/dist/src/utils/URL.d.ts +6 -0
- package/dist/src/utils/alphaColor.d.ts +1 -0
- package/dist/src/utils/createRootComponent.d.ts +9 -0
- package/dist/src/utils/fonts.d.ts +5 -0
- package/dist/src/utils/getApplicationUIModule.d.ts +10 -0
- package/dist/src/utils/getApplications.d.ts +4 -0
- package/dist/src/utils/getOperations.d.ts +5 -0
- package/dist/src/utils/hasAccess.d.ts +8 -0
- package/dist/src/utils/immutable.d.ts +18 -0
- package/dist/src/utils/index.d.ts +18 -0
- package/dist/src/utils/initializeMicroFrontend.d.ts +17 -0
- package/dist/src/utils/isValidEmail.d.ts +1 -0
- package/dist/src/utils/isValidEmail.test.d.ts +1 -0
- package/dist/src/utils/logout.d.ts +1 -0
- package/dist/src/utils/logout.test.d.ts +1 -0
- package/dist/src/utils/navigateTo.d.ts +1 -0
- package/dist/src/utils/promises.d.ts +4 -0
- package/dist/tests/renderHookWithProviders.d.ts +3 -0
- package/dist/tests/testUtils.d.ts +7 -0
- package/package.json +61 -0
- package/src/global.css +32 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDynamicStyleSheet: (styleSheet?: string) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook used by micro-frontend modules that want to "extend" an extension point defined by another MF module.
|
|
3
|
+
* For example to replace a React Component from the shell like the applications selector menu you would the following
|
|
4
|
+
*
|
|
5
|
+
* useExtendExtensionPoint('@bluealba/pae-shell-ui', 'ApplicationSelector', MyComponent)
|
|
6
|
+
*
|
|
7
|
+
* Where the first parameter is the name of the source module you want to extend.
|
|
8
|
+
* The second parameter
|
|
9
|
+
*/
|
|
10
|
+
export declare const useExtendExtensionPoint: <T>(moduleName: string, extensionPointName: string, value: T) => void;
|
|
11
|
+
export default useExtendExtensionPoint;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ElementType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The value of this extension point is either
|
|
5
|
+
* - ElementType: a react component (functional or class)
|
|
6
|
+
* - ReactElement: a straight react virtual DOM in case you are plugin a children prop directly.
|
|
7
|
+
*/
|
|
8
|
+
type ExtensionPointValueType = ElementType | Exclude<ReactNode, undefined | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves an extension point to any actual extension that might have been defined by another
|
|
11
|
+
* micro-frontend.
|
|
12
|
+
*
|
|
13
|
+
* This is one of the React APIs to the core pure JS PAE API @ExtensionPointsRegistry.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useExtensionPoint: (extensionPointName: string) => ExtensionPointValueType | null;
|
|
16
|
+
export default useExtensionPoint;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModuleMetadata, AuthUserWithApplications } from '@bluealba/pae-core';
|
|
2
|
+
import { ApplicationEvent } from './ApplicationEvent';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Map an ApplicationEvent to a Habits expected Event input body.
|
|
6
|
+
* It full-fills all the contextual data (user, module, app)
|
|
7
|
+
*/
|
|
8
|
+
declare const mapEvent: (user: AuthUserWithApplications, module: ModuleMetadata) => (event: ApplicationEvent) => {
|
|
9
|
+
name: string;
|
|
10
|
+
data?: object;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
module: string;
|
|
13
|
+
moduleVersion: string | undefined;
|
|
14
|
+
application: string | undefined;
|
|
15
|
+
user: string;
|
|
16
|
+
};
|
|
17
|
+
export default mapEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModuleMetadata, AuthUserWithApplications } from '@bluealba/pae-core';
|
|
2
|
+
import { ServiceInvoker } from '../useServiceInvoker';
|
|
3
|
+
import { ApplicationEvent } from './ApplicationEvent';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Posts an array of application events to be tracked by PAE (habits).
|
|
7
|
+
*/
|
|
8
|
+
declare const trackEvents: (invoker: ServiceInvoker, user: AuthUserWithApplications, module: ModuleMetadata) => (events: ApplicationEvent[]) => Promise<void>;
|
|
9
|
+
export default trackEvents;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const HABITS_SERVICE_NAME = "@bluealba/pae-habits-service";
|
|
2
|
+
/**
|
|
3
|
+
* Provides a function to publish PAE Habit ApplicationEvent's from the current module.
|
|
4
|
+
* If the module is associated with a PAE Application then it will be emitting application events.
|
|
5
|
+
* Otherwise they will be global events.
|
|
6
|
+
* This allows to publish many events in a single call. It is the most basic form of the hook.
|
|
7
|
+
* If you want a shortcut to publish a single event the use `useTrackEvent()` instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTrackEvents: () => (events: import('./ApplicationEvent').ApplicationEvent[]) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { usePAEState } from './usePAEState';
|
|
2
|
+
export { useCatalog } from './catalog/useCatalog';
|
|
3
|
+
export { useMutableCatalog } from './catalog/useMutableCatalog';
|
|
4
|
+
export { useLocation } from './routing/useLocation';
|
|
5
|
+
export { useHasNoSession } from './useHasNoSession';
|
|
6
|
+
export { useModuleMetadata } from './module/useModuleMetadata';
|
|
7
|
+
export { useModuleConfig } from './module/useModuleConfig';
|
|
8
|
+
export { useModule } from './module/useModule';
|
|
9
|
+
export { useModuleConfigByName } from './module/useModuleConfigByName';
|
|
10
|
+
export { useModuleCommonPaths } from './module/useModuleCommonPaths';
|
|
11
|
+
export { useApplications } from './applications/useApplications';
|
|
12
|
+
export { useUIApplications } from './useUIApplications';
|
|
13
|
+
export { useApplicationUIModule } from './applications/useApplicationUIModule';
|
|
14
|
+
export { useApplicationIcon } from './applications/useApplicationIcon';
|
|
15
|
+
export { useApplicationMenu } from './applications/useApplicationMenu';
|
|
16
|
+
export { useCurrentApplicationName } from './applications/useCurrentApplicationName';
|
|
17
|
+
export { useApplicationJSModule } from './applications/useApplicationJSModule';
|
|
18
|
+
export { useCurrentApplication } from './applications/useCurrentApplication';
|
|
19
|
+
export { useCurrentJSModule } from './applications/useCurrentJSModule';
|
|
20
|
+
export { type ApplicationMenu, type ApplicationMenuItem } from './applications/ApplicationMenu';
|
|
21
|
+
export { type PlatformApplication } from './applications/PlatformApplication';
|
|
22
|
+
export { useAuth } from './useAuth';
|
|
23
|
+
export { useOperations } from './useOperations';
|
|
24
|
+
export { useServiceInvoker, type ServiceInvoker } from './useServiceInvoker';
|
|
25
|
+
export { useServiceBaseURL } from './useServiceBaseURL';
|
|
26
|
+
export { useTrackEvent } from './habits/useTrackEvent';
|
|
27
|
+
export { useTrackEvents } from './habits/useTrackEvents';
|
|
28
|
+
export { type ApplicationEvent } from './habits/ApplicationEvent';
|
|
29
|
+
export { useExtensionPoint } from './extensions/useExtensionPoint';
|
|
30
|
+
export { useExtendExtensionPoint } from './extensions/useExtendExtensionPoint';
|
|
31
|
+
export { usePlatformEventListener } from './events/usePlatformEventListener';
|
|
32
|
+
export { useDynamicStyleSheet } from './customizations/useDynamicStyleSheet';
|
|
33
|
+
export { useDynamicFonts } from './customizations/useDynamicFonts';
|
|
34
|
+
export { usePlatformCustomization } from './customizations/usePlatformCustomization';
|
|
35
|
+
export { usePAECustomizationsLoadingState } from './customizations/usePAECustomizationsLoadingState';
|
|
36
|
+
export { useGetPlatformTheme } from './customizations/useGetPlatformTheme';
|
|
37
|
+
export * from './customizations/utils';
|
|
38
|
+
export { useNotifications } from './useNotifications';
|
|
39
|
+
export { useResourceActions } from './commons/useResourceActions';
|
|
40
|
+
export { useResource } from './commons/useResource';
|
|
41
|
+
export { useTenants } from './tenants/useTenants';
|
|
42
|
+
export { useUserState } from './userState/useUserState';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModuleMetadata } from '@bluealba/pae-core';
|
|
2
|
+
|
|
3
|
+
export type UrlType = 'only-base-path' | 'with-module-base' | 'full-path';
|
|
4
|
+
export declare const useModuleCommonPaths: (module: ModuleMetadata, type?: UrlType) => {
|
|
5
|
+
apiDocsPath: string | undefined;
|
|
6
|
+
healthPath: string | undefined;
|
|
7
|
+
versionPath: string | undefined;
|
|
8
|
+
changelogPath: string | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleMetadata } from '@bluealba/pae-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides access to the current module's metadata from the catalog.
|
|
5
|
+
* This is based on PAE microfrontend's context.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useModuleMetadata: () => ModuleMetadata;
|
|
8
|
+
export default useModuleMetadata;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TenantClientSideMode, TenantConfig, TenantMode } from '@bluealba/pae-core';
|
|
2
|
+
|
|
3
|
+
export declare const TENANT_MODES: {
|
|
4
|
+
readonly SINGLE_TENANT: "single-tenant";
|
|
5
|
+
readonly MULTI_TENANT: "multi-tenant";
|
|
6
|
+
};
|
|
7
|
+
export declare const CLIENT_SIDE_TENANT_MODES: {
|
|
8
|
+
readonly QUERY_PARAM: "queryParams";
|
|
9
|
+
readonly SESSION_STORAGE: "sessionStorage";
|
|
10
|
+
readonly COOKIE: "cookie";
|
|
11
|
+
};
|
|
12
|
+
export declare const TENANT_VISIBILITY: {
|
|
13
|
+
readonly RESTRICTED: "restricted";
|
|
14
|
+
readonly OPEN: "open";
|
|
15
|
+
};
|
|
16
|
+
export declare const TENANT_REQUEST_COOKIE_KEY = "tenant";
|
|
17
|
+
export declare const TENANT_REQUEST_QUERY_KEY = "tenant";
|
|
18
|
+
export declare const TENANT_SESSION_STORAGE_KEY = "tenant";
|
|
19
|
+
export declare const DEFAULT_TENANT_MODE: TenantMode;
|
|
20
|
+
export declare const DEFAULT_CLIENT_SIDE_TENANT_MODE: TenantClientSideMode;
|
|
21
|
+
export declare const DEFAULT_TENANT_CONFIG: TenantConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TenantStrategy } from './tenantStrategy.interface';
|
|
2
|
+
import { Tenant, TenantConfig } from '@bluealba/pae-core';
|
|
3
|
+
|
|
4
|
+
export declare class CookieStrategy implements TenantStrategy {
|
|
5
|
+
setTenant(tenant: Tenant, tenantConfig: TenantConfig): void;
|
|
6
|
+
getCurrentTenantName(): string | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tenant, TenantConfig } from '@bluealba/pae-core';
|
|
2
|
+
import { TenantStrategy } from './tenantStrategy.interface';
|
|
3
|
+
|
|
4
|
+
export declare class QueryParamStrategy implements TenantStrategy {
|
|
5
|
+
setTenant(tenant: Tenant, tenantConfig: TenantConfig): void;
|
|
6
|
+
getCurrentTenantName(): string | null;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tenant, TenantConfig } from '@bluealba/pae-core';
|
|
2
|
+
import { TenantStrategy } from './tenantStrategy.interface';
|
|
3
|
+
|
|
4
|
+
export declare class SessionStorageStrategy implements TenantStrategy {
|
|
5
|
+
setTenant(tenant: Tenant, tenantConfig: TenantConfig): void;
|
|
6
|
+
getCurrentTenantName(): string | null;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tenant, TenantConfig } from '@bluealba/pae-core';
|
|
2
|
+
import { TenantStrategy } from './tenantStrategy.interface';
|
|
3
|
+
|
|
4
|
+
export declare class SubdomainStrategy implements TenantStrategy {
|
|
5
|
+
private extractSubdomain;
|
|
6
|
+
private getBaseDomain;
|
|
7
|
+
setTenant(tenant: Tenant, tenantConfig: TenantConfig): void;
|
|
8
|
+
getCurrentTenantName(): string | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function useAppStatus(appName: string): {
|
|
2
|
+
statusName: "NOT_LOADED" | "LOADING_SOURCE_CODE" | "NOT_BOOTSTRAPPED" | "BOOTSTRAPPING" | "NOT_MOUNTED" | "MOUNTING" | "MOUNTED" | "UNMOUNTING" | "UNLOADING" | "SKIP_BECAUSE_BROKEN" | "LOAD_ERROR";
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
isMounted: boolean;
|
|
5
|
+
isBroken: boolean;
|
|
6
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
- NOT_LOADED: app has been registered with single-spa but has not yet been loaded.
|
|
3
|
+
- LOADING_SOURCE_CODE: app's source code is being fetched.
|
|
4
|
+
- NOT_BOOTSTRAPPED: app has been loaded but not bootstrapped.
|
|
5
|
+
- BOOTSTRAPPING: the bootstrap lifecycle function has been called but has not finished.
|
|
6
|
+
- NOT_MOUNTED: app has been loaded and bootstrapped but not yet mounted.
|
|
7
|
+
- MOUNTING: app is being mounted but not finished.
|
|
8
|
+
- MOUNTED: app is currently active and is mounted to the DOM.
|
|
9
|
+
- UNMOUNTING: app is currently being unmounted but has not finished.
|
|
10
|
+
- UNLOADING: app is currently being unloaded but has not finished.
|
|
11
|
+
- SKIP_BECAUSE_BROKEN: app threw an error during load, bootstrap, mount, or unmount and has been siloed because it is misbehaving and has been skipped. Other apps will continue on normally.
|
|
12
|
+
- LOAD_ERROR: The app's loading function returned a promise that rejected. This is often due to a network error attempting to download the JavaScript bundle for the application. Single-spa will retry loading the application after the user navigates away from the current route and then comes back to it.
|
|
13
|
+
*/
|
|
14
|
+
type AppStatus = 'NOT_LOADED' | 'LOADING_SOURCE_CODE' | 'NOT_BOOTSTRAPPED' | 'BOOTSTRAPPING' | 'NOT_MOUNTED' | 'MOUNTING' | 'MOUNTED' | 'UNMOUNTING' | 'UNLOADING' | 'SKIP_BECAUSE_BROKEN' | 'LOAD_ERROR';
|
|
15
|
+
interface AppsState extends Record<string, AppStatus> {
|
|
16
|
+
}
|
|
17
|
+
export declare function useAppsState(): AppsState;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to provide authentication and authorization information.
|
|
3
|
+
*
|
|
4
|
+
* @returns An object containing:
|
|
5
|
+
* - `authUser`: The currently authenticated user.
|
|
6
|
+
* - `hasAccess`: A memoized function indicating access permissions based on authorized operations.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This hook relies on `usePAEState` to retrieve the authenticated user and `useOperations` to determine authorized operations.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useAuth: () => {
|
|
12
|
+
authUser: import('@bluealba/pae-core').AuthUserWithApplications;
|
|
13
|
+
hasAccess: (...operations: string[]) => boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useOperations: () => import('@bluealba/pae-core').Operation[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type RequestInit = Parameters<typeof fetch>[1];
|
|
2
|
+
export type ServiceInvoker = (path: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that can be used to call a PAE service endpoint.
|
|
5
|
+
* It is (almost) fully compatible with the Fetch function.
|
|
6
|
+
* The only difference is that you don't need to provide the service's base path. Just any following path.
|
|
7
|
+
* For example instead of doing this
|
|
8
|
+
*
|
|
9
|
+
* fetch('/my-service/items', { ... })
|
|
10
|
+
*
|
|
11
|
+
* You just need to do
|
|
12
|
+
*
|
|
13
|
+
* invoker('/items', { ... })
|
|
14
|
+
*
|
|
15
|
+
* This abstracts the caller from knowing the base path of the service and instead we refer to services
|
|
16
|
+
* through their names. Since the baseURL is a gateway/routing configuration which might be dynamically
|
|
17
|
+
* changed in PAE Applications Catalog.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useServiceInvoker: (serviceName: string, serviceBaseUrl?: string) => ServiceInvoker;
|
|
20
|
+
export default useServiceInvoker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ServiceInvoker } from '../useServiceInvoker';
|
|
2
|
+
import { UserState } from './UserState';
|
|
3
|
+
|
|
4
|
+
export declare class UserStateApiClient {
|
|
5
|
+
static get<T extends UserState>(invoker: ServiceInvoker, application: string, name: string): Promise<T | null>;
|
|
6
|
+
static create<T extends UserState>(invoker: ServiceInvoker, application: string, name: string, value: T["value"]): Promise<T>;
|
|
7
|
+
static update<T extends UserState>(invoker: ServiceInvoker, application: string, name: string, value: T["value"]): Promise<T>;
|
|
8
|
+
static delete(invoker: ServiceInvoker, application: string, name: string): Promise<null>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type UserStateOperationParams<T> = {
|
|
2
|
+
newValue?: T;
|
|
3
|
+
shouldThrowError?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type UserStateHook<T> = {
|
|
6
|
+
value: T | null;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: null;
|
|
9
|
+
hasFetched: boolean;
|
|
10
|
+
setValue: (newValue: T, shouldThrowError?: boolean) => Promise<T | null>;
|
|
11
|
+
createValue: (params?: UserStateOperationParams<T>) => Promise<T | null>;
|
|
12
|
+
updateValue: (params?: UserStateOperationParams<T>) => Promise<T | null>;
|
|
13
|
+
deleteValue: (params?: Pick<UserStateOperationParams<T>, "shouldThrowError">) => Promise<T | null>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Provides UserState management with automatic persistence.
|
|
17
|
+
*
|
|
18
|
+
* **Primary Usage**: This hook exposes `value` and `setValue` properties that just works like `useState`,
|
|
19
|
+
* but automatically persist changes to the UserState server-side, handling all API calls behind the scenes.
|
|
20
|
+
*
|
|
21
|
+
* **Secondary Usage**: For advanced scenarios, explicit CRUD methods (`createValue`, `updateValue`,
|
|
22
|
+
* `deleteValue`) are available when you need precise control over which API operation to perform.
|
|
23
|
+
*/
|
|
24
|
+
export declare const useUserState: <T>(name: string) => UserStateHook<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
export type { ModuleMetadata, AuthUser, AuthUserWithApplications, BaseUser } from '@bluealba/pae-core';
|
|
3
|
+
export * from './core';
|
|
4
|
+
export * from './hooks';
|
|
5
|
+
export * from './hocs';
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './components';
|
|
8
|
+
export * from './components/common';
|
|
9
|
+
export { default as initializeMicroFrontend } from './utils/initializeMicroFrontend';
|
|
10
|
+
export * from './MicrofrontendProps';
|
|
11
|
+
export { setupTestEnvironment } from './test-utils/setupTestEnvironment';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModuleMetadata } from '@bluealba/pae-core';
|
|
2
|
+
import { PlatformApplication } from '../hooks';
|
|
3
|
+
|
|
4
|
+
export declare const isUIModule: (module: ModuleMetadata) => boolean;
|
|
5
|
+
export declare const isShellUIModule: (module: ModuleMetadata) => boolean;
|
|
6
|
+
export declare const isUIApplication: (app: PlatformApplication) => boolean | "" | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getGlobalState } from '../getGlobalState';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Recursively make all properties of T optional
|
|
5
|
+
* https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript
|
|
6
|
+
*/
|
|
7
|
+
type RecursivePartial<T> = {
|
|
8
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
|
|
9
|
+
};
|
|
10
|
+
interface GlobalState extends ReturnType<typeof getGlobalState> {
|
|
11
|
+
}
|
|
12
|
+
interface GlobalStateOverrides extends RecursivePartial<GlobalState> {
|
|
13
|
+
}
|
|
14
|
+
export declare const setupTestEnvironment: (overrides?: GlobalStateOverrides) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// TODO: these types are repeated between pae-ui-react-core and orchestrator's main.ts
|
|
2
|
+
|
|
3
|
+
import { BehaviorSubject, Subject } from "rxjs";
|
|
4
|
+
import type {
|
|
5
|
+
AuthUserWithApplications,
|
|
6
|
+
ModuleMetadata,
|
|
7
|
+
ExtensionPointsRegistry,
|
|
8
|
+
AuthenticationConfig,
|
|
9
|
+
Tenant,
|
|
10
|
+
TenantConfig,
|
|
11
|
+
} from '@bluealba/pae-core';
|
|
12
|
+
|
|
13
|
+
import { EXTENSION_POINTS_REGISTRY, GLOBAL_REACTIVE_STATE_KEY, PAE_CUSTOMIZATIONS_LOADING_STATE_KEY, PAE_GLOBAL_STATE_KEY } from './constants';
|
|
14
|
+
|
|
15
|
+
export type PAEReactiveState = Subject<PAEState>;
|
|
16
|
+
|
|
17
|
+
export type PAEState = {
|
|
18
|
+
authUser: AuthUserWithApplications;
|
|
19
|
+
catalog: ModuleMetadata[];
|
|
20
|
+
authentication: AuthenticationConfig;
|
|
21
|
+
tenants?: Tenant[];
|
|
22
|
+
currentTenant?: Tenant;
|
|
23
|
+
tenantConfig?: TenantConfig;
|
|
24
|
+
platformVersion: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type PAECustomizationsLoadingState = BehaviorSubject<boolean | undefined>;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
declare global {
|
|
31
|
+
interface Window {
|
|
32
|
+
[PAE_GLOBAL_STATE_KEY]: PAEState;
|
|
33
|
+
[GLOBAL_REACTIVE_STATE_KEY]: PAEReactiveState;
|
|
34
|
+
[EXTENSION_POINTS_REGISTRY]: ExtensionPointsRegistry;
|
|
35
|
+
[PAE_CUSTOMIZATIONS_LOADING_STATE_KEY]: PAECustomizationsLoadingState;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new RequestInit which contains the original data + the given headers appended.
|
|
3
|
+
* Pure function
|
|
4
|
+
*/
|
|
5
|
+
export declare const appendHeadersToRequestInit: (init: RequestInit, headersToAppend: Record<string, string>) => RequestInit;
|
|
6
|
+
export declare const appendHeaderToHeadersInit: (headers: HeadersInit, headersToAppend: Record<string, string>) => HeadersInit;
|
|
7
|
+
export declare const isHeadersObjectInstance: (headers: HeadersInit) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const alphaColor: (color: string, alpha: number) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RootComponentProps } from '../MicrofrontendProps';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates the root component. Wrapping the MF's root component with a PAEModule
|
|
6
|
+
* in charge of setting the context for the module.
|
|
7
|
+
*/
|
|
8
|
+
declare const createRootComponent: <T extends RootComponentProps>(BaseRootComponent: FC<T>) => (props: T) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default createRootComponent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModuleMetadata } from '@bluealba/pae-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns UI module of a particular application
|
|
5
|
+
*/
|
|
6
|
+
export declare const getApplicationUIModule: (applicationName: string) => ModuleMetadata | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Returns UI module from a list of modules
|
|
9
|
+
*/
|
|
10
|
+
export declare const getUIModule: (modules?: ModuleMetadata[]) => ModuleMetadata | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Operation } from '@bluealba/pae-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Given a list of user authorized (allowed) operations it returns a new function
|
|
5
|
+
* that can be used to check for operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare const hasAccess: (authorizedOperations: Operation[]) => (...operations: string[]) => boolean;
|
|
8
|
+
export default hasAccess;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Updater<T> = ((current: T) => T);
|
|
2
|
+
export type SetOrUpdateParam<T> = T | Updater<T>;
|
|
3
|
+
export type SetOrUpdateFn<T> = (valueOfUpdater: SetOrUpdateParam<T>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Given an index and a transforming function it updates the given list/array by changing
|
|
6
|
+
* the element at that position with the transformation function. Returning a new list.
|
|
7
|
+
* See https://ramdajs.com/docs/#adjust for reference
|
|
8
|
+
*/
|
|
9
|
+
export declare const adjust: <T>(index: number, mapper: (e: T) => T, list: T[]) => T[];
|
|
10
|
+
/**
|
|
11
|
+
* NEW
|
|
12
|
+
* similar to adjust but instead of passing and index you pass a predicate to find the element to update
|
|
13
|
+
*/
|
|
14
|
+
export declare const adjustOne: <T>(pred: (e: T) => boolean, mapper: (e: T) => T, list: T[]) => T[];
|
|
15
|
+
/**
|
|
16
|
+
* Useful to implement setters that either receive a value or a transform function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getOrCompute: <T>(valueOrFn: SetOrUpdateParam<T>, current: T) => T;
|