@entur-partner/micro-frontend 2.6.2-alpha.0 → 2.6.2-alpha.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.
@@ -1,24 +1,24 @@
1
- import type { Permission } from "@entur-partner/permission-client-node";
2
- import React, { type FC, type ReactNode } from "react";
3
- import type { User } from "./User";
4
- interface AppContextType {
5
- getToken: () => Promise<string>;
6
- user: User;
7
- logout?: () => void;
8
- activeOrgId: number;
9
- navigate: (path: string) => void;
10
- }
11
- export declare const AppContext: React.Context<AppContextType | undefined>;
12
- export declare const useUser: () => User;
13
- export declare const useActiveOrgId: () => number;
14
- export interface AppProviderProps {
15
- children: ReactNode;
16
- getToken: () => Promise<string>;
17
- user: User;
18
- getPermissions: () => Promise<Permission[]>;
19
- organisationId: string;
20
- navigate: (path: string) => void;
21
- }
22
- export declare const useNavigate: () => (path: string) => void;
23
- export declare const AppProvider: FC<AppProviderProps>;
24
- export {};
1
+ import type { Permission } from "@entur-partner/permission-client-node";
2
+ import React, { type FC, type ReactNode } from "react";
3
+ import type { User } from "./User";
4
+ interface AppContextType {
5
+ getToken: () => Promise<string>;
6
+ user: User;
7
+ logout?: () => void;
8
+ activeOrgId: number;
9
+ navigate: (path: string) => void;
10
+ }
11
+ export declare const AppContext: React.Context<AppContextType | undefined>;
12
+ export declare const useUser: () => User;
13
+ export declare const useActiveOrgId: () => number;
14
+ export interface AppProviderProps {
15
+ children: ReactNode;
16
+ getToken: () => Promise<string>;
17
+ user: User;
18
+ getPermissions: () => Promise<Permission[]>;
19
+ organisationId: string;
20
+ navigate: (path: string) => void;
21
+ }
22
+ export declare const useNavigate: () => (path: string) => void;
23
+ export declare const AppProvider: FC<AppProviderProps>;
24
+ export {};
package/dist/Payload.d.ts CHANGED
@@ -1,43 +1,43 @@
1
- import type { GetTokenSilentlyOptions } from "@auth0/auth0-spa-js";
2
- import type { BusinessCapability } from "@entur-partner/permission-client-node";
3
- import type { User } from "./User";
4
- export interface MenuItem {
5
- /** Title of the menu item */
6
- title: string;
7
- /** The path navigate is called with. Should be relative to the micro-frontend. */
8
- to: string;
9
- /**
10
- * The function should call history.pushState or the equivalent
11
- * provided by the micro frontend routing library. The path param
12
- * is the same as the to value provided to the MenuItem
13
- */
14
- navigate: (path: string) => void;
15
- /** Is menu item disabled? */
16
- disabled?: boolean;
17
- /** Permissions required to view menu item */
18
- requiredPermissions?: {
19
- oneOf?: BusinessCapability[];
20
- all?: BusinessCapability[] | BusinessCapability;
21
- };
22
- }
23
- export type NavigationFunction = (to: string) => void;
24
- export interface MicroFrontendPayload {
25
- /** Logged in auth0 user */
26
- user: User;
27
- /** Function for getting an accessToken */
28
- getToken(options?: GetTokenSilentlyOptions): Promise<string>;
29
- /** User selected language. Either 'nb', 'en', 'en-GB' or 'nb-NO' */
30
- language: string;
31
- /** Active organisation identifier*/
32
- organisationId: string;
33
- /** Function for adding menu items to the global menu */
34
- addMenuItems: (items: MenuItem[]) => void;
35
- /** Log the user out */
36
- logout: () => void;
37
- /** Navigate to a micro frontend or an app shell location */
38
- navigate: NavigationFunction;
39
- /** Set which method to be used for navigation to micro frontend routes. This
40
- * method is used for links in navigation. If this function is not called we
41
- * will try to use the navigate function from the first menu item instead. */
42
- setMFNavigate: (navigate: NavigationFunction) => void;
43
- }
1
+ import type { GetTokenSilentlyOptions } from "@auth0/auth0-spa-js";
2
+ import type { BusinessCapability } from "@entur-partner/permission-client-node";
3
+ import type { User } from "./User";
4
+ export interface MenuItem {
5
+ /** Title of the menu item */
6
+ title: string;
7
+ /** The path navigate is called with. Should be relative to the micro-frontend. */
8
+ to: string;
9
+ /**
10
+ * The function should call history.pushState or the equivalent
11
+ * provided by the micro frontend routing library. The path param
12
+ * is the same as the to value provided to the MenuItem
13
+ */
14
+ navigate: (path: string) => void;
15
+ /** Is menu item disabled? */
16
+ disabled?: boolean;
17
+ /** Permissions required to view menu item */
18
+ requiredPermissions?: {
19
+ oneOf?: BusinessCapability[];
20
+ all?: BusinessCapability[] | BusinessCapability;
21
+ };
22
+ }
23
+ export type NavigationFunction = (to: string) => void;
24
+ export interface MicroFrontendPayload {
25
+ /** Logged in auth0 user */
26
+ user: User;
27
+ /** Function for getting an accessToken */
28
+ getToken(options?: GetTokenSilentlyOptions): Promise<string>;
29
+ /** User selected language. Either 'nb', 'en', 'en-GB' or 'nb-NO' */
30
+ language: string;
31
+ /** Active organisation identifier*/
32
+ organisationId: string;
33
+ /** Function for adding menu items to the global menu */
34
+ addMenuItems: (items: MenuItem[]) => void;
35
+ /** Log the user out */
36
+ logout: () => void;
37
+ /** Navigate to a micro frontend or an app shell location */
38
+ navigate: NavigationFunction;
39
+ /** Set which method to be used for navigation to micro frontend routes. This
40
+ * method is used for links in navigation. If this function is not called we
41
+ * will try to use the navigate function from the first menu item instead. */
42
+ setMFNavigate: (navigate: NavigationFunction) => void;
43
+ }
package/dist/User.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- import type { Permission } from "@entur-partner/permission-client-node";
2
- export interface User {
3
- sub: string;
4
- name: string;
5
- email?: string;
6
- picture: string;
7
- nickname: string;
8
- family_name: string;
9
- given_name: string;
10
- "https://entur.io/organisationID": number;
11
- /**
12
- * Permissions granted to the user. Comes from Permission-Store.
13
- */
14
- permissions: Permission[];
15
- /**
16
- * Legacy permissions for Entur Partner.
17
- */
18
- enturPartnerPermissions: string[];
19
- }
1
+ import type { Permission } from "@entur-partner/permission-client-node";
2
+ export interface User {
3
+ sub: string;
4
+ name: string;
5
+ email?: string;
6
+ picture: string;
7
+ nickname: string;
8
+ family_name: string;
9
+ given_name: string;
10
+ "https://entur.io/organisationID": number;
11
+ /**
12
+ * Permissions granted to the user. Comes from Permission-Store.
13
+ */
14
+ permissions: Permission[];
15
+ /**
16
+ * Legacy permissions for Entur Partner.
17
+ */
18
+ enturPartnerPermissions: string[];
19
+ }
package/dist/events.d.ts CHANGED
@@ -1,27 +1,27 @@
1
- import type { MicroFrontendPayload } from "./Payload";
2
- type MountEventDetail = {
3
- id: string;
4
- mountPoint: HTMLDivElement;
5
- payload: MicroFrontendPayload;
6
- };
7
- type UnmountEventDetail = {
8
- id: string;
9
- mountPoint: HTMLDivElement;
10
- };
11
- export declare const MOUNT_EVENT_TYPE = "@entur-partner:mount";
12
- export declare const UNMOUNT_EVENT_TYPE = "@entur-partner:unmount";
13
- export interface MountEvent extends CustomEvent<MountEventDetail> {
14
- }
15
- export interface UnmountEvent extends CustomEvent<UnmountEventDetail> {
16
- }
17
- export declare function createMountEvent(detail: MountEventDetail): CustomEvent<MountEventDetail>;
18
- export declare function createUnmountEvent(detail: UnmountEventDetail): CustomEvent<UnmountEventDetail>;
19
- export declare const ROUTE_CHANGE_EVENT_TYPE = "@entur-partner:after-route-change";
20
- export type RouteAction = "PUSH" | "POP" | "REPLACE";
21
- type RouteChangeEventDetail = {
22
- location: Location;
23
- action: RouteAction;
24
- };
25
- export declare class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {
26
- }
27
- export {};
1
+ import type { MicroFrontendPayload } from "./Payload";
2
+ type MountEventDetail = {
3
+ id: string;
4
+ mountPoint: HTMLDivElement;
5
+ payload: MicroFrontendPayload;
6
+ };
7
+ type UnmountEventDetail = {
8
+ id: string;
9
+ mountPoint: HTMLDivElement;
10
+ };
11
+ export declare const MOUNT_EVENT_TYPE = "@entur-partner:mount";
12
+ export declare const UNMOUNT_EVENT_TYPE = "@entur-partner:unmount";
13
+ export interface MountEvent extends CustomEvent<MountEventDetail> {
14
+ }
15
+ export interface UnmountEvent extends CustomEvent<UnmountEventDetail> {
16
+ }
17
+ export declare function createMountEvent(detail: MountEventDetail): CustomEvent<MountEventDetail>;
18
+ export declare function createUnmountEvent(detail: UnmountEventDetail): CustomEvent<UnmountEventDetail>;
19
+ export declare const ROUTE_CHANGE_EVENT_TYPE = "@entur-partner:after-route-change";
20
+ export type RouteAction = "PUSH" | "POP" | "REPLACE";
21
+ type RouteChangeEventDetail = {
22
+ location: Location;
23
+ action: RouteAction;
24
+ };
25
+ export declare class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {
26
+ }
27
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { AppProvider, AppProviderProps, useActiveOrgId, useNavigate, useUser, } from "./AppProvider";
2
- export { createMountEvent, createUnmountEvent, MOUNT_EVENT_TYPE, MountEvent, ROUTE_CHANGE_EVENT_TYPE, RouteAction, RouteChangeEvent, UNMOUNT_EVENT_TYPE, UnmountEvent, } from "./events";
3
- export { MenuItem, MicroFrontendPayload, NavigationFunction } from "./Payload";
4
- export { registerMicroFrontend } from "./registerMicroFrontend";
5
- export { User } from "./User";
1
+ export { AppProvider, AppProviderProps, useActiveOrgId, useNavigate, useUser, } from "./AppProvider";
2
+ export { createMountEvent, createUnmountEvent, MOUNT_EVENT_TYPE, MountEvent, ROUTE_CHANGE_EVENT_TYPE, RouteAction, RouteChangeEvent, UNMOUNT_EVENT_TYPE, UnmountEvent, } from "./events";
3
+ export { MenuItem, MicroFrontendPayload, NavigationFunction } from "./Payload";
4
+ export { registerMicroFrontend } from "./registerMicroFrontend";
5
+ export { User } from "./User";