@fluxo-dev/shell 0.0.8 → 0.0.12

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.
Files changed (119) hide show
  1. package/index.esm.css +115 -0
  2. package/index.esm.d.ts +1 -0
  3. package/index.esm.js +68195 -0
  4. package/package.json +13 -2
  5. package/src/index.d.ts +1 -0
  6. package/src/lib/app.d.ts +16 -0
  7. package/src/lib/components/error-page/404.d.ts +1 -0
  8. package/src/lib/components/routes/main-routes.d.ts +6 -0
  9. package/src/lib/layouts/blank/blank-layout.d.ts +2 -0
  10. package/src/lib/layouts/main/app-bar.d.ts +9 -0
  11. package/src/lib/layouts/main/app-layout.d.ts +5 -0
  12. package/src/lib/layouts/main/content.d.ts +2 -0
  13. package/src/lib/layouts/main/footer-bar.d.ts +5 -0
  14. package/src/lib/layouts/main/navbar-item.d.ts +12 -0
  15. package/src/lib/layouts/main/navbar.d.ts +1 -0
  16. package/src/lib/layouts/main/search-bar.d.ts +5 -0
  17. package/src/lib/layouts/main/shell-spotlight.d.ts +2 -0
  18. package/src/lib/models/app-jit.d.ts +5 -0
  19. package/src/lib/pages/general/fluxo-plugin-loader.d.ts +7 -0
  20. package/src/lib/pages/login/account-confirmation.d.ts +2 -0
  21. package/src/lib/pages/login/change-password.d.ts +2 -0
  22. package/src/lib/pages/login/forgot-password.d.ts +2 -0
  23. package/src/lib/pages/login/login-page.d.ts +2 -0
  24. package/src/lib/pages/login/reset-password.d.ts +2 -0
  25. package/src/lib/pages/settings/apps/add-jit-app.d.ts +5 -0
  26. package/src/lib/pages/settings/apps/app-item.d.ts +10 -0
  27. package/src/lib/pages/settings/apps/app-jit-item.d.ts +8 -0
  28. package/src/lib/pages/settings/apps/apps-list.d.ts +6 -0
  29. package/src/lib/pages/settings/apps/embedded-module-item.d.ts +10 -0
  30. package/src/lib/pages/settings/apps/install-or-upgrade-app.d.ts +6 -0
  31. package/src/lib/pages/settings/menu-designer/custom-node.d.ts +14 -0
  32. package/src/lib/pages/settings/menu-designer/menu-create-form.d.ts +5 -0
  33. package/src/lib/pages/settings/menu-designer/menu-designer.d.ts +1 -0
  34. package/src/lib/pages/settings/menu-designer/menu-item-edit.d.ts +8 -0
  35. package/src/lib/pages/settings/menu-designer/placeholder.d.ts +8 -0
  36. package/src/lib/pages/settings/security/components/domani-role/domain-role-form.d.ts +6 -0
  37. package/src/lib/pages/settings/security/components/domani-role/domain-role-grid.d.ts +1 -0
  38. package/src/lib/pages/settings/security/components/permission/create-custom-permission-form.d.ts +7 -0
  39. package/src/lib/pages/settings/security/components/permission/create-scope-form.d.ts +7 -0
  40. package/src/lib/pages/settings/security/components/permission/permission-grid.d.ts +1 -0
  41. package/src/lib/pages/settings/security/components/permission/permission-navigator.d.ts +8 -0
  42. package/src/lib/pages/settings/security/components/permission/update-permission.d.ts +5 -0
  43. package/src/lib/pages/settings/security/components/route-rule/route-rule-create-form.d.ts +7 -0
  44. package/src/lib/pages/settings/security/components/route-rule/route-rule-grid.d.ts +1 -0
  45. package/src/lib/pages/settings/security/components/user/user-form.d.ts +7 -0
  46. package/src/lib/pages/settings/security/components/user/users-grid.d.ts +1 -0
  47. package/src/lib/pages/settings/settings.d.ts +6 -0
  48. package/src/lib/pages/settings/token/token-row.d.ts +7 -0
  49. package/src/lib/pages/settings/token/tokens.d.ts +2 -0
  50. package/src/lib/pages/settings/ui/ui.d.ts +1 -0
  51. package/src/lib/services/app-jit-manager.d.ts +10 -0
  52. package/src/lib/services/app-menu.service.d.ts +5 -0
  53. package/src/lib/utils/icon-factory.d.ts +9 -0
  54. package/src/lib/utils/security/only-not-logged-route.d.ts +2 -0
  55. package/src/lib/utils/security/protected-route.d.ts +2 -0
  56. package/.babelrc +0 -12
  57. package/.eslintrc.json +0 -18
  58. package/jest.config.ts +0 -11
  59. package/project.json +0 -43
  60. package/src/index.ts +0 -1
  61. package/src/lib/app.module.css +0 -1
  62. package/src/lib/app.spec.tsx +0 -17
  63. package/src/lib/app.tsx +0 -374
  64. package/src/lib/components/error-page/404.tsx +0 -16
  65. package/src/lib/components/routes/main-routes.tsx +0 -26
  66. package/src/lib/layouts/blank/blank-layout.tsx +0 -10
  67. package/src/lib/layouts/main/app-bar.tsx +0 -192
  68. package/src/lib/layouts/main/app-layout.tsx +0 -52
  69. package/src/lib/layouts/main/content.tsx +0 -10
  70. package/src/lib/layouts/main/footer-bar.tsx +0 -76
  71. package/src/lib/layouts/main/navbar-item.module.css +0 -49
  72. package/src/lib/layouts/main/navbar-item.tsx +0 -129
  73. package/src/lib/layouts/main/navbar.tsx +0 -38
  74. package/src/lib/layouts/main/search-bar.tsx +0 -44
  75. package/src/lib/layouts/main/shell-spotlight.tsx +0 -58
  76. package/src/lib/models/app-jit.ts +0 -6
  77. package/src/lib/pages/general/fluxo-plugin-loader.tsx +0 -22
  78. package/src/lib/pages/login/account-confirmation.tsx +0 -86
  79. package/src/lib/pages/login/change-password.tsx +0 -58
  80. package/src/lib/pages/login/forgot-password.tsx +0 -53
  81. package/src/lib/pages/login/login-page.tsx +0 -70
  82. package/src/lib/pages/login/reset-password.tsx +0 -91
  83. package/src/lib/pages/settings/apps/add-jit-app.tsx +0 -79
  84. package/src/lib/pages/settings/apps/app-item.tsx +0 -157
  85. package/src/lib/pages/settings/apps/app-jit-item.tsx +0 -105
  86. package/src/lib/pages/settings/apps/apps-list.tsx +0 -171
  87. package/src/lib/pages/settings/apps/embedded-module-item.tsx +0 -66
  88. package/src/lib/pages/settings/apps/install-or-upgrade-app.tsx +0 -105
  89. package/src/lib/pages/settings/menu-designer/custom-node.module.css +0 -34
  90. package/src/lib/pages/settings/menu-designer/custom-node.tsx +0 -160
  91. package/src/lib/pages/settings/menu-designer/menu-create-form.tsx +0 -109
  92. package/src/lib/pages/settings/menu-designer/menu-designer.module.css +0 -19
  93. package/src/lib/pages/settings/menu-designer/menu-designer.tsx +0 -463
  94. package/src/lib/pages/settings/menu-designer/menu-item-edit.tsx +0 -115
  95. package/src/lib/pages/settings/menu-designer/placeholder.module.css +0 -8
  96. package/src/lib/pages/settings/menu-designer/placeholder.tsx +0 -13
  97. package/src/lib/pages/settings/security/components/domani-role/domain-role-form.tsx +0 -67
  98. package/src/lib/pages/settings/security/components/domani-role/domain-role-grid.tsx +0 -139
  99. package/src/lib/pages/settings/security/components/permission/create-custom-permission-form.tsx +0 -64
  100. package/src/lib/pages/settings/security/components/permission/create-scope-form.tsx +0 -158
  101. package/src/lib/pages/settings/security/components/permission/permission-grid.tsx +0 -304
  102. package/src/lib/pages/settings/security/components/permission/permission-navigator.tsx +0 -320
  103. package/src/lib/pages/settings/security/components/permission/update-permission.tsx +0 -54
  104. package/src/lib/pages/settings/security/components/route-rule/route-rule-create-form.tsx +0 -59
  105. package/src/lib/pages/settings/security/components/route-rule/route-rule-grid.tsx +0 -229
  106. package/src/lib/pages/settings/security/components/user/user-form.tsx +0 -123
  107. package/src/lib/pages/settings/security/components/user/users-grid.tsx +0 -127
  108. package/src/lib/pages/settings/settings.tsx +0 -298
  109. package/src/lib/pages/settings/token/token-row.tsx +0 -69
  110. package/src/lib/pages/settings/token/tokens.tsx +0 -73
  111. package/src/lib/pages/settings/ui/ui.tsx +0 -149
  112. package/src/lib/services/app-jit-manager.ts +0 -92
  113. package/src/lib/services/app-menu.service.ts +0 -35
  114. package/src/lib/utils/icon-factory.tsx +0 -25
  115. package/src/lib/utils/security/only-not-logged-route.tsx +0 -17
  116. package/src/lib/utils/security/protected-route.tsx +0 -47
  117. package/tsconfig.json +0 -20
  118. package/tsconfig.lib.json +0 -24
  119. package/tsconfig.spec.json +0 -20
