@pagopa/selfcare-common-frontend 0.0.7 → 0.1.3
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 +5 -3
- package/build.info +2 -2
- package/common-polyfill.d.ts +8 -0
- package/common-polyfill.js +11 -0
- package/common-polyfill.js.map +1 -0
- package/components/CustomAvatar.d.ts +8 -1
- package/components/CustomAvatar.js +11 -5
- package/components/CustomAvatar.js.map +1 -0
- package/components/CustomPagination.d.ts +4 -0
- package/components/CustomPagination.js +14 -7
- package/components/CustomPagination.js.map +1 -0
- package/components/ErrorBoundary/ErrorBoundary.js +31 -20
- package/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/components/ErrorBoundary/components/BlockingErrorPage.js +7 -5
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +1 -0
- package/components/FilterModal.d.ts +12 -1
- package/components/FilterModal.js +22 -16
- package/components/FilterModal.js.map +1 -0
- package/components/Footer/Footer.d.ts +2 -0
- package/components/Footer/Footer.js +15 -11
- package/components/Footer/Footer.js.map +1 -0
- package/components/Header/Header.d.ts +4 -0
- package/components/Header/Header.js +15 -10
- package/components/Header/Header.js.map +1 -0
- package/components/Header/subHeader/SubHeader.js +9 -5
- package/components/Header/subHeader/SubHeader.js.map +1 -0
- package/components/Loading/LoadingOverlay.d.ts +5 -0
- package/components/Loading/LoadingOverlay.js +21 -11
- package/components/Loading/LoadingOverlay.js.map +1 -0
- package/components/SessionModal.d.ts +12 -0
- package/components/SessionModal.js +16 -10
- package/components/SessionModal.js.map +1 -0
- package/components/TitleBox.d.ts +10 -2
- package/components/TitleBox.js +10 -5
- package/components/TitleBox.js.map +1 -0
- package/components/Toast.d.ts +13 -3
- package/components/Toast.js +26 -19
- package/components/Toast.js.map +1 -0
- package/config/env.d.ts +1 -1
- package/config/env.js +8 -2
- package/config/env.js.map +1 -0
- package/decorators/__mocks__/withLogin.js +17 -12
- package/decorators/__mocks__/withLogin.js.map +1 -0
- package/decorators/withLogin.d.ts +4 -0
- package/decorators/withLogin.js +22 -13
- package/decorators/withLogin.js.map +1 -0
- package/hooks/useErrorDispatcher.d.ts +1 -0
- package/hooks/useErrorDispatcher.js +10 -5
- package/hooks/useErrorDispatcher.js.map +1 -0
- package/hooks/useLoading.d.ts +1 -0
- package/hooks/useLoading.js +13 -8
- package/hooks/useLoading.js.map +1 -0
- package/hooks/useLogin.js +21 -15
- package/hooks/useLogin.js.map +1 -0
- package/index.js +35 -20
- package/index.js.map +1 -0
- package/model/Page.js +3 -1
- package/model/Page.js.map +1 -0
- package/model/PageRequest.js +3 -1
- package/model/PageRequest.js.map +1 -0
- package/model/PageResource.js +3 -1
- package/model/PageResource.js.map +1 -0
- package/model/Party.js +3 -1
- package/model/Party.js.map +1 -0
- package/model/User.js +3 -1
- package/model/User.js.map +1 -0
- package/package.json +1 -1
- package/redux/slices/appStateSlice.d.ts +9 -0
- package/redux/slices/appStateSlice.js +9 -5
- package/redux/slices/appStateSlice.js.map +1 -0
- package/redux/slices/userSlice.js +9 -5
- package/redux/slices/userSlice.js.map +1 -0
- package/services/errorService.js +6 -1
- package/services/errorService.js.map +1 -0
- package/utils/constants.js +8 -4
- package/utils/constants.js.map +1 -0
- package/utils/routes-utils.js +6 -1
- package/utils/routes-utils.js.map +1 -0
- package/utils/storage-utils.js +10 -3
- package/utils/storage-utils.js.map +1 -0
- package/utils/utils.js +6 -1
- package/utils/utils.js.map +1 -0
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const system_1 = require("@mui/system");
|
|
7
|
+
const react_md_spinner_1 = (0, tslib_1.__importDefault)(require("react-md-spinner"));
|
|
8
|
+
const react_redux_1 = require("react-redux");
|
|
9
|
+
const appStateSlice_1 = require("../../redux/slices/appStateSlice");
|
|
10
|
+
/** This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
|
|
11
|
+
It allows to draw a loader when an async task to wait is running.
|
|
12
|
+
|
|
13
|
+
To use this feature you have to put LoadingOverlay in your App as a child of a redux Provider component.
|
|
14
|
+
In order to register the start of an async task you have to use the custom hook useLoading passing the id of the task to await, which will return a setter function used to start and end the loading behavior. */
|
|
15
|
+
function LoadingOverlay() {
|
|
16
|
+
const theme = (0, material_1.useTheme)();
|
|
17
|
+
const loading = (0, react_redux_1.useSelector)(appStateSlice_1.appStateSelectors.selectLoading);
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Modal, Object.assign({ open: loading, sx: { outline: 0 } }, { children: (0, jsx_runtime_1.jsx)(system_1.Box, Object.assign({ sx: {
|
|
11
19
|
position: 'absolute',
|
|
12
20
|
top: '50%',
|
|
13
21
|
left: '50%',
|
|
14
22
|
width: '100px',
|
|
15
23
|
outline: 0,
|
|
16
|
-
} }, { children:
|
|
24
|
+
} }, { children: (0, jsx_runtime_1.jsx)(react_md_spinner_1.default, { singleColor: theme.palette.primary.main, role: "loadingSpinner" }, void 0) }), void 0) }), void 0));
|
|
17
25
|
}
|
|
26
|
+
exports.default = LoadingOverlay;
|
|
27
|
+
//# sourceMappingURL=LoadingOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingOverlay.js","sourceRoot":"","sources":["../../../src/lib/components/Loading/LoadingOverlay.tsx"],"names":[],"mappings":";;;;AAAA,4CAAgD;AAChD,wCAAkC;AAClC,qFAAyC;AACzC,6CAA0C;AAC1C,oEAAqE;AAErE;;;;kNAIkN;AAClN,SAAwB,cAAc;IACpC,MAAM,KAAK,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACzB,MAAM,OAAO,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,aAAa,CAAC,CAAC;IAE7D,OAAO,CACL,uBAAC,gBAAK,kBAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,gBACtC,uBAAC,YAAG,kBACF,EAAE,EAAE;gBACF,QAAQ,EAAE,UAAU;gBACpB,GAAG,EAAE,KAAK;gBACV,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,CAAC;aACX,gBAED,uBAAC,0BAAS,IAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAC,gBAAgB,WAAG,YACxE,YACA,CACT,CAAC;AACJ,CAAC;AAnBD,iCAmBC"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
+
/** If this component should be displayed or not */
|
|
3
4
|
open: boolean;
|
|
5
|
+
/** The title to show in the popup */
|
|
4
6
|
title: string;
|
|
7
|
+
/** The body to show in the popup */
|
|
5
8
|
message: React.ReactNode;
|
|
9
|
+
/** If defined, it will render a confirm button using this function as behavior */
|
|
6
10
|
onConfirm?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
11
|
+
/** The confirm label text */
|
|
7
12
|
onConfirmLabel?: string;
|
|
13
|
+
/** The function invoked when clicking on close button or in the showed X icon */
|
|
8
14
|
handleClose: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
15
|
+
/** If defined, it allow to set a different behavior when clicking on X icon */
|
|
9
16
|
handleExit?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
17
|
+
/** Close button text */
|
|
10
18
|
onCloseLabel?: string;
|
|
19
|
+
/** The popup height */
|
|
11
20
|
height?: string;
|
|
21
|
+
/** The popup minHeight */
|
|
12
22
|
minHeight?: string;
|
|
23
|
+
/** The popup width */
|
|
13
24
|
width?: string;
|
|
14
25
|
};
|
|
26
|
+
/** Selfcare's popup */
|
|
15
27
|
export default function SessionModal({ open, title, message, onConfirm, onConfirmLabel, handleClose, handleExit, onCloseLabel, height, minHeight, width, }: Props): JSX.Element;
|
|
16
28
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Dialog_1 = (0, tslib_1.__importDefault)(require("@mui/material/Dialog"));
|
|
7
|
+
const useMediaQuery_1 = (0, tslib_1.__importDefault)(require("@mui/material/useMediaQuery"));
|
|
8
|
+
const styles_1 = require("@mui/material/styles");
|
|
9
|
+
const ClearOutlined_1 = (0, tslib_1.__importDefault)(require("@mui/icons-material/ClearOutlined"));
|
|
10
|
+
/** Selfcare's popup */
|
|
11
|
+
function SessionModal({ open, title, message, onConfirm, onConfirmLabel = 'Riprova', handleClose, handleExit = handleClose, onCloseLabel = 'Annulla', height = '16em', minHeight = '16em', width = '21.9em', }) {
|
|
12
|
+
const theme = (0, styles_1.useTheme)();
|
|
13
|
+
const fullScreen = (0, useMediaQuery_1.default)(theme.breakpoints.down('xs'));
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(Dialog_1.default, Object.assign({ fullScreen: fullScreen, open: open, onClose: handleClose, "aria-labelledby": "responsive-dialog-title" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, direction: "column", sx: { height, minHeight, width } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mx: 3, sx: { height: '100%' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true, mt: 4 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ item: true, xs: 10 }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleExit, style: { position: 'absolute', top: '20px', right: '16px', zIndex: 100 } }, { children: (0, jsx_runtime_1.jsx)(ClearOutlined_1.default, {}, void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", sx: { fontSize: '18px', fontWeight: '600' } }, { children: title }), void 0)] }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, my: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: message }), void 0) }), void 0) }), void 0), onConfirm && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { width: '100%' }, color: "primary", variant: "contained", onClick: onConfirm }, { children: onConfirmLabel }), void 0) }), void 0)), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 3, mt: onConfirm ? 0 : 7 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleClose, sx: { width: '100%' }, color: "primary", variant: "outlined" }, { children: onCloseLabel }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
|
|
11
15
|
}
|
|
16
|
+
exports.default = SessionModal;
|
|
17
|
+
//# sourceMappingURL=SessionModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionModal.js","sourceRoot":"","sources":["../../src/lib/components/SessionModal.tsx"],"names":[],"mappings":";;;;AACA,4CAA0E;AAC1E,+EAA0C;AAC1C,6FAAwD;AACxD,iDAAgD;AAChD,mGAAkE;AA2BlE,uBA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,IAAI,sBAClB,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,qBAAU,kBAAC,OAAO,EAAC,OAAO,gBAAE,OAAO,YAAc,YAC7C,YACF,EAEN,SAAS,IAAI,CACZ,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,iBAAM,kBACL,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACrB,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,SAAS,gBAEjB,cAAc,YACR,YACJ,CACR,EAED,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAC7C,uBAAC,iBAAM,kBAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,UAAU,gBACpF,YAAY,YACN,YACJ,aACH,YACD,YACA,CACV,CAAC;AACJ,CAAC;AAnED,+BAmEC"}
|
package/components/TitleBox.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { GridSize } from '@mui/material';
|
|
2
2
|
import { Variant } from '@mui/material/styles/createTypography';
|
|
3
3
|
declare type Props = {
|
|
4
|
+
/** The title to show */
|
|
4
5
|
title: string;
|
|
6
|
+
/** The subtitle to show */
|
|
5
7
|
subTitle?: string;
|
|
8
|
+
/** The margin top of the title */
|
|
9
|
+
mtTitle?: number;
|
|
10
|
+
/** The margin bottom of the title */
|
|
6
11
|
mbTitle?: GridSize;
|
|
7
|
-
|
|
12
|
+
/** The margin bottom of the subtitle */
|
|
8
13
|
mbSubTitle?: number;
|
|
14
|
+
/** The variant of the Typografy used for the title */
|
|
9
15
|
variantTitle?: Variant;
|
|
16
|
+
/** The variant of the Typografy used for the subtitle */
|
|
10
17
|
variantSubTitle?: Variant;
|
|
11
18
|
};
|
|
12
|
-
|
|
19
|
+
/** Selfcare's page title */
|
|
20
|
+
export default function TitleBox({ title, subTitle, mbTitle, mtTitle, mbSubTitle, variantTitle, variantSubTitle, }: Props): JSX.Element;
|
|
13
21
|
export {};
|
package/components/TitleBox.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
4
|
// import React from 'react'
|
|
3
5
|
// import { Box } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const material_2 = require("@mui/material");
|
|
8
|
+
/** Selfcare's page title */
|
|
9
|
+
function TitleBox({ title, subTitle, mbTitle = 2, mtTitle, mbSubTitle, variantTitle = 'h1', variantSubTitle = 'h5', }) {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_2.Grid, Object.assign({ container: true, mt: mtTitle }, { children: [(0, jsx_runtime_1.jsx)(material_2.Grid, Object.assign({ item: true, xs: 12, mb: mbTitle }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: variantTitle }, { children: title }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_2.Grid, Object.assign({ item: true, xs: 12, mb: mbSubTitle }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: variantSubTitle, sx: { fontSize: '18px' } }, { children: subTitle }), void 0) }), void 0)] }), void 0));
|
|
8
11
|
}
|
|
12
|
+
exports.default = TitleBox;
|
|
13
|
+
//# sourceMappingURL=TitleBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TitleBox.js","sourceRoot":"","sources":["../../src/lib/components/TitleBox.tsx"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,uCAAuC;AACvC,4CAAqD;AACrD,4CAAqC;AAoBrC,4BAA4B;AAC5B,SAAwB,QAAQ,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,OAAO,EACP,UAAU,EACV,YAAY,GAAG,IAAI,EACnB,eAAe,GAAG,IAAI,GAChB;IACN,OAAO,CACL,wBAAC,eAAI,kBAAC,SAAS,QAAC,EAAE,EAAE,OAAO,iBACzB,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,gBAC5B,uBAAC,qBAAU,kBAAC,OAAO,EAAE,YAAY,gBAAG,KAAK,YAAc,YAClD,EACP,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,gBAC/B,uBAAC,qBAAU,kBAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAC3D,QAAQ,YACE,YACR,aACF,CACR,CAAC;AACJ,CAAC;AArBD,2BAqBC"}
|
package/components/Toast.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
+
/** If this component should be displayed or not */
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** The logo to be rendered. As default a confirm logo will be used */
|
|
6
|
+
logo?: React.ElementType;
|
|
7
|
+
/** The logo to be rendered. As default a confirm logo will be used */
|
|
8
|
+
leftBorderColor?: string;
|
|
9
|
+
/** The toast title */
|
|
3
10
|
title: string;
|
|
11
|
+
/** The toast body */
|
|
4
12
|
message: React.ReactNode;
|
|
5
|
-
|
|
13
|
+
/** The function to be invoked when closing the toast */
|
|
14
|
+
onCloseToast: () => void;
|
|
6
15
|
};
|
|
7
|
-
|
|
16
|
+
/** Selfcare's toast */
|
|
17
|
+
export default function Toast({ open, title, message, onCloseToast, logo, leftBorderColor, }: Props): JSX.Element;
|
|
8
18
|
export {};
|
package/components/Toast.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const system_1 = require("@mui/system");
|
|
8
|
+
const Close_1 = (0, tslib_1.__importDefault)(require("@mui/icons-material/Close"));
|
|
9
|
+
const confirmUserUpdate_svg_1 = require("../assets/confirmUserUpdate.svg");
|
|
10
|
+
const CustomAlert = (0, system_1.styled)(material_1.Alert)({
|
|
7
11
|
'.MuiAlert-icon': { display: 'none' },
|
|
8
12
|
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
/** Selfcare's toast */
|
|
14
|
+
function Toast({ open, title, message, onCloseToast, logo = confirmUserUpdate_svg_1.ReactComponent, leftBorderColor = '#00CF86', }) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: open && ((0, jsx_runtime_1.jsx)(CustomAlert, Object.assign({ className: "userToast", variant: "outlined", sx: {
|
|
16
|
+
position: 'fixed',
|
|
17
|
+
bottom: '64px',
|
|
18
|
+
right: '64px',
|
|
19
|
+
zIndex: 100,
|
|
20
|
+
width: '376px',
|
|
21
|
+
backgroundColor: 'white',
|
|
22
|
+
borderLeft: `4px solid ${leftBorderColor} !important`,
|
|
23
|
+
borderRadius: '5px',
|
|
24
|
+
boxShadow: '0px 0px 45px rgba(0, 0, 0, 0.1) ',
|
|
25
|
+
border: 'none',
|
|
26
|
+
} }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { component: logo, viewBox: "0 0 80 24", sx: { width: '80px', height: '37px', marginLeft: '13px' } }, void 0) }), void 0), (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ item: true, xs: 8 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ pt: 1, pb: 1, sx: { fontSize: '15px', fontWeight: '600' } }, { children: title }), void 0), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: message }, void 0)] }), void 0), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: onCloseToast }, { children: (0, jsx_runtime_1.jsx)(Close_1.default, {}, void 0) }), void 0) }), void 0)] }), void 0) }), void 0)) }, void 0));
|
|
22
27
|
}
|
|
28
|
+
exports.default = Toast;
|
|
29
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/lib/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwC;AACxC,4CAA6E;AAC7E,wCAAqC;AACrC,mFAAkD;AAClD,2EAAgF;AAiBhF,MAAM,WAAW,GAAG,IAAA,eAAM,EAAC,gBAAK,CAAC,CAAC;IAChC,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CACtC,CAAC,CAAC;AAEH,uBAAuB;AACvB,SAAwB,KAAK,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,IAAI,GAAG,sCAAW,EACl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1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const env = (0, tslib_1.__importStar)(require("env-var"));
|
|
6
|
+
exports.CONFIG = {
|
|
2
7
|
URL_FE: {
|
|
3
8
|
LOGIN: '/auth/login',
|
|
4
9
|
LOGOUT: '/auth/logout',
|
|
5
10
|
},
|
|
6
11
|
MOCKS: {
|
|
7
|
-
MOCK_USER:
|
|
12
|
+
MOCK_USER: env.get('REACT_APP_MOCK_USER').default('false').asBool(),
|
|
8
13
|
},
|
|
9
14
|
};
|
|
15
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/config/env.ts"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAElB,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;KACvB;IAED,KAAK,EAAE;QACL,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;KACpE;CACF,CAAC"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyMockExecution = exports.mockedUser = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const userSlice_1 = require("../../redux/slices/userSlice");
|
|
8
|
+
exports.mockedUser = {
|
|
6
9
|
name: 'NAME',
|
|
7
10
|
surname: 'SURNAME',
|
|
8
11
|
uid: 'UID',
|
|
9
12
|
taxCode: 'AAAAAA00A00A000A',
|
|
10
13
|
email: 'a@a.aa',
|
|
11
14
|
};
|
|
12
|
-
|
|
13
|
-
expect(state.user.logged).toMatchObject(mockedUser);
|
|
15
|
+
const verifyMockExecution = (state) => {
|
|
16
|
+
expect(state.user.logged).toMatchObject(exports.mockedUser);
|
|
14
17
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
exports.verifyMockExecution = verifyMockExecution;
|
|
19
|
+
exports.default = (WrappedComponent) => () => {
|
|
20
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
dispatch(userSlice_1.userActions.setLoggedUser(exports.mockedUser));
|
|
19
23
|
}, []);
|
|
20
|
-
return
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(WrappedComponent, {}, void 0);
|
|
21
25
|
};
|
|
26
|
+
//# sourceMappingURL=withLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/__mocks__/withLogin.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,6CAA0C;AAE1C,4DAA2D;AAE9C,QAAA,UAAU,GAAS;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,KAAU,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,kBAAU,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF,kBAAe,CAAC,gBAA0C,EAAE,EAAE,CAAC,GAAG,EAAE;IAClE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,QAAQ,CAAC,uBAAW,CAAC,aAAa,CAAC,kBAAU,CAAC,CAAC,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,uBAAC,gBAAgB,aAAG,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type LoginProps = {};
|
|
3
|
+
/** This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
4
|
+
This decorator has to be applied to components whose acces require an active session.
|
|
5
|
+
Accessing to the components decorated with it without a session will brought to the login page.
|
|
6
|
+
It's possible to modify the login path changing the value in CONFIG.login inside the index.tsx file */
|
|
3
7
|
export default function withLogin<T extends LoginProps>(WrappedComponent: React.ComponentType<T>): React.ComponentType<T>;
|
|
4
8
|
export {};
|
package/decorators/withLogin.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const useLoading_1 = (0, tslib_1.__importDefault)(require("../hooks/useLoading"));
|
|
8
|
+
const useLogin_1 = require("../hooks/useLogin");
|
|
9
|
+
const userSlice_1 = require("../redux/slices/userSlice");
|
|
10
|
+
const constants_1 = require("../utils/constants");
|
|
11
|
+
/** This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
12
|
+
This decorator has to be applied to components whose acces require an active session.
|
|
13
|
+
Accessing to the components decorated with it without a session will brought to the login page.
|
|
14
|
+
It's possible to modify the login path changing the value in CONFIG.login inside the index.tsx file */
|
|
15
|
+
function withLogin(WrappedComponent) {
|
|
9
16
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
10
17
|
const ComponentWithLogin = (props) => {
|
|
11
|
-
const user = useSelector(userSelectors.selectLoggedUser);
|
|
12
|
-
const { attemptSilentLogin } = useLogin();
|
|
13
|
-
const setLoading =
|
|
14
|
-
useEffect(() => {
|
|
18
|
+
const user = (0, react_redux_1.useSelector)(userSlice_1.userSelectors.selectLoggedUser);
|
|
19
|
+
const { attemptSilentLogin } = (0, useLogin_1.useLogin)();
|
|
20
|
+
const setLoading = (0, useLoading_1.default)(constants_1.LOADING_TASK_LOGIN_CHECK);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
15
22
|
async function asyncAttemptSilentLogin() {
|
|
16
23
|
await attemptSilentLogin();
|
|
17
24
|
}
|
|
@@ -21,9 +28,11 @@ export default function withLogin(WrappedComponent) {
|
|
|
21
28
|
asyncAttemptSilentLogin().finally(() => setLoading(false));
|
|
22
29
|
}
|
|
23
30
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
24
|
-
return user ?
|
|
31
|
+
return user ? (0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, props), void 0) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
|
|
25
32
|
};
|
|
26
33
|
// eslint-disable-next-line functional/immutable-data
|
|
27
34
|
ComponentWithLogin.displayName = `withLogin(${displayName})`;
|
|
28
35
|
return ComponentWithLogin;
|
|
29
36
|
}
|
|
37
|
+
exports.default = withLogin;
|
|
38
|
+
//# sourceMappingURL=withLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../src/lib/decorators/withLogin.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,6CAA0C;AAC1C,kFAA6C;AAC7C,gDAA6C;AAC7C,yDAA0D;AAC1D,kDAA8D;AAK9D;;;uGAGuG;AACvG,SAAwB,SAAS,CAC/B,gBAAwC;IAExC,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;IAEzF,MAAM,kBAAkB,GAAG,CAAC,KAAgC,EAAE,EAAE;QAC9D,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,yBAAa,CAAC,gBAAgB,CAAC,CAAC;QACzD,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,oCAAwB,CAAC,CAAC;QAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;YACb,KAAK,UAAU,uBAAuB;gBACpC,MAAM,kBAAkB,EAAE,CAAC;YAC7B,CAAC;YAED,IAAI,CAAC,IAAI,EAAE;gBACT,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEjB,mEAAmE;gBACnE,uBAAuB,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5D;QACH,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kDAAkD;QAE1D,OAAO,IAAI,CAAC,CAAC,CAAC,uBAAC,gBAAgB,oBAAM,KAAW,UAAI,CAAC,CAAC,CAAC,0DAAK,CAAC;IAC/D,CAAC,CAAC;IAEF,qDAAqD;IACrD,kBAAkB,CAAC,WAAW,GAAG,aAAa,WAAW,GAAG,CAAC;IAE7D,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AA9BD,4BA8BC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_redux_1 = require("react-redux");
|
|
4
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
5
|
+
/** @see ErrorBoundary */
|
|
6
|
+
function default_1() {
|
|
7
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8
|
+
return (error) => dispatch(appStateSlice_1.appStateActions.addError(error));
|
|
6
9
|
}
|
|
10
|
+
exports.default = default_1;
|
|
11
|
+
//# sourceMappingURL=useErrorDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAC1C,iEAA0E;AAE1E,yBAAyB;AACzB;IACE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,OAAO,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,+BAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC;AAHD,4BAGC"}
|
package/hooks/useLoading.d.ts
CHANGED
package/hooks/useLoading.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_redux_1 = require("react-redux");
|
|
6
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
7
|
+
/** @see LoadingOverlay */
|
|
8
|
+
function default_1(task) {
|
|
9
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
10
|
+
const ref = (0, react_1.useRef)((0, lodash_1.uniqueId)());
|
|
11
|
+
return (loading) => dispatch(appStateSlice_1.appStateActions.setLoading({ task: `${task}[${ref.current}]`, loading }));
|
|
9
12
|
}
|
|
13
|
+
exports.default = default_1;
|
|
14
|
+
//# sourceMappingURL=useLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoading.js","sourceRoot":"","sources":["../../src/lib/hooks/useLoading.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,iCAA+B;AAC/B,6CAA0C;AAC1C,iEAAgE;AAEhE,0BAA0B;AAC1B,mBAAyB,IAAY;IACnC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,IAAA,iBAAQ,GAAE,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAgB,EAAE,EAAE,CAC1B,QAAQ,CAAC,+BAAe,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,GAAG,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC;AALD,4BAKC"}
|
package/hooks/useLogin.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const storage_utils_1 = require("../utils/storage-utils");
|
|
8
|
+
const env_1 = require("../config/env");
|
|
9
|
+
const constants_1 = require("../utils/constants");
|
|
10
|
+
const userSlice_1 = require("../redux/slices/userSlice");
|
|
7
11
|
const testToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp3dF9kZjplNjoxOTplYToxZTpjZTplNjo3Yjo3MDo0MjoyYzphMjpjZDo4Yjo1MjowYiJ9.eyJlbWFpbCI6ImZ1cmlvdml0YWxlQG1hcnRpbm8uaXQiLCJmYW1pbHlfbmFtZSI6IlNhcnRvcmkiLCJmaXNjYWxfbnVtYmVyIjoiU1JUTkxNMDlUMDZHNjM1UyIsIm5hbWUiOiJBbnNlbG1vIiwiZnJvbV9hYSI6ZmFsc2UsInVpZCI6IjliMTdjZTcwLWY3OWYtNDJkOS04YjBlLTRlN2ViNGQ4ODA3NCIsImxldmVsIjoiTDIiLCJpYXQiOjE2Mzk1OTI2NTMsImlzcyI6IlNQSUQiLCJqdGkiOiIwMUZQWk5DV1c0RFhIQ0JZNFlHVFBKTkM2UiJ9.Cz6bZ1degD0APpJS3rfLPdjpjBE9JBGByVoLcFtqGhDxRAOhP_5aKqE0-1S9u9QUCakmhLA8i1auV7ImP8CLMaJTyUGUwz85yYL9KgqcRZ9qsYghFDqBQsh-n5_4Ldsu1-vBp2klwpJA87ppdzEyLZnSp6kUhpytFf00XtmSOYvt6-OMI6K6bBVFGXk_IYGs4KHx3-fij1DGg-_8BhghtkvJVyC2p9R4XezT8oXg55H-sBigTPdk9LssDa75Pj91zwPrbwTOBp9Tgk0HqOgieEDDpIuVplJI2uaq9YpDNyZkR8RnkSV072gPWlrJXDEb1-zXty7nT8NcGdRGTHDkkQ';
|
|
8
|
-
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
|
-
const setUser = (user) => dispatch(userActions.setLoggedUser(user));
|
|
12
|
+
const useLogin = () => {
|
|
13
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
14
|
+
const setUser = (user) => dispatch(userSlice_1.userActions.setLoggedUser(user));
|
|
11
15
|
const attemptSilentLogin = async () => {
|
|
12
|
-
if (CONFIG.MOCKS.MOCK_USER
|
|
16
|
+
if (env_1.CONFIG.MOCKS.MOCK_USER) {
|
|
13
17
|
setUser({
|
|
14
18
|
uid: '0',
|
|
15
19
|
taxCode: 'AAAAAA00A00A000A',
|
|
@@ -17,16 +21,16 @@ export const useLogin = () => {
|
|
|
17
21
|
surname: 'loggedSurname',
|
|
18
22
|
email: 'loggedEmail@aa.aa',
|
|
19
23
|
});
|
|
20
|
-
storageWrite(STORAGE_KEY_TOKEN, testToken, 'string');
|
|
24
|
+
(0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_TOKEN, testToken, 'string');
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
23
|
-
const sessionStorageUser = storageRead(STORAGE_KEY_USER, 'object');
|
|
27
|
+
const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
|
|
24
28
|
// If there are no credentials, it is impossible to get the user, so
|
|
25
|
-
if (
|
|
29
|
+
if ((0, isEmpty_1.default)(sessionStorageUser)) {
|
|
26
30
|
// Remove any partial data that might have remained, just for safety
|
|
27
|
-
storageDelete(STORAGE_KEY_USER);
|
|
31
|
+
(0, storage_utils_1.storageDelete)(constants_1.STORAGE_KEY_USER);
|
|
28
32
|
// Go to the login view
|
|
29
|
-
window.location.assign(CONFIG.URL_FE.LOGIN);
|
|
33
|
+
window.location.assign(env_1.CONFIG.URL_FE.LOGIN);
|
|
30
34
|
// This return is necessary
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
@@ -35,3 +39,5 @@ export const useLogin = () => {
|
|
|
35
39
|
};
|
|
36
40
|
return { attemptSilentLogin };
|
|
37
41
|
};
|
|
42
|
+
exports.useLogin = useLogin;
|
|
43
|
+
//# sourceMappingURL=useLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,6CAA0C;AAC1C,0DAAkF;AAClF,uCAAuC;AACvC,kDAAyE;AAEzE,yDAAwD;AAExD,MAAM,SAAS,GACb,0xBAA0xB,CAAC;AAEtxB,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,uBAAW,CAAC,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3
|
+
exports.LoadingOverlay = exports.ErrorBoundary = exports.Toast = exports.TitleBox = exports.SessionModal = exports.FilterModal = exports.CustomPagination = exports.CustomAvatar = exports.Footer = exports.Header = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var Header_1 = require("./components/Header/Header");
|
|
6
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Header_1).default; } });
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./components/Header/Header"), exports);
|
|
8
|
+
var Footer_1 = require("./components/Footer/Footer");
|
|
9
|
+
Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Footer_1).default; } });
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./components/Footer/Footer"), exports);
|
|
11
|
+
var CustomAvatar_1 = require("./components/CustomAvatar");
|
|
12
|
+
Object.defineProperty(exports, "CustomAvatar", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomAvatar_1).default; } });
|
|
13
|
+
(0, tslib_1.__exportStar)(require("./components/CustomAvatar"), exports);
|
|
14
|
+
var CustomPagination_1 = require("./components/CustomPagination");
|
|
15
|
+
Object.defineProperty(exports, "CustomPagination", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomPagination_1).default; } });
|
|
16
|
+
(0, tslib_1.__exportStar)(require("./components/CustomPagination"), exports);
|
|
17
|
+
var FilterModal_1 = require("./components/FilterModal");
|
|
18
|
+
Object.defineProperty(exports, "FilterModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(FilterModal_1).default; } });
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./components/FilterModal"), exports);
|
|
20
|
+
var SessionModal_1 = require("./components/SessionModal");
|
|
21
|
+
Object.defineProperty(exports, "SessionModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(SessionModal_1).default; } });
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./components/SessionModal"), exports);
|
|
23
|
+
var TitleBox_1 = require("./components/TitleBox");
|
|
24
|
+
Object.defineProperty(exports, "TitleBox", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(TitleBox_1).default; } });
|
|
25
|
+
(0, tslib_1.__exportStar)(require("./components/TitleBox"), exports);
|
|
26
|
+
var Toast_1 = require("./components/Toast");
|
|
27
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Toast_1).default; } });
|
|
28
|
+
(0, tslib_1.__exportStar)(require("./components/Toast"), exports);
|
|
29
|
+
var ErrorBoundary_1 = require("./components/ErrorBoundary/ErrorBoundary");
|
|
30
|
+
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ErrorBoundary_1).default; } });
|
|
31
|
+
(0, tslib_1.__exportStar)(require("./components/ErrorBoundary/ErrorBoundary"), exports);
|
|
32
|
+
var LoadingOverlay_1 = require("./components/Loading/LoadingOverlay");
|
|
33
|
+
Object.defineProperty(exports, "LoadingOverlay", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(LoadingOverlay_1).default; } });
|
|
34
|
+
(0, tslib_1.__exportStar)(require("./components/Loading/LoadingOverlay"), exports);
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kEAA4E;AAAnE,kJAAA,OAAO,OAAoB;AACpC,6EAA8C;AAE9C,wDAAkE;AAAzD,wIAAA,OAAO,OAAe;AAC/B,wEAAyC;AAEzC,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kDAA4D;AAAnD,kIAAA,OAAO,OAAY;AAC5B,qEAAsC;AAEtC,4CAAsD;AAA7C,4HAAA,OAAO,OAAS;AACzB,kEAAmC;AAEnC,0EAAoF;AAA3E,4IAAA,OAAO,OAAiB;AACjC,wFAAyD;AAEzD,sEAAgF;AAAvE,8IAAA,OAAO,OAAkB;AAClC,mFAAoD"}
|
package/model/Page.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../src/lib/model/Page.ts"],"names":[],"mappings":""}
|