@uxf/cms 11.74.0 → 11.74.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.
- package/api/index.d.ts +165 -0
- package/api/index.js +100 -0
- package/api/swr.d.ts +76 -0
- package/api/swr.js +43 -0
- package/config/container.d.ts +29 -0
- package/config/container.js +24 -0
- package/config/index.d.ts +2 -0
- package/config/index.js +6 -0
- package/content-builder/content-builder-body.d.ts +6 -0
- package/content-builder/content-builder-body.js +10 -0
- package/content-builder/content-builder-header.d.ts +7 -0
- package/content-builder/content-builder-header.js +15 -0
- package/content-builder/content-builder-root.d.ts +11 -0
- package/content-builder/content-builder-root.js +13 -0
- package/content-builder/content-builder-sidebar.d.ts +7 -0
- package/content-builder/content-builder-sidebar.js +12 -0
- package/content-builder/content-builder.d.ts +14 -0
- package/content-builder/content-builder.js +57 -0
- package/content-builder/forms/content-builder-basic-form.d.ts +10 -0
- package/content-builder/forms/content-builder-basic-form.js +49 -0
- package/content-builder/forms/content-builder-seo-form.d.ts +10 -0
- package/content-builder/forms/content-builder-seo-form.js +22 -0
- package/content-builder/index.d.ts +4 -0
- package/content-builder/index.js +20 -0
- package/content-builder/map-content-response-to-form-data.d.ts +3 -0
- package/content-builder/map-content-response-to-form-data.js +44 -0
- package/content-builder/map-form-data-to-content-request.d.ts +2 -0
- package/content-builder/map-form-data-to-content-request.js +28 -0
- package/content-builder/translations.d.ts +127 -0
- package/content-builder/translations.js +128 -0
- package/content-builder/types.d.ts +186 -0
- package/content-builder/types.js +2 -0
- package/content-builder/use-content-builder-form-api.d.ts +3 -0
- package/content-builder/use-content-builder-form-api.js +7 -0
- package/context/cms-provider.d.ts +7 -0
- package/context/cms-provider.js +18 -0
- package/deprecated/api/api-client.d.ts +15 -0
- package/deprecated/api/api-client.js +86 -0
- package/deprecated/hoc/with-authenticate.d.ts +6 -0
- package/deprecated/hoc/with-authenticate.js +61 -0
- package/deprecated/redux/configure-store.d.ts +3 -0
- package/deprecated/redux/configure-store.js +16 -0
- package/deprecated/redux/entities/actions.d.ts +30 -0
- package/deprecated/redux/entities/actions.js +15 -0
- package/deprecated/redux/entities/index.d.ts +2 -0
- package/deprecated/redux/entities/index.js +18 -0
- package/deprecated/redux/entities/reducer.d.ts +3 -0
- package/deprecated/redux/entities/reducer.js +36 -0
- package/deprecated/redux/entities/selectors.d.ts +10 -0
- package/deprecated/redux/entities/selectors.js +16 -0
- package/deprecated/redux/index.d.ts +3 -0
- package/deprecated/redux/index.js +22 -0
- package/deprecated/redux/redux-helper.d.ts +15 -0
- package/deprecated/redux/redux-helper.js +6 -0
- package/deprecated/redux/types.d.ts +7 -0
- package/deprecated/redux/types.js +2 -0
- package/deprecated/redux/user/actions.d.ts +19 -0
- package/deprecated/redux/user/actions.js +14 -0
- package/deprecated/redux/user/index.d.ts +2 -0
- package/deprecated/redux/user/index.js +18 -0
- package/deprecated/redux/user/reducer.d.ts +3 -0
- package/deprecated/redux/user/reducer.js +21 -0
- package/deprecated/redux/user/selectors.d.ts +3 -0
- package/deprecated/redux/user/selectors.js +5 -0
- package/deprecated/redux/with-redux-store.d.ts +1 -0
- package/deprecated/redux/with-redux-store.js +70 -0
- package/deprecated/security/cms-authorizator.d.ts +3 -0
- package/deprecated/security/cms-authorizator.js +8 -0
- package/deprecated/types/app.d.ts +6 -0
- package/deprecated/types/app.js +2 -0
- package/deprecated/types/form.d.ts +25 -0
- package/deprecated/types/form.js +16 -0
- package/errors/BadRequestError.d.ts +18 -0
- package/errors/BadRequestError.js +14 -0
- package/errors/ForbiddenError.d.ts +4 -0
- package/errors/ForbiddenError.js +13 -0
- package/errors/NetworkError.d.ts +4 -0
- package/errors/NetworkError.js +13 -0
- package/errors/UnauthorizedError.d.ts +4 -0
- package/errors/UnauthorizedError.js +13 -0
- package/errors/ValidationError.d.ts +7 -0
- package/errors/ValidationError.js +17 -0
- package/form-renderer/field/content-dynamic.d.ts +8 -0
- package/form-renderer/field/content-dynamic.js +15 -0
- package/form-renderer/field/content.d.ts +5 -0
- package/form-renderer/field/content.js +38 -0
- package/forms/change-password-form/change-password-form.d.ts +3 -0
- package/forms/change-password-form/change-password-form.js +31 -0
- package/forms/change-password-form/index.d.ts +2 -0
- package/forms/change-password-form/index.js +18 -0
- package/forms/change-password-form/translations.d.ts +35 -0
- package/forms/change-password-form/translations.js +36 -0
- package/forms/change-password-form/types.d.ts +13 -0
- package/forms/change-password-form/types.js +2 -0
- package/forms/components/wysiwyg-input/index.d.ts +1 -0
- package/forms/components/wysiwyg-input/index.js +17 -0
- package/forms/components/wysiwyg-input/wysiwyg-input.d.ts +26 -0
- package/forms/components/wysiwyg-input/wysiwyg-input.js +83 -0
- package/forms/forgotten-password-form/forgotten-password-form.d.ts +3 -0
- package/forms/forgotten-password-form/forgotten-password-form.js +52 -0
- package/forms/forgotten-password-form/index.d.ts +2 -0
- package/forms/forgotten-password-form/index.js +18 -0
- package/forms/forgotten-password-form/translations.d.ts +17 -0
- package/forms/forgotten-password-form/translations.js +18 -0
- package/forms/forgotten-password-form/types.d.ts +10 -0
- package/forms/forgotten-password-form/types.js +2 -0
- package/forms/invite-user-form/index.d.ts +2 -0
- package/forms/invite-user-form/index.js +18 -0
- package/forms/invite-user-form/invite-user-form.d.ts +3 -0
- package/forms/invite-user-form/invite-user-form.js +33 -0
- package/forms/invite-user-form/translations.d.ts +35 -0
- package/forms/invite-user-form/translations.js +36 -0
- package/forms/invite-user-form/types.d.ts +15 -0
- package/forms/invite-user-form/types.js +2 -0
- package/forms/login-form/index.d.ts +2 -0
- package/forms/login-form/index.js +18 -0
- package/forms/login-form/login-form.d.ts +3 -0
- package/forms/login-form/login-form.js +51 -0
- package/forms/login-form/translations.d.ts +23 -0
- package/forms/login-form/translations.js +24 -0
- package/forms/login-form/types.d.ts +11 -0
- package/forms/login-form/types.js +2 -0
- package/forms/renew-password-form/index.d.ts +2 -0
- package/forms/renew-password-form/index.js +18 -0
- package/forms/renew-password-form/renew-password-form.d.ts +3 -0
- package/forms/renew-password-form/renew-password-form.js +53 -0
- package/forms/renew-password-form/translations.d.ts +29 -0
- package/forms/renew-password-form/translations.js +30 -0
- package/forms/renew-password-form/types.d.ts +11 -0
- package/forms/renew-password-form/types.js +2 -0
- package/lib/api/create-axios-instance.d.ts +6 -0
- package/lib/api/create-axios-instance.js +17 -0
- package/lib/api/create-axios-request.d.ts +3 -0
- package/lib/api/create-axios-request.js +39 -0
- package/lib/api/create-use-axios-request.d.ts +5 -0
- package/lib/api/create-use-axios-request.js +35 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +19 -0
- package/lib/api/types.d.ts +18 -0
- package/lib/api/types.js +2 -0
- package/lib/layout/breadcrumbs.d.ts +9 -0
- package/lib/layout/breadcrumbs.js +21 -0
- package/lib/layout/index.d.ts +3 -0
- package/lib/layout/index.js +19 -0
- package/lib/layout/layout-container.d.ts +3 -0
- package/lib/layout/layout-container.js +22 -0
- package/lib/layout/layout.d.ts +3 -0
- package/lib/layout/layout.js +47 -0
- package/lib/layout/sidebar.d.ts +3 -0
- package/lib/layout/sidebar.js +77 -0
- package/lib/layout/styles.d.ts +1 -0
- package/lib/layout/styles.js +4 -0
- package/lib/layout/types.d.ts +36 -0
- package/lib/layout/types.js +2 -0
- package/lib/login-layout/index.d.ts +2 -0
- package/lib/login-layout/index.js +18 -0
- package/lib/login-layout/login-layout.d.ts +3 -0
- package/lib/login-layout/login-layout.js +19 -0
- package/lib/login-layout/types.d.ts +9 -0
- package/lib/login-layout/types.js +2 -0
- package/lib/menu/active-item-resolver.d.ts +7 -0
- package/lib/menu/active-item-resolver.js +42 -0
- package/lib/menu/factory.d.ts +10 -0
- package/lib/menu/factory.js +40 -0
- package/lib/menu/index.d.ts +5 -0
- package/lib/menu/index.js +21 -0
- package/lib/menu/mobile-bar.d.ts +8 -0
- package/lib/menu/mobile-bar.js +54 -0
- package/lib/menu/model.d.ts +56 -0
- package/lib/menu/model.js +112 -0
- package/lib/menu/types.d.ts +5 -0
- package/lib/menu/types.js +2 -0
- package/lib/menu/ui/list-item/index.d.ts +2 -0
- package/lib/menu/ui/list-item/index.js +18 -0
- package/lib/menu/ui/list-item/list-item.d.ts +3 -0
- package/lib/menu/ui/list-item/list-item.js +37 -0
- package/lib/menu/ui/list-item/types.d.ts +19 -0
- package/lib/menu/ui/list-item/types.js +2 -0
- package/lib/menu/ui/menu-custom-item.d.ts +6 -0
- package/lib/menu/ui/menu-custom-item.js +17 -0
- package/lib/menu/ui/menu-item.d.ts +6 -0
- package/lib/menu/ui/menu-item.js +55 -0
- package/lib/menu/ui/menu-super-section-item.d.ts +6 -0
- package/lib/menu/ui/menu-super-section-item.js +40 -0
- package/lib/menu/ui/menu.d.ts +6 -0
- package/lib/menu/ui/menu.js +37 -0
- package/lib/menu/ui/sub-menu/sub-menu-item.d.ts +7 -0
- package/lib/menu/ui/sub-menu/sub-menu-item.js +23 -0
- package/lib/menu/ui/sub-menu/sub-menu-mobile.d.ts +8 -0
- package/lib/menu/ui/sub-menu/sub-menu-mobile.js +48 -0
- package/lib/menu/ui/sub-menu/sub-menu.d.ts +7 -0
- package/lib/menu/ui/sub-menu/sub-menu.js +46 -0
- package/lib/menu/ui/sub-menu/use-sub-menu.d.ts +49 -0
- package/lib/menu/ui/sub-menu/use-sub-menu.js +45 -0
- package/lib/menu/ui/translations.d.ts +17 -0
- package/lib/menu/ui/translations.js +18 -0
- package/lib/menu/ui/user-menu.d.ts +6 -0
- package/lib/menu/ui/user-menu.js +55 -0
- package/package.json +6 -6
- package/pages/content-builder/components/form-content.d.ts +12 -0
- package/pages/content-builder/components/form-content.js +64 -0
- package/pages/content-builder/components/form-root-fields.d.ts +16 -0
- package/pages/content-builder/components/form-root-fields.js +62 -0
- package/pages/content-builder/components/form.d.ts +12 -0
- package/pages/content-builder/components/form.js +83 -0
- package/pages/content-builder/components/header.d.ts +6 -0
- package/pages/content-builder/components/header.js +18 -0
- package/pages/content-builder/constants.d.ts +6 -0
- package/pages/content-builder/constants.js +10 -0
- package/pages/content-builder/content/feature-section.d.ts +17 -0
- package/pages/content-builder/content/feature-section.js +62 -0
- package/pages/content-builder/content/gallery.d.ts +9 -0
- package/pages/content-builder/content/gallery.js +29 -0
- package/pages/content-builder/content/hero-section.d.ts +12 -0
- package/pages/content-builder/content/hero-section.js +35 -0
- package/pages/content-builder/content/people.d.ts +17 -0
- package/pages/content-builder/content/people.js +61 -0
- package/pages/content-builder/content/wysiwyg.d.ts +15 -0
- package/pages/content-builder/content/wysiwyg.js +32 -0
- package/pages/content-builder/content-builder-page.d.ts +3 -0
- package/pages/content-builder/content-builder-page.js +107 -0
- package/pages/content-builder/content-field.d.ts +10 -0
- package/pages/content-builder/content-field.js +62 -0
- package/pages/content-builder/content-header.d.ts +3 -0
- package/pages/content-builder/content-header.js +55 -0
- package/pages/content-builder/context/details-visibility-context.d.ts +4 -0
- package/pages/content-builder/context/details-visibility-context.js +58 -0
- package/pages/content-builder/hooks/use-sortable.d.ts +15 -0
- package/pages/content-builder/hooks/use-sortable.js +57 -0
- package/pages/content-builder/index.d.ts +5 -0
- package/pages/content-builder/index.js +21 -0
- package/pages/content-builder/mapper.d.ts +4 -0
- package/pages/content-builder/mapper.js +69 -0
- package/pages/content-builder/types.d.ts +94 -0
- package/pages/content-builder/types.js +2 -0
- package/pages/forgotten-password-page/forgotten-password-page.d.ts +5 -0
- package/pages/forgotten-password-page/forgotten-password-page.js +49 -0
- package/pages/forgotten-password-page/index.d.ts +2 -0
- package/pages/forgotten-password-page/index.js +18 -0
- package/pages/forgotten-password-page/types.d.ts +11 -0
- package/pages/forgotten-password-page/types.js +2 -0
- package/pages/grid-page/get-initial-props-helper.d.ts +4 -0
- package/pages/grid-page/get-initial-props-helper.js +20 -0
- package/pages/grid-page/grid-page.d.ts +6 -0
- package/pages/grid-page/grid-page.js +161 -0
- package/pages/grid-page/index.d.ts +1 -0
- package/pages/grid-page/index.js +5 -0
- package/pages/grid-page/types.d.ts +65 -0
- package/pages/grid-page/types.js +2 -0
- package/pages/grid-page/use-hidden-columns.d.ts +4 -0
- package/pages/grid-page/use-hidden-columns.js +17 -0
- package/pages/invite-user-page/index.d.ts +2 -0
- package/pages/invite-user-page/index.js +18 -0
- package/pages/invite-user-page/invite-user-page.d.ts +2 -0
- package/pages/invite-user-page/invite-user-page.js +57 -0
- package/pages/invite-user-page/types.d.ts +12 -0
- package/pages/invite-user-page/types.js +2 -0
- package/pages/login-page/index.d.ts +2 -0
- package/pages/login-page/index.js +18 -0
- package/pages/login-page/login-page.d.ts +5 -0
- package/pages/login-page/login-page.js +80 -0
- package/pages/login-page/types.d.ts +21 -0
- package/pages/login-page/types.js +2 -0
- package/pages/renew-password-page/index.d.ts +2 -0
- package/pages/renew-password-page/index.js +18 -0
- package/pages/renew-password-page/renew-password-page.d.ts +9 -0
- package/pages/renew-password-page/renew-password-page.js +53 -0
- package/pages/renew-password-page/types.d.ts +14 -0
- package/pages/renew-password-page/types.js +2 -0
- package/pages/translations.d.ts +93 -0
- package/pages/translations.js +94 -0
- package/security/restricted-page.d.ts +10 -0
- package/security/restricted-page.js +40 -0
- package/security/translations.d.ts +29 -0
- package/security/translations.js +30 -0
- package/security/use-logged-user.d.ts +5 -0
- package/security/use-logged-user.js +17 -0
- package/ui/avatar/avatar.d.ts +11 -0
- package/ui/avatar/avatar.js +47 -0
- package/ui/avatar/get-avatar-user-letters.d.ts +1 -0
- package/ui/avatar/get-avatar-user-letters.js +18 -0
- package/ui/avatar/index.d.ts +3 -0
- package/ui/avatar/index.js +5 -0
- package/ui/avatar/theme.d.ts +11 -0
- package/ui/avatar/theme.js +2 -0
- package/ui/copy-to-clipboard/copy-to-clipboard.d.ts +3 -0
- package/ui/copy-to-clipboard/copy-to-clipboard.js +47 -0
- package/ui/copy-to-clipboard/index.d.ts +2 -0
- package/ui/copy-to-clipboard/index.js +18 -0
- package/ui/copy-to-clipboard/translations.d.ts +17 -0
- package/ui/copy-to-clipboard/translations.js +18 -0
- package/ui/copy-to-clipboard/types.d.ts +7 -0
- package/ui/copy-to-clipboard/types.js +2 -0
- package/ui/copy-to-clipboard-button/copy-to-clipboard-button.d.ts +3 -0
- package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +48 -0
- package/ui/copy-to-clipboard-button/index.d.ts +2 -0
- package/ui/copy-to-clipboard-button/index.js +18 -0
- package/ui/copy-to-clipboard-button/translations.d.ts +17 -0
- package/ui/copy-to-clipboard-button/translations.js +18 -0
- package/ui/copy-to-clipboard-button/types.d.ts +6 -0
- package/ui/copy-to-clipboard-button/types.js +2 -0
- package/ui/index.d.ts +1 -0
- package/ui/index.js +6 -0
- package/ui/tw-tokens/tw-box-shadow.d.ts +12 -0
- package/ui/tw-tokens/tw-box-shadow.js +15 -0
- package/ui/tw-tokens/tw-colors.d.ts +475 -0
- package/ui/tw-tokens/tw-colors.js +474 -0
- package/ui/tw-tokens/tw-containers.d.ts +8 -0
- package/ui/tw-tokens/tw-containers.js +5 -0
- package/ui/tw-tokens/tw-font-size.d.ts +55 -0
- package/ui/tw-tokens/tw-font-size.js +32 -0
- package/ui/tw-tokens/tw-font-weight.d.ts +12 -0
- package/ui/tw-tokens/tw-font-weight.js +15 -0
- package/ui/tw-tokens/tw-line-height.d.ts +17 -0
- package/ui/tw-tokens/tw-line-height.js +20 -0
- package/ui/tw-tokens/tw-screens.d.ts +8 -0
- package/ui/tw-tokens/tw-screens.js +5 -0
- package/ui/tw-tokens/tw-spacing.d.ts +39 -0
- package/ui/tw-tokens/tw-spacing.js +42 -0
- package/ui/tw-tokens/tw-z-index.d.ts +21 -0
- package/ui/tw-tokens/tw-z-index.js +24 -0
- package/ui/widget/index.d.ts +2 -0
- package/ui/widget/index.js +18 -0
- package/ui/widget/types.d.ts +6 -0
- package/ui/widget/types.js +2 -0
- package/ui/widget/widget.d.ts +3 -0
- package/ui/widget/widget.js +15 -0
- package/utils/remove-confirm-handler.d.ts +1 -0
- package/utils/remove-confirm-handler.js +31 -0
- package/utils/translations.d.ts +23 -0
- package/utils/translations.js +24 -0
- package/utils/use-viewport-height.d.ts +3 -0
- package/utils/use-viewport-height.js +28 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.LoginPage = void 0;
|
30
|
+
const router_1 = __importDefault(require("next/router"));
|
31
|
+
const react_1 = __importStar(require("react"));
|
32
|
+
const api_1 = require("../../api");
|
33
|
+
const login_form_1 = require("../../forms/login-form");
|
34
|
+
const login_layout_1 = require("../../lib/login-layout");
|
35
|
+
const INITIAL_VALUES = {
|
36
|
+
username: "",
|
37
|
+
password: "",
|
38
|
+
};
|
39
|
+
const LoginPage = (config) => {
|
40
|
+
const Component = (props) => {
|
41
|
+
var _a, _b;
|
42
|
+
const onLogin = (0, react_1.useCallback)(async (values) => {
|
43
|
+
try {
|
44
|
+
const response = await (0, api_1.login)(null, values).then((r) => r.data);
|
45
|
+
await config.onLoginDone(response, props.redirectUrl);
|
46
|
+
}
|
47
|
+
catch (e) {
|
48
|
+
config.handleError(e);
|
49
|
+
}
|
50
|
+
}, [props.redirectUrl]);
|
51
|
+
return (react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, hideTitle: (_b = config.ui) === null || _b === void 0 ? void 0 : _b.hideTitle, pageTitle: config.pageTitle, subTitle: config.subTitle, title: config.title },
|
52
|
+
react_1.default.createElement(login_form_1.LoginForm, { defaultValues: INITIAL_VALUES, onForgottenPassword: config.onForgottenPassword, onSubmit: onLogin })));
|
53
|
+
};
|
54
|
+
Component.getInitialProps = async (ctx) => {
|
55
|
+
const query = ctx.query;
|
56
|
+
if (config.loggedUserRedirectUrl) {
|
57
|
+
try {
|
58
|
+
await (0, api_1.getLoggedUser)(ctx);
|
59
|
+
if (typeof window === "undefined") {
|
60
|
+
if (ctx.res && !ctx.res.headersSent) {
|
61
|
+
ctx.res.writeHead(302, { Location: config.loggedUserRedirectUrl });
|
62
|
+
ctx.res.end();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
await router_1.default.push(config.loggedUserRedirectUrl);
|
67
|
+
}
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
69
|
+
}
|
70
|
+
catch (e) {
|
71
|
+
// do nothing
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return {
|
75
|
+
redirectUrl: query.redirect,
|
76
|
+
};
|
77
|
+
};
|
78
|
+
return Component;
|
79
|
+
};
|
80
|
+
exports.LoginPage = LoginPage;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ReactNode } from "react";
|
2
|
+
import { LoginResponse } from "../../api";
|
3
|
+
export interface InitialProps {
|
4
|
+
redirectUrl?: string;
|
5
|
+
}
|
6
|
+
export interface LoginPageConfig {
|
7
|
+
pageTitle?: string;
|
8
|
+
title: ReactNode;
|
9
|
+
subTitle?: ReactNode;
|
10
|
+
onForgottenPassword?: () => void;
|
11
|
+
onLoginDone: (loginResponse: LoginResponse, redirectUrl?: string) => Promise<void>;
|
12
|
+
loggedUserRedirectUrl?: string;
|
13
|
+
ui?: {
|
14
|
+
hideTitle?: boolean;
|
15
|
+
Logo?: ReactNode;
|
16
|
+
};
|
17
|
+
handleError: (e: unknown) => void;
|
18
|
+
}
|
19
|
+
export interface LoginPageQueryParams {
|
20
|
+
redirect?: string;
|
21
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./renew-password-page"), exports);
|
18
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { RenewPasswordPageConfig } from "./types";
|
3
|
+
interface PageProps {
|
4
|
+
token: string;
|
5
|
+
}
|
6
|
+
export declare const RenewPasswordPage: (config: RenewPasswordPageConfig) => React.FunctionComponent<PageProps> & {
|
7
|
+
getInitialProps?(context: import("next").NextPageContext): PageProps | Promise<PageProps>;
|
8
|
+
};
|
9
|
+
export {};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.RenewPasswordPage = void 0;
|
27
|
+
const router_1 = require("@uxf/router");
|
28
|
+
const react_1 = __importStar(require("react"));
|
29
|
+
const renew_password_form_1 = require("../../forms/renew-password-form");
|
30
|
+
const login_layout_1 = require("../../lib/login-layout");
|
31
|
+
const INITIAL_VALUES = {
|
32
|
+
password: "",
|
33
|
+
passwordAgain: "",
|
34
|
+
};
|
35
|
+
const RenewPasswordPage = (config) => {
|
36
|
+
const Component = (props) => {
|
37
|
+
var _a;
|
38
|
+
const onSubmit = (0, react_1.useCallback)(async (values) => {
|
39
|
+
await config.onSubmit(props.token, values);
|
40
|
+
}, [props.token]);
|
41
|
+
return (react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, pageTitle: config.pageTitle, title: config.title },
|
42
|
+
react_1.default.createElement(renew_password_form_1.RenewPasswordForm, { defaultValues: INITIAL_VALUES, onSubmit: onSubmit, passwordRules: config.passwordRules })));
|
43
|
+
};
|
44
|
+
Component.getInitialProps = async (ctx) => {
|
45
|
+
const token = (0, router_1.queryParamToStringStrict)(ctx.query.token);
|
46
|
+
if (config.checkToken) {
|
47
|
+
await config.checkToken(ctx, token);
|
48
|
+
}
|
49
|
+
return { token };
|
50
|
+
};
|
51
|
+
return Component;
|
52
|
+
};
|
53
|
+
exports.RenewPasswordPage = RenewPasswordPage;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { NextPageContext } from "next";
|
2
|
+
import { ReactNode } from "react";
|
3
|
+
import { SubmitErrorHandler, UseControllerProps } from "react-hook-form";
|
4
|
+
import { RenewPasswordFormData } from "../../forms/renew-password-form";
|
5
|
+
export interface RenewPasswordPageConfig {
|
6
|
+
pageTitle?: string;
|
7
|
+
title: ReactNode;
|
8
|
+
checkToken?: (ctx: NextPageContext, token: string) => Promise<void>;
|
9
|
+
onSubmit: (token: string, values: RenewPasswordFormData) => SubmitErrorHandler<RenewPasswordFormData> | Promise<SubmitErrorHandler<RenewPasswordFormData> | undefined | void> | undefined | void;
|
10
|
+
ui?: {
|
11
|
+
Logo?: ReactNode;
|
12
|
+
};
|
13
|
+
passwordRules?: UseControllerProps<RenewPasswordFormData>["rules"];
|
14
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
"uxf-cms-pages-content-builder": {
|
3
|
+
components: {
|
4
|
+
"content-header": {
|
5
|
+
"confirm-delete-section": {
|
6
|
+
cs: string;
|
7
|
+
};
|
8
|
+
};
|
9
|
+
header: {
|
10
|
+
save: {
|
11
|
+
cs: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
content: {
|
16
|
+
"hero-section": {
|
17
|
+
title: {
|
18
|
+
cs: string;
|
19
|
+
};
|
20
|
+
subtitle: {
|
21
|
+
cs: string;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
"feature-section": {
|
25
|
+
title: {
|
26
|
+
cs: string;
|
27
|
+
};
|
28
|
+
subtitle: {
|
29
|
+
cs: string;
|
30
|
+
};
|
31
|
+
"add-feature": {
|
32
|
+
cs: string;
|
33
|
+
};
|
34
|
+
"confirm-delete-feature": {
|
35
|
+
cs: string;
|
36
|
+
};
|
37
|
+
"feature-title": {
|
38
|
+
cs: string;
|
39
|
+
};
|
40
|
+
"delete-feature": {
|
41
|
+
cs: string;
|
42
|
+
};
|
43
|
+
"feature-name": {
|
44
|
+
cs: string;
|
45
|
+
};
|
46
|
+
image: {
|
47
|
+
cs: string;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
people: {
|
51
|
+
"confirm-delete-person": {
|
52
|
+
cs: string;
|
53
|
+
};
|
54
|
+
"person-title": {
|
55
|
+
cs: string;
|
56
|
+
};
|
57
|
+
"delete-person": {
|
58
|
+
cs: string;
|
59
|
+
};
|
60
|
+
name: {
|
61
|
+
cs: string;
|
62
|
+
};
|
63
|
+
image: {
|
64
|
+
cs: string;
|
65
|
+
};
|
66
|
+
description: {
|
67
|
+
cs: string;
|
68
|
+
};
|
69
|
+
text: {
|
70
|
+
cs: string;
|
71
|
+
};
|
72
|
+
phone: {
|
73
|
+
cs: string;
|
74
|
+
};
|
75
|
+
"add-person": {
|
76
|
+
cs: string;
|
77
|
+
};
|
78
|
+
};
|
79
|
+
wysiwyg: {
|
80
|
+
text: {
|
81
|
+
cs: string;
|
82
|
+
};
|
83
|
+
placeholder: {
|
84
|
+
cs: string;
|
85
|
+
};
|
86
|
+
};
|
87
|
+
};
|
88
|
+
"confirm-delete-section": {
|
89
|
+
cs: string;
|
90
|
+
};
|
91
|
+
};
|
92
|
+
};
|
93
|
+
export default _default;
|
@@ -0,0 +1,94 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
"uxf-cms-pages-content-builder": {
|
5
|
+
components: {
|
6
|
+
"content-header": {
|
7
|
+
"confirm-delete-section": {
|
8
|
+
cs: "Opravdu chcete smazat tuto sekci?",
|
9
|
+
},
|
10
|
+
},
|
11
|
+
header: {
|
12
|
+
save: {
|
13
|
+
cs: "Uložit",
|
14
|
+
},
|
15
|
+
},
|
16
|
+
},
|
17
|
+
content: {
|
18
|
+
"hero-section": {
|
19
|
+
title: {
|
20
|
+
cs: "Nadpis",
|
21
|
+
},
|
22
|
+
subtitle: {
|
23
|
+
cs: "Podnadpis",
|
24
|
+
},
|
25
|
+
},
|
26
|
+
"feature-section": {
|
27
|
+
title: {
|
28
|
+
cs: "Název sekce",
|
29
|
+
},
|
30
|
+
subtitle: {
|
31
|
+
cs: "Popis sekce",
|
32
|
+
},
|
33
|
+
"add-feature": {
|
34
|
+
cs: "Přidat funkci",
|
35
|
+
},
|
36
|
+
"confirm-delete-feature": {
|
37
|
+
cs: "Opravdu chcete smazat tuto funkci?",
|
38
|
+
},
|
39
|
+
"feature-title": {
|
40
|
+
cs: "Funkce {{index}}",
|
41
|
+
},
|
42
|
+
"delete-feature": {
|
43
|
+
cs: "Smazat funkci",
|
44
|
+
},
|
45
|
+
"feature-name": {
|
46
|
+
cs: "Název funkce",
|
47
|
+
},
|
48
|
+
image: {
|
49
|
+
cs: "Obrázek",
|
50
|
+
},
|
51
|
+
},
|
52
|
+
people: {
|
53
|
+
"confirm-delete-person": {
|
54
|
+
cs: "Opravdu chcete smazat tuto osobu?",
|
55
|
+
},
|
56
|
+
"person-title": {
|
57
|
+
cs: "Osoba {{index}}",
|
58
|
+
},
|
59
|
+
"delete-person": {
|
60
|
+
cs: "Smazat osobu",
|
61
|
+
},
|
62
|
+
name: {
|
63
|
+
cs: "Jméno",
|
64
|
+
},
|
65
|
+
image: {
|
66
|
+
cs: "Obrázek",
|
67
|
+
},
|
68
|
+
description: {
|
69
|
+
cs: "Popis",
|
70
|
+
},
|
71
|
+
text: {
|
72
|
+
cs: "Text",
|
73
|
+
},
|
74
|
+
phone: {
|
75
|
+
cs: "Telefon",
|
76
|
+
},
|
77
|
+
"add-person": {
|
78
|
+
cs: "Přidat osobu",
|
79
|
+
},
|
80
|
+
},
|
81
|
+
wysiwyg: {
|
82
|
+
text: {
|
83
|
+
cs: "Text",
|
84
|
+
},
|
85
|
+
placeholder: {
|
86
|
+
cs: "Zadejte text...",
|
87
|
+
},
|
88
|
+
},
|
89
|
+
},
|
90
|
+
"confirm-delete-section": {
|
91
|
+
cs: "Opravdu chcete smazat sekci?",
|
92
|
+
},
|
93
|
+
},
|
94
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { useUxfTranslation } from "@uxf/core-react/translations";
|
2
|
+
import React, { ReactNode } from "react";
|
3
|
+
interface Config {
|
4
|
+
allowedRole: string[];
|
5
|
+
}
|
6
|
+
export declare function ErrorContent(props: {
|
7
|
+
error: any;
|
8
|
+
}): React.JSX.Element;
|
9
|
+
export declare function restrictedPage(Component: () => ReactNode, config: Config, t: ReturnType<typeof useUxfTranslation>): (props: any) => React.JSX.Element;
|
10
|
+
export {};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.ErrorContent = ErrorContent;
|
7
|
+
exports.restrictedPage = restrictedPage;
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
9
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
10
|
+
const button_1 = require("@uxf/ui/button");
|
11
|
+
const loader_1 = require("@uxf/ui/loader");
|
12
|
+
const react_1 = __importDefault(require("react"));
|
13
|
+
const swr_1 = require("../api/swr");
|
14
|
+
function ErrorContent(props) {
|
15
|
+
const t = (0, translations_1.useUxfTranslation)();
|
16
|
+
if (props.error.code === "UNAUTHORIZED") {
|
17
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
18
|
+
react_1.default.createElement("div", null, t("uxf-cms-restricted-page:login-required")),
|
19
|
+
react_1.default.createElement(button_1.Button, { href: `/admin/login?redirect=${window.location.href}` }, t("uxf-cms-restricted-page:login"))));
|
20
|
+
}
|
21
|
+
return react_1.default.createElement("div", null, t("uxf-cms-restricted-page:unknown-error"));
|
22
|
+
}
|
23
|
+
function restrictedPage(Component, config, t) {
|
24
|
+
return function Page(props) {
|
25
|
+
const meQuery = (0, swr_1.useCmsMeQuery)();
|
26
|
+
if (meQuery.isLoading || typeof window === "undefined") {
|
27
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" },
|
28
|
+
react_1.default.createElement(loader_1.Loader, null)));
|
29
|
+
}
|
30
|
+
if ((0, is_not_nil_1.isNotNil)(meQuery.error)) {
|
31
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full flex-col items-center justify-center gap-4" },
|
32
|
+
react_1.default.createElement(ErrorContent, { error: meQuery.error })));
|
33
|
+
}
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
35
|
+
if (!config.allowedRole.some((role) => { var _a, _b; return (_b = (_a = meQuery.data) === null || _a === void 0 ? void 0 : _a.roles) === null || _b === void 0 ? void 0 : _b.includes(role); })) {
|
36
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" }, t("uxf-cms-restricted-page:forbidden")));
|
37
|
+
}
|
38
|
+
return react_1.default.createElement(Component, { ...props });
|
39
|
+
};
|
40
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
"uxf-cms-restricted-page": {
|
3
|
+
login: {
|
4
|
+
cs: string;
|
5
|
+
en: string;
|
6
|
+
sk: string;
|
7
|
+
de: string;
|
8
|
+
};
|
9
|
+
"login-required": {
|
10
|
+
cs: string;
|
11
|
+
en: string;
|
12
|
+
sk: string;
|
13
|
+
de: string;
|
14
|
+
};
|
15
|
+
"unknown-error": {
|
16
|
+
cs: string;
|
17
|
+
en: string;
|
18
|
+
sk: string;
|
19
|
+
de: string;
|
20
|
+
};
|
21
|
+
forbidden: {
|
22
|
+
cs: string;
|
23
|
+
en: string;
|
24
|
+
sk: string;
|
25
|
+
de: string;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
};
|
29
|
+
export default _default;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
"uxf-cms-restricted-page": {
|
5
|
+
login: {
|
6
|
+
cs: "Přihlásit",
|
7
|
+
en: "Login",
|
8
|
+
sk: "Prihlásiť",
|
9
|
+
de: "Anmelden",
|
10
|
+
},
|
11
|
+
"login-required": {
|
12
|
+
cs: "Musíte se přihlásit",
|
13
|
+
en: "You must log in",
|
14
|
+
sk: "Musíte sa prihlásiť",
|
15
|
+
de: "Sie müssen sich anmelden",
|
16
|
+
},
|
17
|
+
"unknown-error": {
|
18
|
+
cs: "Vyskytla se chyba",
|
19
|
+
en: "An error occurred",
|
20
|
+
sk: "Vyskytla sa chyba",
|
21
|
+
de: "Ein Fehler ist aufgetreten",
|
22
|
+
},
|
23
|
+
forbidden: {
|
24
|
+
cs: "Pro tuto stránku nemáte oprávnění.",
|
25
|
+
en: "You don't have permission for this page.",
|
26
|
+
sk: "Pre túto stránku nemáte oprávnenie.",
|
27
|
+
de: "Sie haben keine Berechtigung für diese Seite.",
|
28
|
+
},
|
29
|
+
},
|
30
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.useLoggedUser = useLoggedUser;
|
7
|
+
const swr_1 = __importDefault(require("swr"));
|
8
|
+
function useLoggedUser() {
|
9
|
+
const { data, error, isLoading } = (0, swr_1.default)("/api/cms/user", {
|
10
|
+
keepPreviousData: true,
|
11
|
+
// immutable
|
12
|
+
revalidateIfStale: false,
|
13
|
+
revalidateOnFocus: false,
|
14
|
+
revalidateOnReconnect: false,
|
15
|
+
});
|
16
|
+
return { data: data === null || data === void 0 ? void 0 : data.user, error, isLoading };
|
17
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ImageSource } from "@uxf/core/utils/resizer";
|
2
|
+
import React, { HTMLAttributes } from "react";
|
3
|
+
import { AvatarSize, AvatarVariant } from "./theme";
|
4
|
+
export interface AvatarProps extends Omit<HTMLAttributes<HTMLDivElement>, "src"> {
|
5
|
+
alt?: string;
|
6
|
+
size?: AvatarSize;
|
7
|
+
src?: ImageSource | null;
|
8
|
+
letters?: string;
|
9
|
+
variant?: AvatarVariant;
|
10
|
+
}
|
11
|
+
export declare const Avatar: React.MemoExoticComponent<React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>>;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.Avatar = void 0;
|
27
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
28
|
+
const raster_image_1 = require("@uxf/ui/raster-image");
|
29
|
+
const react_1 = __importStar(require("react"));
|
30
|
+
const AVATAR_SIZES = {
|
31
|
+
sm: 40,
|
32
|
+
default: 88,
|
33
|
+
lg: 120,
|
34
|
+
};
|
35
|
+
const Component = (props, ref) => {
|
36
|
+
// eslint-disable-next-line react/destructuring-assignment
|
37
|
+
const { alt, className, size = "default", src, letters, variant = "default", ...restProps } = props;
|
38
|
+
const avatarClassName = (0, cx_1.cx)("cms-avatar", `cms-avatar--size-${size}`, `cms-avatar--variant-${variant}`, className);
|
39
|
+
const imgAlt = alt !== null && alt !== void 0 ? alt : "";
|
40
|
+
if (src) {
|
41
|
+
return (react_1.default.createElement("span", { className: avatarClassName, ref: ref, ...restProps },
|
42
|
+
react_1.default.createElement(raster_image_1.RasterImage, { alt: imgAlt, className: "cms-avatar__image", height: AVATAR_SIZES[size], loading: "lazy", mode: "cover", src: src, width: AVATAR_SIZES[size] })));
|
43
|
+
}
|
44
|
+
return (react_1.default.createElement("div", { className: avatarClassName, ...restProps }, letters));
|
45
|
+
};
|
46
|
+
exports.Avatar = (0, react_1.memo)((0, react_1.forwardRef)(Component));
|
47
|
+
exports.Avatar.displayName = "CmsAvatar";
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getAvatarUserLetters(name: string): string;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getAvatarUserLetters = getAvatarUserLetters;
|
4
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
5
|
+
function getAvatarUserLetters(name) {
|
6
|
+
let letters = name
|
7
|
+
.split(" ")
|
8
|
+
.slice(0, 2)
|
9
|
+
.filter((i) => i);
|
10
|
+
const firstLetter = letters.at(0);
|
11
|
+
if ((0, is_not_nil_1.isNotNil)(firstLetter)) {
|
12
|
+
letters = firstLetter.slice(0, 2);
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
letters = letters.map((i) => i.slice(0, 1)).join("");
|
16
|
+
}
|
17
|
+
return letters.toUpperCase();
|
18
|
+
}
|