@@ -1,76 +0,0 @@
1
- import React, {useEffect} from 'react';
2
- import {IFluxoRootState, useAppSelector} from "@fluxo-dev/state";
3
- import {Group, Space, Divider, Text, Anchor, Breadcrumbs, Tooltip, AppShell} from "@mantine/core";
4
- import {IconChecks, IconUser} from '@tabler/icons-react';
5
- import {FluxoStateDispatcher} from "@fluxo-dev/api-client-base";
6
- import {useIdle} from "@mantine/hooks";
7
- import {Link} from 'react-router-dom';
8
-
9
- export interface FooterBarProps {
10
- appVersion: string;
11
- }
12
-
13
- function FooterBar(props: FooterBarProps) {
14
-
15
- const {userInfo} = useAppSelector((state: IFluxoRootState) => state.user);
16
- const {userIdle} = useAppSelector((state: IFluxoRootState) => state.layout);
17
-
18
- const idle = useIdle(5000);
19
-
20
- useEffect(() => {
21
- if (idle)
22
- FluxoStateDispatcher.dispatchSetUserIdle();
23
- else
24
- FluxoStateDispatcher.dispatchUnsetUserIdle();
25
- }, [idle])
26
-
27
- const items = [
28
- {title: 'Home', href: '#'},
29
- {title: 'Prodotti', href: '#'},
30
- ].map((item, index) => (
31
- <Anchor href={item.href} key={index}>
32
- {item.title}
33
- </Anchor>
34
- ));
35
-
36
- return (
37
- <AppShell.Footer style={{
38
- height: 40
39
- }}>
40
- <Group px={20} justify='space-between' wrap="nowrap" style={{height: '100%'}}>
41
- <Group>
42
- <Tooltip label={'Stato del sistema'} position={'top'} withArrow color={'gray'}>
43
- <span>
44
- <IconChecks color={'green'} size={16}/>
45
- </span>
46
- </Tooltip>
47
- <Divider orientation={'vertical'}/>
48
- <Tooltip label={'Stato utente'} position={'top'} withArrow color={'gray'}>
49
- <span>
50
- {userIdle ?
51
- <IconUser size={16} color={'orange'}/> :
52
- <IconUser size={16} color={'green'}/>
53
- }
54
- </span>
55
- </Tooltip>
56
- <Divider orientation={'vertical'}/>
57
- <Text c="dimmed" fz="xs">{userInfo.FirstName} {userInfo.LastName}</Text>
58
- <Divider orientation={'vertical'}/>
59
- <Breadcrumbs separator="→" fz={'xs'}>{items}</Breadcrumbs>
60
- </Group>
61
- <Space h={'md'}/>
62
- <Group>
63
- <Link to={'/settings'} style={{textDecoration: 'none'}}>
64
- <Text c="dimmed" fz="xs">Amministrazione</Text>
65
- </Link>
66
- <Divider orientation={'vertical'}/>
67
- <Text c="dimmed" fz="xs">Fluxo ©2022</Text>
68
- <Divider orientation={'vertical'}/>
69
- <Text c="dimmed" fz="xs">V. {props.appVersion}</Text>
70
- </Group>
71
- </Group>
72
- </AppShell.Footer>
73
- )
74
- }
75
-
76
- export default FooterBar;
@@ -1,49 +0,0 @@
1
- .control {
2
- font-weight: 500;
3
- height: auto;
4
- display: block;
5
- width: 100%;
6
- color: black;
7
- font-size: 14px;
8
- padding-left: 8px;
9
- padding-right: 8px;
10
- &:hover {
11
- background-color: #ececec;
12
- color: black;
13
- };
14
- }
15
-
16
- .controlSub {
17
- font-weight: 500;
18
- width: calc(100% - 30px);
19
- display: block;
20
- text-decoration: none;
21
- padding: 8px 10px 8px 24px;
22
- margin-left: 30px;
23
- font-size: 18px;
24
- color: black;
25
- border-left: #ececec;
26
-
27
- &:hover {
28
- background-color: black;
29
- color: black;
30
- }
31
- }
32
-
33
- .link {
34
- font-weight: 500;
35
- display: block;
36
- text-decoration: none;
37
- padding: 8px 16px;
38
- padding-left: 24px;
39
- margin-left: 30px;
40
- font-size: 14px;
41
- &:hover {
42
- background-color: #ececec;
43
- color: black;
44
- }
45
- }
46
-
47
- .chevron {
48
- transition: transform 200ms ease;
49
- }
@@ -1,129 +0,0 @@
1
- import { useState } from 'react';
2
- import {
3
- Group,
4
- Box,
5
- Collapse,
6
- ThemeIcon,
7
- UnstyledButton, useMantineTheme, useMantineColorScheme
8
- } from '@mantine/core';
9
- import {IconChevronLeft, IconH6} from '@tabler/icons-react';
10
- import {IFluxoRootState} from "@fluxo-dev/state";
11
- import {useSelector} from "react-redux";
12
- import {Link, useNavigate} from "react-router-dom";
13
- import {AppMenuItem, UserService} from "@fluxo-dev/api-client-base";
14
- import style from './navbar-item.module.css';
15
-
16
- interface NavBarItemProps {
17
- icon: JSX.Element;
18
- label: string;
19
- routerLink?: string;
20
- initiallyOpened?: boolean;
21
- links?: AppMenuItem[];
22
- level: number;
23
- }
24
-
25
- export function NavBarItem({ icon: Icon, label, routerLink, initiallyOpened, links, level }: NavBarItemProps) {
26
-
27
- const hasLinks = Array.isArray(links);
28
- const [opened, setOpened] = useState(initiallyOpened || false);
29
- const {navbarOpened} = useSelector((state: IFluxoRootState) => state.layout);
30
- const navigate = useNavigate();
31
-
32
- const theme = useMantineTheme();
33
- const colorScheme = useMantineColorScheme();
34
- const ChevronIcon = IconChevronLeft;
35
- const userService = new UserService();
36
-
37
- const items = (hasLinks ? links : []).map((link, i) => {
38
-
39
- if(link.hasPermissions) {
40
-
41
- if(!userService.currentUserHasPermissions(link.permissions!)) {
42
- return null;
43
- }
44
- }
45
-
46
- if(link.isGroup) {
47
- return (
48
- <NavBarItem
49
- key={link.label + '_' + i}
50
- label={link.label}
51
- icon={<IconH6/>}
52
- links={link.children}
53
- routerLink={link.routerLink}
54
- initiallyOpened={false}
55
- level={level + 1}
56
- />
57
- )
58
- }
59
-
60
- if(link.featureIdentifier === 'webclient.routing.externallink') {
61
- return (
62
- <Link
63
- className={style['link']}
64
- style={{
65
- color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
66
- borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
67
- }}
68
- key={link.label + '_' + i}
69
- to={link.routerLink!}
70
- target={'_blank'}>
71
- {link.label}
72
- </Link>
73
- );
74
- } else {
75
- return (
76
- <Link
77
- className={style['link']}
78
- style={{
79
- color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
80
- borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
81
- }}
82
- key={link.label + '_' + i}
83
- to={'/' + link.routerLink}>
84
- {link.label}
85
- </Link>
86
- );
87
- }
88
- });
89
-
90
- return (
91
- <>
92
- {navbarOpened ?
93
- <>
94
- <UnstyledButton onClick={() => {
95
- if(hasLinks)
96
- setOpened((o) => !o)
97
- else
98
- navigate('/' + routerLink)
99
- }} className={level === 0 ? style['control'] : style['controlSub']}>
100
- <Group justify='space-between' gap={0}>
101
- <Box style={{ display: 'flex', alignItems: 'center' }}>
102
- {level === 0 &&
103
- <ThemeIcon variant="light" size={30}>
104
- {Icon}
105
- </ThemeIcon>
106
- }
107
- <Box ml="md" style={{marginLeft: level === 0 ? '1rem' : 0}}>{label}</Box>
108
- </Box>
109
- {hasLinks && (
110
- <ChevronIcon
111
- className={style['chevron']}
112
- size={14}
113
- stroke={1.5}
114
- style={{
115
- transform: opened ? `rotate(90deg)` : 'none',
116
- }}
117
- />
118
- )}
119
- </Group>
120
- </UnstyledButton>
121
- {hasLinks ? <Collapse style={{width: '100%', marginBottom: 8}} in={opened}>{items}</Collapse> : null}
122
- </> :
123
- <>
124
- {/*<NavBarItemMinimal leftSection={Icon} label={label} initiallyOpened={initiallyOpened} links={links} />*/}
125
- </>
126
- }
127
- </>
128
- );
129
- }
@@ -1,38 +0,0 @@
1
- import React from "react";
2
- import {Burger, Center, AppShell, Stack, ScrollArea, useMantineTheme} from "@mantine/core";
3
- import {NavBarItem} from "./navbar-item";
4
- import {IconBadge} from '@tabler/icons-react';
5
- import {IFluxoRootState} from "@fluxo-dev/state";
6
- import {useSelector} from "react-redux";
7
- import {IconFactory} from "../../utils/icon-factory";
8
- import {AppMenuItem, UserService} from "@fluxo-dev/api-client-base";
9
-
10
- export function Navbar() {
11
-
12
- const {navbarOpened, appMenu} = useSelector((state: IFluxoRootState) => state.layout);
13
- const fluxoTheme = useMantineTheme();
14
-
15
- const getPermittedNavBarItems = () => {
16
- const userService = new UserService();
17
-
18
- return (appMenu as AppMenuItem[])?.filter(a => !a.hasPermissions || userService.currentUserHasPermissions(a.permissions ?? []));
19
- }
20
-
21
- return (
22
- <AppShell.Navbar>
23
- <AppShell.Section grow my="md" component={ScrollArea}>
24
- <Stack justify="center" align={'center'} gap={8}>
25
- {getPermittedNavBarItems().map((e, i) => {
26
- const IconComponent = e.icon ?
27
- IconFactory.getIcon(e.icon) :
28
- IconFactory.getIcon('Dashboard');
29
-
30
- return (
31
- <NavBarItem level={0} key={i} routerLink={e.routerLink} icon={IconComponent} label={e.label} links={e.children && e.children.length > 0 ? e.children : undefined}/>
32
- )
33
- })}
34
- </Stack>
35
- </AppShell.Section>
36
- </AppShell.Navbar>
37
- )
38
- }
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import {Text, TextInput} from "@mantine/core";
3
- import {IconSearch} from '@tabler/icons-react';
4
- import {openSpotlight} from "@mantine/spotlight";
5
- import {useOs} from "@mantine/hooks";
6
-
7
- export interface SearchBarProps {
8
- disabled: boolean,
9
- }
10
- function SearchBar(props: SearchBarProps) {
11
-
12
- const currentOs = useOs();
13
-
14
- const rightSection = (
15
- <div style={{display: 'flex', alignItems: 'center'}}>
16
- <Text style={{backgroundColor: '#f4f4f4', fontSize: 11, fontWeight: 700, padding: '2px 7px', borderRadius: 4, border: '1px solid #e9ecef'}}>
17
- {currentOs === "macos" ?
18
- <>⌘</> :
19
- <>Ctrl</>
20
- }
21
- <span style={{margin: '0 5px'}}>+</span>
22
- K
23
- </Text>
24
- </div>
25
- );
26
-
27
- return (
28
- <div>
29
- <TextInput
30
- disabled={props.disabled}
31
- size={'xs'}
32
- placeholder="Cerca..."
33
- onClick={() => props.disabled ? undefined : openSpotlight()}
34
- leftSection={<IconSearch size={16}/>}
35
- rightSectionWidth={90}
36
- width={150}
37
- rightSection={rightSection}
38
- styles={{input: {cursor: 'pointer', borderRadius: 4}, section: {pointerEvents: 'none'}}}
39
- />
40
- </div>
41
- )
42
- }
43
-
44
- export default SearchBar;
@@ -1,58 +0,0 @@
1
- import {useSelector} from "react-redux";
2
- import {IFluxoRootState} from "@fluxo-dev/state";
3
- import React, {useEffect, useState} from "react";
4
- import {Spotlight, SpotlightActionGroupData} from "@mantine/spotlight";
5
- import {AppMenuService} from "../../services/app-menu.service";
6
- import {useNavigate} from "react-router-dom";
7
- import {FluxoStateDispatcher} from "@fluxo-dev/api-client-base";
8
- import {IconSearch} from "@tabler/icons-react";
9
- import {SpotlightActions} from "@mantine/spotlight/lib/Spotlight";
10
- import { rem } from "@mantine/core";
11
-
12
- function ShellSpotlight() {
13
-
14
- const {configuration, appMenu} = useSelector((state: IFluxoRootState) => state.layout);
15
- const [spotlightActions, setSpotlightActions] = useState<SpotlightActionGroupData[] | SpotlightActions[]>([]);
16
- const navigateTo = useNavigate();
17
-
18
- useEffect(() => {
19
-
20
- const appMenuService = new AppMenuService();
21
-
22
- if(appMenu) {
23
- appMenuService.getSpotlightMenu(appMenu)
24
- .then((res) => {
25
-
26
- const result: SpotlightActionGroupData[] = res.map((group) => {
27
- return {
28
- ...group,
29
- actions: group.actions.map((action) => {
30
- return {
31
- ...action,
32
- onClick: () => navigateTo(action.id),
33
- }
34
- })
35
- }
36
- });
37
-
38
- setSpotlightActions(result)
39
- })
40
- }
41
- }, [configuration, appMenu, navigateTo])
42
-
43
- return (
44
- <Spotlight
45
- onSpotlightOpen={() => FluxoStateDispatcher.dispatchOpenSearchPanel()}
46
- onSpotlightClose={() => FluxoStateDispatcher.dispatchCloseSearchPanel()}
47
- actions={spotlightActions}
48
- searchProps={{
49
- leftSection: <IconSearch style={{ width: rem(20), height: rem(20) }} stroke={1.5} />,
50
- placeholder: "Cerca funzione..."
51
- }}
52
- shortcut="mod + k"
53
- nothingFound="Nessun risultato..."
54
- />
55
- )
56
- }
57
-
58
- export default ShellSpotlight;
@@ -1,6 +0,0 @@
1
- import {FluxoFrontendAppConfiguration} from "@fluxo-dev/api-client-base";
2
-
3
- export interface AppJit extends FluxoFrontendAppConfiguration {
4
- developmentRoute: string;
5
- developmentUrl: string;
6
- }
@@ -1,22 +0,0 @@
1
- import React, {Suspense, useState} from 'react';
2
- import { ModuleLoader } from "@fluxo-fe/shell/mfe";
3
-
4
- export interface FluxoPluginLoaderProps {
5
- url: string,
6
- scope: string,
7
- module: string
8
- }
9
- function FluxoPluginLoader(props: FluxoPluginLoaderProps) {
10
-
11
- const [remote, setRemote] = useState<any>({url: props.url, scope: props.scope, module: props.module});
12
-
13
- return (
14
- <Suspense fallback={'Loading . . . '}>
15
- {
16
- remote && <ModuleLoader url={remote.url} scope={remote.scope} module={remote.module} />
17
- }
18
- </Suspense>
19
- )
20
- }
21
-
22
- export default FluxoPluginLoader;
@@ -1,86 +0,0 @@
1
- import { Button, Grid, Stack, Text } from '@mantine/core';
2
- import { useEffect, useState } from 'react';
3
- import { Link, useSearchParams } from 'react-router-dom';
4
- import {UserService} from "@fluxo-dev/api-client-base";
5
-
6
- export function AccountConfirmation() {
7
-
8
- const [email, setEmail] = useState<string>();
9
- const [token, setToken] = useState<string>();
10
- const [linkIsValid, setLinkIsValid] = useState<boolean>(true);
11
-
12
- const [recoveryResult, setRecoveryResult] = useState<{ success: boolean, errors: { code: string, description: string }[] } | undefined>();
13
-
14
- const userService = new UserService();
15
- let [searchParams] = useSearchParams();
16
-
17
- useEffect(() => {
18
-
19
- const currentEmail = searchParams.get('email');
20
- const currentToken = searchParams.get('token');
21
-
22
- if (!currentEmail || !currentToken) {
23
- setLinkIsValid(false)
24
- } else {
25
- setEmail(currentEmail)
26
- setToken(currentToken)
27
- }
28
-
29
-
30
- }, [searchParams]);
31
-
32
- const onFormSubmitClickHandler = () => {
33
- if (email && token) {
34
- userService.confirmEmail({ email: email, token: token })
35
- .then(async (res) => {
36
- setRecoveryResult(res);
37
- })
38
- .catch(_err => setRecoveryResult({ success: false, errors: [{ code: 'unkown', description: 'Errore sconosciuto' }] }));
39
- }
40
- }
41
-
42
- return (
43
- <Grid justify="center">
44
- <Grid.Col span={3}>
45
-
46
- {linkIsValid &&
47
- <Stack gap={16}>
48
- {(!recoveryResult) &&
49
- <Stack gap={16}>
50
- <h2 style={{ textAlign: 'center' }}>Conferma attivazione account</h2>
51
- <Text style={{ marginTop: 0, marginBottom: 32, textAlign: 'center' }}>{email}</Text>
52
-
53
- <Button onClick={onFormSubmitClickHandler}>Clicca qui per attivare il tuo account</Button>
54
- </Stack>
55
- }
56
-
57
- {recoveryResult?.success ?
58
- <div style={{ marginTop: 32 }}>
59
- <Stack gap={16} style={{ textAlign: 'center' }}>
60
- <Text>Account attivato con successo</Text>
61
- <Link to={'/identity/login'}>Effettua il login</Link>
62
- </Stack>
63
- </div> :
64
- <div style={{ textAlign: 'center', marginTop: 32 }}>
65
- {recoveryResult?.errors.map((err, index) => {
66
- return <Text key={err.code + index} >{err.description}</Text>
67
- })}
68
- </div>
69
- }
70
-
71
- </Stack>
72
- }
73
-
74
- {!linkIsValid &&
75
- <Stack gap={16}>
76
- <Text>Link non valido</Text>
77
- <Link to={'/identity/login'} style={{ textAlign: 'center' }}>Effettua il login</Link>
78
- </Stack>
79
- }
80
-
81
- </Grid.Col>
82
- </Grid>
83
- )
84
- }
85
-
86
- export default AccountConfirmation;
@@ -1,58 +0,0 @@
1
- import { Button, Grid, Stack, TextInput, Text } from '@mantine/core';
2
- import { useState } from 'react';
3
- import {UserService} from "@fluxo-dev/api-client-base";
4
-
5
- export function ChangePassword() {
6
-
7
- const [currentPassword, setCurrentPassword] = useState<string>();
8
- const [newPassword, setNewPassword] = useState<string>();
9
- const [confirmNewPassword, setConfirmNewPassword] = useState<string>();
10
-
11
- const userService = new UserService();
12
-
13
- const [recoveryResult, setRecoveryResult] = useState<{ success: boolean, errors: { code: string, description: string }[] } | undefined>();
14
-
15
- const onFormSubmitClickHandler = () => {
16
- if (currentPassword && newPassword && confirmNewPassword) {
17
- userService.changePassword({ currentPassword: currentPassword, newPassword: newPassword })
18
- .then(async (_res) => {
19
- setRecoveryResult(_res);
20
- })
21
- .catch(_err => {
22
- setRecoveryResult({ success: false, errors: [{ code: 'unkown', description: 'Errore sconosciuto' }] })
23
- });
24
- }
25
- }
26
-
27
- return (
28
- <Grid justify="center">
29
- <Grid.Col span={3}>
30
-
31
- <Stack gap={16}>
32
- {(!recoveryResult || !recoveryResult.success) &&
33
- <Stack gap={16}>
34
- <h2>Cambio password</h2>
35
- <TextInput type={'password'} label={'Password attuale'} onChange={(e) => setCurrentPassword(e.target.value)} />
36
- <TextInput type={'password'} label={'Nuova password'} onChange={(e) => setNewPassword(e.target.value)} />
37
- <TextInput type={'password'} label={'Conferma nuova password'} onChange={(e) => setConfirmNewPassword(e.target.value)} />
38
-
39
- {recoveryResult?.errors.map((err) => {
40
- return <Text>{err.description}</Text>
41
- })}
42
-
43
- <Button onClick={onFormSubmitClickHandler} disabled={!(newPassword && (newPassword === confirmNewPassword)) || (currentPassword === newPassword)}>Cambia password</Button>
44
- </Stack>
45
- }
46
-
47
- {recoveryResult && recoveryResult.success &&
48
- <h2>Password modificata con successo</h2>
49
- }
50
-
51
- </Stack>
52
-
53
- </Grid.Col>
54
- </Grid>
55
- )
56
- }
57
-
58
- export default ChangePassword;
@@ -1,53 +0,0 @@
1
- import { Button, Grid, Stack, Text, TextInput } from '@mantine/core';
2
- import { useState } from 'react';
3
- import { Link, useNavigate } from 'react-router-dom';
4
- import {UserService} from "@fluxo-dev/api-client-base";
5
-
6
- export function ForgotPassword() {
7
-
8
- const [email, setEmail] = useState<string>();
9
- const [errorMessage, setErrorMessage] = useState<string | undefined>();
10
- const [successMessage, setSuccessMessage] = useState<string | undefined>();
11
-
12
- const navigateTo = useNavigate();
13
- const userService = new UserService();
14
-
15
- const onFormSubmitClickHandler = () => {
16
- if (email) {
17
- userService.forgotPassword(email)
18
- .then((_res) => setSuccessMessage("Richiesta inviata correttamente. Apri la tua casella e-mail."))
19
- .catch(_err => setErrorMessage("Errore durante il login"));
20
- }
21
- }
22
-
23
- return (
24
- <Grid justify="center">
25
- <Grid.Col span={3}>
26
- {!successMessage &&
27
- <div>
28
- <h2>Hai dimenticato la password?</h2>
29
- <Stack gap={16}>
30
- <TextInput onChange={(e) => setEmail(e.target.value)} placeholder={'Il tuo indirizzo e-mail'} label={'Inserisci il tuo indirizzo e-mail per recuperarla.'} />
31
- <Button onClick={onFormSubmitClickHandler} disabled={!email}>Recupera</Button>
32
- <Link to={'/auth/login'} style={{ textAlign: 'center' }}>Effettua il login</Link>
33
-
34
- {errorMessage &&
35
- <Text>{errorMessage}</Text>
36
- }
37
-
38
- </Stack>
39
- </div>
40
- }
41
-
42
- {successMessage &&
43
- <Stack gap={16}>
44
- <Text style={{ textAlign: 'center', width: '100%', display: 'block' }}>{successMessage}</Text>
45
- <Link to={'/auth/login'} style={{ textAlign: 'center' }}>Effettua il login</Link>
46
- </Stack>
47
- }
48
- </Grid.Col>
49
- </Grid>
50
- )
51
- }
52
-
53
- export default ForgotPassword;