@uxf/cms 11.74.0 → 11.74.2
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/translations/cs.json +125 -0
- package/translations/de.json +83 -0
- package/translations/en.json +83 -0
- package/translations/sk.json +83 -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,10 @@
|
|
1
|
+
import { DefaultValues, SubmitHandler } from "react-hook-form";
|
2
|
+
export interface ForgottenPasswordFormData {
|
3
|
+
username: string;
|
4
|
+
}
|
5
|
+
export interface ForgottenPasswordFormProps<TFieldValues extends ForgottenPasswordFormData = ForgottenPasswordFormData> {
|
6
|
+
className?: string;
|
7
|
+
defaultValues?: DefaultValues<TFieldValues>;
|
8
|
+
onLogin?: () => void;
|
9
|
+
onSubmit: SubmitHandler<TFieldValues>;
|
10
|
+
}
|
@@ -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("./invite-user-form"), exports);
|
18
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
"use client";
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
5
|
+
};
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
+
exports.InviteUserForm = void 0;
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
9
|
+
const checkbox_input_1 = require("@uxf/form/checkbox-input");
|
10
|
+
const form_1 = require("@uxf/form/form");
|
11
|
+
const multi_combobox_1 = require("@uxf/form/multi-combobox");
|
12
|
+
const text_input_1 = require("@uxf/form/text-input");
|
13
|
+
const button_1 = require("@uxf/ui/button");
|
14
|
+
const react_1 = __importDefault(require("react"));
|
15
|
+
const react_hook_form_1 = require("react-hook-form");
|
16
|
+
const widget_1 = require("../../ui/widget");
|
17
|
+
const InviteUserForm = (props) => {
|
18
|
+
// eslint-disable-next-line react/destructuring-assignment
|
19
|
+
const { defaultValues, ...formProps } = props;
|
20
|
+
const t = (0, translations_1.useUxfTranslation)();
|
21
|
+
const formApi = (0, react_hook_form_1.useForm)({
|
22
|
+
defaultValues,
|
23
|
+
});
|
24
|
+
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "invite-user-form", ...formProps },
|
25
|
+
react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: react_1.default.createElement("div", { className: "text-right" },
|
26
|
+
react_1.default.createElement(button_1.Button, { isDisabled: formApi.formState.isSubmitting, type: "submit" }, t("uxf-cms-invite-user-form:save"))), withDividers: true },
|
27
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "E-mail", name: "email", type: "email" }),
|
28
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: t("uxf-cms-invite-user-form:name"), name: "name" }),
|
29
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: t("uxf-cms-invite-user-form:surname"), name: "surname" }),
|
30
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: formApi.control, isRequired: true, label: t("uxf-cms-invite-user-form:roles"), loadOptions: props.onLoadRoles, name: "roles" }),
|
31
|
+
react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: formApi.control, label: t("uxf-cms-invite-user-form:send-invitation"), name: "sendInvitation" }))));
|
32
|
+
};
|
33
|
+
exports.InviteUserForm = InviteUserForm;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
"uxf-cms-invite-user-form": {
|
3
|
+
save: {
|
4
|
+
cs: string;
|
5
|
+
en: string;
|
6
|
+
sk: string;
|
7
|
+
de: string;
|
8
|
+
};
|
9
|
+
name: {
|
10
|
+
cs: string;
|
11
|
+
en: string;
|
12
|
+
sk: string;
|
13
|
+
de: string;
|
14
|
+
};
|
15
|
+
surname: {
|
16
|
+
cs: string;
|
17
|
+
en: string;
|
18
|
+
sk: string;
|
19
|
+
de: string;
|
20
|
+
};
|
21
|
+
roles: {
|
22
|
+
cs: string;
|
23
|
+
en: string;
|
24
|
+
sk: string;
|
25
|
+
de: string;
|
26
|
+
};
|
27
|
+
"send-invitation": {
|
28
|
+
cs: string;
|
29
|
+
en: string;
|
30
|
+
sk: string;
|
31
|
+
de: string;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export default _default;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
"uxf-cms-invite-user-form": {
|
5
|
+
save: {
|
6
|
+
cs: "Uložit",
|
7
|
+
en: "Save",
|
8
|
+
sk: "Uložiť",
|
9
|
+
de: "Speichern",
|
10
|
+
},
|
11
|
+
name: {
|
12
|
+
cs: "Jméno",
|
13
|
+
en: "Name",
|
14
|
+
sk: "Meno",
|
15
|
+
de: "Name",
|
16
|
+
},
|
17
|
+
surname: {
|
18
|
+
cs: "Příjmení",
|
19
|
+
en: "Surname",
|
20
|
+
sk: "Priezvisko",
|
21
|
+
de: "Nachname",
|
22
|
+
},
|
23
|
+
roles: {
|
24
|
+
cs: "Role",
|
25
|
+
en: "Roles",
|
26
|
+
sk: "Roly",
|
27
|
+
de: "Rollen",
|
28
|
+
},
|
29
|
+
"send-invitation": {
|
30
|
+
cs: "Odeslat pozvánku",
|
31
|
+
en: "Send invitation",
|
32
|
+
sk: "Odoslať pozvánku",
|
33
|
+
de: "Einladung senden",
|
34
|
+
},
|
35
|
+
},
|
36
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { MultiComboboxOption } from "@uxf/ui/multi-combobox";
|
2
|
+
import { DefaultValues, SubmitHandler } from "react-hook-form";
|
3
|
+
export interface InviteUserFormData {
|
4
|
+
email: string;
|
5
|
+
name: string;
|
6
|
+
surname: string;
|
7
|
+
sendInvitation: boolean;
|
8
|
+
roles: MultiComboboxOption[];
|
9
|
+
}
|
10
|
+
export interface InviteUserFormProps<TFieldValues extends InviteUserFormData = InviteUserFormData> {
|
11
|
+
className?: string;
|
12
|
+
defaultValues?: DefaultValues<TFieldValues>;
|
13
|
+
onLoadRoles: (term: string) => Promise<MultiComboboxOption[]>;
|
14
|
+
onSubmit: SubmitHandler<TFieldValues>;
|
15
|
+
}
|
@@ -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("./login-form"), exports);
|
18
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,51 @@
|
|
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.LoginForm = void 0;
|
27
|
+
const translations_1 = require("@uxf/core-react/translations");
|
28
|
+
const form_1 = require("@uxf/form/form");
|
29
|
+
const text_input_1 = require("@uxf/form/text-input");
|
30
|
+
const button_1 = require("@uxf/ui/button");
|
31
|
+
const text_link_1 = require("@uxf/ui/text-link");
|
32
|
+
const react_1 = __importStar(require("react"));
|
33
|
+
const react_hook_form_1 = require("react-hook-form");
|
34
|
+
const LoginForm = (props) => {
|
35
|
+
// eslint-disable-next-line react/destructuring-assignment
|
36
|
+
const { onForgottenPassword, ...formProps } = props;
|
37
|
+
const t = (0, translations_1.useUxfTranslation)();
|
38
|
+
const formApi = (0, react_hook_form_1.useForm)();
|
39
|
+
const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
|
40
|
+
(0, react_1.useEffect)(() => {
|
41
|
+
setFormDisabled(false);
|
42
|
+
}, []);
|
43
|
+
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "login-form", ...formProps },
|
44
|
+
react_1.default.createElement("div", { className: "space-y-6" },
|
45
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "email" }),
|
46
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: t("uxf-cms-login-form:password"), name: "password", type: "password" }),
|
47
|
+
onForgottenPassword && (react_1.default.createElement("div", { className: "text-right" },
|
48
|
+
react_1.default.createElement(text_link_1.TextLink, { className: "uxf-typo-medium2 text-primary", isDisabled: formApi.formState.isSubmitting, onClick: onForgottenPassword }, t("uxf-cms-login-form:forgot-password")))),
|
49
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, type: "submit" }, t("uxf-cms-login-form:login")))));
|
50
|
+
};
|
51
|
+
exports.LoginForm = LoginForm;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
"uxf-cms-login-form": {
|
3
|
+
password: {
|
4
|
+
cs: string;
|
5
|
+
en: string;
|
6
|
+
sk: string;
|
7
|
+
de: string;
|
8
|
+
};
|
9
|
+
"forgot-password": {
|
10
|
+
cs: string;
|
11
|
+
en: string;
|
12
|
+
sk: string;
|
13
|
+
de: string;
|
14
|
+
};
|
15
|
+
login: {
|
16
|
+
cs: string;
|
17
|
+
en: string;
|
18
|
+
sk: string;
|
19
|
+
de: string;
|
20
|
+
};
|
21
|
+
};
|
22
|
+
};
|
23
|
+
export default _default;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
"uxf-cms-login-form": {
|
5
|
+
password: {
|
6
|
+
cs: "Heslo",
|
7
|
+
en: "Password",
|
8
|
+
sk: "Heslo",
|
9
|
+
de: "Passwort",
|
10
|
+
},
|
11
|
+
"forgot-password": {
|
12
|
+
cs: "Nepamatujete si své heslo?",
|
13
|
+
en: "Don't remember your password?",
|
14
|
+
sk: "Nepamätáte si svoje heslo?",
|
15
|
+
de: "Passwort vergessen?",
|
16
|
+
},
|
17
|
+
login: {
|
18
|
+
cs: "Přihlásit se",
|
19
|
+
en: "Login",
|
20
|
+
sk: "Prihlásiť sa",
|
21
|
+
de: "Anmelden",
|
22
|
+
},
|
23
|
+
},
|
24
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { DefaultValues, SubmitHandler } from "react-hook-form";
|
2
|
+
export interface LoginFormData {
|
3
|
+
username: string;
|
4
|
+
password: string;
|
5
|
+
}
|
6
|
+
export interface LoginFormProps<TFieldValues extends LoginFormData = LoginFormData> {
|
7
|
+
className?: string;
|
8
|
+
defaultValues?: DefaultValues<TFieldValues>;
|
9
|
+
onForgottenPassword?: () => void;
|
10
|
+
onSubmit: SubmitHandler<TFieldValues>;
|
11
|
+
}
|
@@ -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-form"), exports);
|
18
|
+
__exportStar(require("./types"), exports);
|
@@ -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.RenewPasswordForm = void 0;
|
27
|
+
const translations_1 = require("@uxf/core-react/translations");
|
28
|
+
const form_1 = require("@uxf/form/form");
|
29
|
+
const text_input_1 = require("@uxf/form/text-input");
|
30
|
+
const button_1 = require("@uxf/ui/button");
|
31
|
+
const react_1 = __importStar(require("react"));
|
32
|
+
const react_hook_form_1 = require("react-hook-form");
|
33
|
+
const RenewPasswordForm = (props) => {
|
34
|
+
// eslint-disable-next-line react/destructuring-assignment
|
35
|
+
const { defaultValues, ...formProps } = props;
|
36
|
+
const t = (0, translations_1.useUxfTranslation)();
|
37
|
+
const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
|
38
|
+
const formApi = (0, react_hook_form_1.useForm)({
|
39
|
+
defaultValues,
|
40
|
+
});
|
41
|
+
(0, react_1.useEffect)(() => {
|
42
|
+
setFormDisabled(false);
|
43
|
+
}, []);
|
44
|
+
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "renew-password-form", ...formProps },
|
45
|
+
react_1.default.createElement("div", { className: "space-y-6" },
|
46
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: t("uxf-cms-renew-password-form:new-password"), name: "password", rules: props.passwordRules, type: "password" }),
|
47
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: t("uxf-cms-renew-password-form:new-password-again"), name: "passwordAgain", rules: {
|
48
|
+
validate: (v) => v === formApi.getValues("password") ||
|
49
|
+
t("uxf-cms-renew-password-form:passwords-must-match"),
|
50
|
+
}, type: "password" }),
|
51
|
+
react_1.default.createElement(button_1.Button, { isDisabled: formDisabled || formApi.formState.isSubmitting, isFullWidth: true, isLoading: formApi.formState.isSubmitting, type: "submit" }, t("uxf-cms-renew-password-form:change-password")))));
|
52
|
+
};
|
53
|
+
exports.RenewPasswordForm = RenewPasswordForm;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
"uxf-cms-renew-password-form": {
|
3
|
+
"new-password": {
|
4
|
+
cs: string;
|
5
|
+
en: string;
|
6
|
+
sk: string;
|
7
|
+
de: string;
|
8
|
+
};
|
9
|
+
"new-password-again": {
|
10
|
+
cs: string;
|
11
|
+
en: string;
|
12
|
+
sk: string;
|
13
|
+
de: string;
|
14
|
+
};
|
15
|
+
"passwords-must-match": {
|
16
|
+
cs: string;
|
17
|
+
en: string;
|
18
|
+
sk: string;
|
19
|
+
de: string;
|
20
|
+
};
|
21
|
+
"change-password": {
|
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-renew-password-form": {
|
5
|
+
"new-password": {
|
6
|
+
cs: "Nové heslo",
|
7
|
+
en: "New password",
|
8
|
+
sk: "Nové heslo",
|
9
|
+
de: "Neues Passwort",
|
10
|
+
},
|
11
|
+
"new-password-again": {
|
12
|
+
cs: "Znovu nové heslo",
|
13
|
+
en: "New password again",
|
14
|
+
sk: "Znovu nové heslo",
|
15
|
+
de: "Neues Passwort wiederholen",
|
16
|
+
},
|
17
|
+
"passwords-must-match": {
|
18
|
+
cs: "Hesla musí být stejná",
|
19
|
+
en: "Passwords must match",
|
20
|
+
sk: "Heslá musia byť rovnaké",
|
21
|
+
de: "Passwörter müssen übereinstimmen",
|
22
|
+
},
|
23
|
+
"change-password": {
|
24
|
+
cs: "Změnit heslo",
|
25
|
+
en: "Change password",
|
26
|
+
sk: "Zmeniť heslo",
|
27
|
+
de: "Passwort ändern",
|
28
|
+
},
|
29
|
+
},
|
30
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { DefaultValues, SubmitHandler, UseControllerProps } from "react-hook-form";
|
2
|
+
export interface RenewPasswordFormData {
|
3
|
+
password: string;
|
4
|
+
passwordAgain: string;
|
5
|
+
}
|
6
|
+
export interface RenewPasswordFormProps<TFieldValues extends RenewPasswordFormData = RenewPasswordFormData> {
|
7
|
+
className?: string;
|
8
|
+
defaultValues?: DefaultValues<TFieldValues>;
|
9
|
+
onSubmit: SubmitHandler<TFieldValues>;
|
10
|
+
passwordRules?: UseControllerProps<RenewPasswordFormData>["rules"];
|
11
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
2
|
+
export declare function createAxiosInstance(baseURL: string, requestConfig?: AxiosRequestConfig): {
|
3
|
+
axiosInstance: import("axios").AxiosInstance;
|
4
|
+
axiosRequest: <Response>(ctx: any, url: string, method: import("axios").Method, body: object | null, query: object | null) => Promise<import("axios").AxiosResponse<Response, any>>;
|
5
|
+
useAxiosRequest: <Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null>(url: string, method: import("axios").Method, config: import("./types").RequestConfig<RequestBody, RequestQuery, RequestPath>) => [import("axios-hooks").ResponseValues<Response, any, any>, import("./types").Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
6
|
+
};
|
@@ -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.createAxiosInstance = createAxiosInstance;
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
8
|
+
const create_axios_request_1 = require("./create-axios-request");
|
9
|
+
const create_use_axios_request_1 = require("./create-use-axios-request");
|
10
|
+
function createAxiosInstance(baseURL, requestConfig = {}) {
|
11
|
+
const instance = axios_1.default.create();
|
12
|
+
return {
|
13
|
+
axiosInstance: instance,
|
14
|
+
axiosRequest: (0, create_axios_request_1.createAxiosRequest)(baseURL, instance, requestConfig),
|
15
|
+
useAxiosRequest: (0, create_use_axios_request_1.createUseAxiosRequest)(baseURL, instance, requestConfig),
|
16
|
+
};
|
17
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, Method } from "axios";
|
2
|
+
/** @deprecated use swr */
|
3
|
+
export declare const createAxiosRequest: (baseURL: string, axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response>(ctx: any, url: string, method: Method, body: object | null, query: object | null) => Promise<import("axios").AxiosResponse<Response, any>>;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createAxiosRequest = void 0;
|
4
|
+
const qs_1 = require("qs");
|
5
|
+
const BadRequestError_1 = require("../../errors/BadRequestError");
|
6
|
+
const ForbiddenError_1 = require("../../errors/ForbiddenError");
|
7
|
+
const NetworkError_1 = require("../../errors/NetworkError");
|
8
|
+
const UnauthorizedError_1 = require("../../errors/UnauthorizedError");
|
9
|
+
/** @deprecated use swr */
|
10
|
+
const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url, method, body, query) => {
|
11
|
+
var _a;
|
12
|
+
return axiosInstance
|
13
|
+
.request({
|
14
|
+
baseURL,
|
15
|
+
headers: ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.req) === null || _a === void 0 ? void 0 : _a.headers.cookie) ? { cookie: ctx.req.headers.cookie } : {},
|
16
|
+
...requestConfig,
|
17
|
+
url: query && Object.keys(query).length > 0 ? `${url}?${(0, qs_1.stringify)(query)}` : url,
|
18
|
+
method,
|
19
|
+
data: body,
|
20
|
+
})
|
21
|
+
.catch((error) => {
|
22
|
+
if (error.response) {
|
23
|
+
if (error.response.status === 400) {
|
24
|
+
throw new BadRequestError_1.BadRequestError(error.response.data);
|
25
|
+
}
|
26
|
+
else if (error.response.status === 401) {
|
27
|
+
throw new UnauthorizedError_1.UnauthorizedError();
|
28
|
+
}
|
29
|
+
else if (error.response.status === 403) {
|
30
|
+
throw new ForbiddenError_1.ForbiddenError();
|
31
|
+
}
|
32
|
+
}
|
33
|
+
else if (error.request) {
|
34
|
+
throw new NetworkError_1.NetworkError();
|
35
|
+
}
|
36
|
+
throw error;
|
37
|
+
});
|
38
|
+
};
|
39
|
+
exports.createAxiosRequest = createAxiosRequest;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, Method } from "axios";
|
2
|
+
import { ResponseValues } from "axios-hooks";
|
3
|
+
import { Execute, RequestConfig } from "./types";
|
4
|
+
/** @deprecated use swr */
|
5
|
+
export declare const createUseAxiosRequest: (baseURL: string, axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null>(url: string, method: Method, config: RequestConfig<RequestBody, RequestQuery, RequestPath>) => [ResponseValues<Response, any, any>, Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseAxiosRequest = void 0;
|
4
|
+
const axios_hooks_1 = require("axios-hooks");
|
5
|
+
const react_1 = require("react");
|
6
|
+
/** @deprecated use swr */
|
7
|
+
const createUseAxiosRequest = (baseURL, axiosInstance, requestConfig) => {
|
8
|
+
const useAxios = (0, axios_hooks_1.makeUseAxios)({
|
9
|
+
axios: axiosInstance,
|
10
|
+
defaultOptions: {
|
11
|
+
ssr: false,
|
12
|
+
},
|
13
|
+
});
|
14
|
+
return (url, method, config) => {
|
15
|
+
// TODO Vejvis!!! nějaká demence s typem configu
|
16
|
+
const { body, query, skip } = config;
|
17
|
+
const [result, executeHandler] = useAxios({
|
18
|
+
baseURL,
|
19
|
+
...requestConfig,
|
20
|
+
url,
|
21
|
+
method,
|
22
|
+
params: query,
|
23
|
+
data: body,
|
24
|
+
}, { useCache: false, manual: skip });
|
25
|
+
const execute = (0, react_1.useCallback)((c) => executeHandler({
|
26
|
+
url,
|
27
|
+
method,
|
28
|
+
// TODO Vejvis!!! nějaká demence s typem configu
|
29
|
+
params: c.query,
|
30
|
+
data: c.body,
|
31
|
+
}), [url, method, executeHandler]);
|
32
|
+
return [result, execute];
|
33
|
+
};
|
34
|
+
};
|
35
|
+
exports.createUseAxiosRequest = createUseAxiosRequest;
|
package/lib/api/index.js
ADDED
@@ -0,0 +1,19 @@
|
|
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
|
+
// eslint-disable-next-line import/no-cycle
|
18
|
+
__exportStar(require("./create-axios-instance"), exports);
|
19
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { AxiosPromise } from "axios";
|
2
|
+
import { ResponseValues } from "axios-hooks";
|
3
|
+
type RequestConfigBody<T extends Record<string, any> | null> = T extends null ? Record<string, any> : {
|
4
|
+
body: T;
|
5
|
+
};
|
6
|
+
type RequestConfigQuery<T extends Record<string, any> | null> = T extends null ? Record<string, any> : {
|
7
|
+
query: T;
|
8
|
+
};
|
9
|
+
type RequestConfigPath<T extends Record<string, any> | null> = T extends null ? Record<string, any> : {
|
10
|
+
path: T;
|
11
|
+
};
|
12
|
+
type RequestConfigOptions = {
|
13
|
+
skip?: boolean;
|
14
|
+
};
|
15
|
+
export type RequestConfig<RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null> = Record<string, any> & RequestConfigBody<RequestBody> & RequestConfigQuery<RequestQuery> & RequestConfigPath<RequestPath> & RequestConfigOptions;
|
16
|
+
export type Execute<Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null> = (config: RequestConfig<RequestBody, RequestQuery, RequestPath>) => AxiosPromise<Response>;
|
17
|
+
export type UseAxiosRequest<Response extends Record<string, any> | boolean, RequestBody extends Record<string, any>, RequestQuery extends Record<string, any>, RequestPath extends Record<string, any>> = (config: RequestConfig<RequestBody, RequestQuery, RequestPath>) => [ResponseValues<Response, any, any>, Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
18
|
+
export {};
|
package/lib/api/types.js
ADDED