@uxf/cms 13.0.3 → 14.1.0
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 +1 -1
- package/api/index.d.ts +2 -0
- package/api/index.js +2 -2
- package/api/swr.js +71 -6
- package/content-builder/content-builder-header.js +42 -3
- package/content-builder/content-builder.js +140 -18
- package/content-builder/content-builder.stories.js +24 -5
- package/content-builder/forms/content-builder-basic-form.js +212 -25
- package/content-builder/forms/content-builder-seo-form.js +92 -8
- package/forms/change-password-form/change-password-form.js +152 -15
- package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
- package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
- package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
- package/forms/invite-user-form/invite-user-form.js +171 -13
- package/forms/login-form/login-form.js +122 -13
- package/forms/renew-password-form/renew-password-form.js +148 -16
- package/lib/api/create-axios-instance.d.ts +3 -1
- package/lib/api/create-axios-request.d.ts +3 -1
- package/lib/api/create-axios-request.js +9 -2
- package/lib/api/create-axios-request.test.d.ts +1 -0
- package/lib/api/create-axios-request.test.js +32 -0
- package/lib/layout/layout.js +126 -28
- package/lib/layout/sidebar.js +69 -38
- package/lib/menu/ui/menu-item.js +5 -2
- package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
- package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
- package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
- package/lib/menu/ui/user-menu.js +178 -14
- package/package.json +21 -21
- package/pages/content-builder/components/form-content.js +189 -38
- package/pages/content-builder/components/form-root-fields.js +3 -3
- package/pages/content-builder/components/form.js +142 -27
- package/pages/content-builder/components/header.js +44 -5
- package/pages/content-builder/content/feature-section.js +67 -15
- package/pages/content-builder/content/gallery.js +38 -6
- package/pages/content-builder/content/hero-section.js +39 -6
- package/pages/content-builder/content/people.js +64 -13
- package/pages/content-builder/content/wysiwyg.js +60 -6
- package/pages/content-builder/content-builder-page.js +120 -48
- package/pages/content-builder/content-field.js +216 -35
- package/pages/content-builder/content-header-behaviour.spec.d.ts +1 -0
- package/pages/content-builder/content-header-behaviour.spec.js +22 -0
- package/pages/content-builder/content-header.js +100 -53
- package/pages/content-builder/context/details-visibility-context.js +96 -18
- package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
- package/pages/grid-page/grid-page.js +292 -76
- package/pages/grid-page/history-pathname.d.ts +6 -0
- package/pages/grid-page/history-pathname.js +11 -0
- package/pages/grid-page/history-pathname.test.d.ts +1 -0
- package/pages/grid-page/history-pathname.test.js +11 -0
- package/pages/grid-page/use-hidden-columns.js +29 -8
- package/pages/invite-user-page/invite-user-page.js +39 -16
- package/pages/login-page/login-page.js +44 -50
- package/pages/renew-password-page/renew-password-page.js +35 -43
- package/pages/translations.d.ts +3 -0
- package/pages/translations.js +3 -0
- package/security/restricted-page.js +88 -10
- package/security/use-logged-user.js +33 -8
- package/translations/cs.json +2 -1
- package/translations/translations.d.ts +3 -0
- package/ui/avatar/avatar.js +3 -2
- package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
- package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
- package/utils/remove-confirm-handler.js +80 -11
- package/utils/use-viewport-height.js +26 -20
- package/utils/use-viewport-height.test.d.ts +1 -0
- package/utils/use-viewport-height.test.js +37 -0
- package/utils/use-visual-viewport-height.d.ts +2 -0
- package/utils/use-visual-viewport-height.js +26 -0
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.InviteUserForm = InviteUserForm;
|
|
8
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
8
9
|
const translations_1 = require("@uxf/core-react/translations");
|
|
9
10
|
const checkbox_input_1 = require("@uxf/form/checkbox-input");
|
|
10
11
|
const form_1 = require("@uxf/form/form");
|
|
@@ -15,18 +16,175 @@ const react_1 = __importDefault(require("react"));
|
|
|
15
16
|
const react_hook_form_1 = require("react-hook-form");
|
|
16
17
|
const widget_1 = require("../../ui/widget");
|
|
17
18
|
function InviteUserForm(props) {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const $ = (0, compiler_runtime_1.c)(44);
|
|
20
|
+
let defaultValues;
|
|
21
|
+
let formProps;
|
|
22
|
+
if ($[0] !== props) {
|
|
23
|
+
({
|
|
24
|
+
defaultValues,
|
|
25
|
+
...formProps
|
|
26
|
+
} = props);
|
|
27
|
+
$[0] = props;
|
|
28
|
+
$[1] = defaultValues;
|
|
29
|
+
$[2] = formProps;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
defaultValues = $[1];
|
|
33
|
+
formProps = $[2];
|
|
34
|
+
}
|
|
20
35
|
const t = (0, translations_1.useUxfTranslation)();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
let t0;
|
|
37
|
+
if ($[3] !== defaultValues) {
|
|
38
|
+
t0 = {
|
|
39
|
+
defaultValues
|
|
40
|
+
};
|
|
41
|
+
$[3] = defaultValues;
|
|
42
|
+
$[4] = t0;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
t0 = $[4];
|
|
46
|
+
}
|
|
47
|
+
const formApi = (0, react_hook_form_1.useForm)(t0);
|
|
48
|
+
const t1 = formApi.formState.isSubmitting;
|
|
49
|
+
let t2;
|
|
50
|
+
if ($[5] !== t) {
|
|
51
|
+
t2 = t("uxf-cms-invite-user-form:save");
|
|
52
|
+
$[5] = t;
|
|
53
|
+
$[6] = t2;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
t2 = $[6];
|
|
57
|
+
}
|
|
58
|
+
let t3;
|
|
59
|
+
if ($[7] !== formApi.formState.isSubmitting || $[8] !== t2) {
|
|
60
|
+
t3 = react_1.default.createElement("div", { className: "text-right" },
|
|
61
|
+
react_1.default.createElement(button_1.Button, { isDisabled: t1, type: "submit" }, t2));
|
|
62
|
+
$[7] = formApi.formState.isSubmitting;
|
|
63
|
+
$[8] = t2;
|
|
64
|
+
$[9] = t3;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
t3 = $[9];
|
|
68
|
+
}
|
|
69
|
+
let t4;
|
|
70
|
+
if ($[10] !== formApi.control) {
|
|
71
|
+
t4 = react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "E-mail", name: "email", type: "email" });
|
|
72
|
+
$[10] = formApi.control;
|
|
73
|
+
$[11] = t4;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
t4 = $[11];
|
|
77
|
+
}
|
|
78
|
+
const t5 = formApi.control;
|
|
79
|
+
let t6;
|
|
80
|
+
if ($[12] !== t) {
|
|
81
|
+
t6 = t("uxf-cms-invite-user-form:name");
|
|
82
|
+
$[12] = t;
|
|
83
|
+
$[13] = t6;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
t6 = $[13];
|
|
87
|
+
}
|
|
88
|
+
let t7;
|
|
89
|
+
if ($[14] !== formApi.control || $[15] !== t6) {
|
|
90
|
+
t7 = react_1.default.createElement(text_input_1.TextInput, { control: t5, isRequired: true, label: t6, name: "name" });
|
|
91
|
+
$[14] = formApi.control;
|
|
92
|
+
$[15] = t6;
|
|
93
|
+
$[16] = t7;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
t7 = $[16];
|
|
97
|
+
}
|
|
98
|
+
const t8 = formApi.control;
|
|
99
|
+
let t9;
|
|
100
|
+
if ($[17] !== t) {
|
|
101
|
+
t9 = t("uxf-cms-invite-user-form:surname");
|
|
102
|
+
$[17] = t;
|
|
103
|
+
$[18] = t9;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
t9 = $[18];
|
|
107
|
+
}
|
|
108
|
+
let t10;
|
|
109
|
+
if ($[19] !== formApi.control || $[20] !== t9) {
|
|
110
|
+
t10 = react_1.default.createElement(text_input_1.TextInput, { control: t8, isRequired: true, label: t9, name: "surname" });
|
|
111
|
+
$[19] = formApi.control;
|
|
112
|
+
$[20] = t9;
|
|
113
|
+
$[21] = t10;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
t10 = $[21];
|
|
117
|
+
}
|
|
118
|
+
const t11 = formApi.control;
|
|
119
|
+
let t12;
|
|
120
|
+
if ($[22] !== t) {
|
|
121
|
+
t12 = t("uxf-cms-invite-user-form:roles");
|
|
122
|
+
$[22] = t;
|
|
123
|
+
$[23] = t12;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
t12 = $[23];
|
|
127
|
+
}
|
|
128
|
+
let t13;
|
|
129
|
+
if ($[24] !== formApi.control || $[25] !== props.onLoadRoles || $[26] !== t12) {
|
|
130
|
+
t13 = react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: t11, isRequired: true, label: t12, loadOptions: props.onLoadRoles, name: "roles" });
|
|
131
|
+
$[24] = formApi.control;
|
|
132
|
+
$[25] = props.onLoadRoles;
|
|
133
|
+
$[26] = t12;
|
|
134
|
+
$[27] = t13;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
t13 = $[27];
|
|
138
|
+
}
|
|
139
|
+
const t14 = formApi.control;
|
|
140
|
+
let t15;
|
|
141
|
+
if ($[28] !== t) {
|
|
142
|
+
t15 = t("uxf-cms-invite-user-form:send-invitation");
|
|
143
|
+
$[28] = t;
|
|
144
|
+
$[29] = t15;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
t15 = $[29];
|
|
148
|
+
}
|
|
149
|
+
let t16;
|
|
150
|
+
if ($[30] !== formApi.control || $[31] !== t15) {
|
|
151
|
+
t16 = react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: t14, label: t15, name: "sendInvitation" });
|
|
152
|
+
$[30] = formApi.control;
|
|
153
|
+
$[31] = t15;
|
|
154
|
+
$[32] = t16;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
t16 = $[32];
|
|
158
|
+
}
|
|
159
|
+
let t17;
|
|
160
|
+
if ($[33] !== t10 || $[34] !== t13 || $[35] !== t16 || $[36] !== t3 || $[37] !== t4 || $[38] !== t7) {
|
|
161
|
+
t17 = react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: t3, withDividers: true },
|
|
162
|
+
t4,
|
|
163
|
+
t7,
|
|
164
|
+
t10,
|
|
165
|
+
t13,
|
|
166
|
+
t16);
|
|
167
|
+
$[33] = t10;
|
|
168
|
+
$[34] = t13;
|
|
169
|
+
$[35] = t16;
|
|
170
|
+
$[36] = t3;
|
|
171
|
+
$[37] = t4;
|
|
172
|
+
$[38] = t7;
|
|
173
|
+
$[39] = t17;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
t17 = $[39];
|
|
177
|
+
}
|
|
178
|
+
let t18;
|
|
179
|
+
if ($[40] !== formApi || $[41] !== formProps || $[42] !== t17) {
|
|
180
|
+
t18 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "invite-user-form", ...formProps }, t17);
|
|
181
|
+
$[40] = formApi;
|
|
182
|
+
$[41] = formProps;
|
|
183
|
+
$[42] = t17;
|
|
184
|
+
$[43] = t18;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
t18 = $[43];
|
|
188
|
+
}
|
|
189
|
+
return t18;
|
|
32
190
|
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.LoginForm = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
39
|
const form_1 = require("@uxf/form/form");
|
|
39
40
|
const text_input_1 = require("@uxf/form/text-input");
|
|
@@ -41,21 +42,129 @@ const button_1 = require("@uxf/ui/button");
|
|
|
41
42
|
const text_link_1 = require("@uxf/ui/text-link");
|
|
42
43
|
const react_1 = __importStar(require("react"));
|
|
43
44
|
const react_hook_form_1 = require("react-hook-form");
|
|
44
|
-
const LoginForm =
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const LoginForm = props => {
|
|
46
|
+
const $ = (0, compiler_runtime_1.c)(31);
|
|
47
|
+
let formProps;
|
|
48
|
+
let onForgottenPassword;
|
|
49
|
+
if ($[0] !== props) {
|
|
50
|
+
({
|
|
51
|
+
onForgottenPassword,
|
|
52
|
+
...formProps
|
|
53
|
+
} = props);
|
|
54
|
+
$[0] = props;
|
|
55
|
+
$[1] = formProps;
|
|
56
|
+
$[2] = onForgottenPassword;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
formProps = $[1];
|
|
60
|
+
onForgottenPassword = $[2];
|
|
61
|
+
}
|
|
47
62
|
const t = (0, translations_1.useUxfTranslation)();
|
|
48
63
|
const formApi = (0, react_hook_form_1.useForm)();
|
|
49
64
|
const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
let t0;
|
|
66
|
+
let t1;
|
|
67
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
|
+
t0 = () => {
|
|
69
|
+
setFormDisabled(false);
|
|
70
|
+
};
|
|
71
|
+
t1 = [];
|
|
72
|
+
$[3] = t0;
|
|
73
|
+
$[4] = t1;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
t0 = $[3];
|
|
77
|
+
t1 = $[4];
|
|
78
|
+
}
|
|
79
|
+
(0, react_1.useEffect)(t0, t1);
|
|
80
|
+
let t2;
|
|
81
|
+
if ($[5] !== formApi.control || $[6] !== formDisabled) {
|
|
82
|
+
t2 = react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "email" });
|
|
83
|
+
$[5] = formApi.control;
|
|
84
|
+
$[6] = formDisabled;
|
|
85
|
+
$[7] = t2;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
t2 = $[7];
|
|
89
|
+
}
|
|
90
|
+
const t3 = formApi.control;
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[8] !== t) {
|
|
93
|
+
t4 = t("uxf-cms-login-form:password");
|
|
94
|
+
$[8] = t;
|
|
95
|
+
$[9] = t4;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
t4 = $[9];
|
|
99
|
+
}
|
|
100
|
+
let t5;
|
|
101
|
+
if ($[10] !== formApi.control || $[11] !== formDisabled || $[12] !== t4) {
|
|
102
|
+
t5 = react_1.default.createElement(text_input_1.TextInput, { control: t3, isDisabled: formDisabled, isRequired: true, label: t4, name: "password", type: "password" });
|
|
103
|
+
$[10] = formApi.control;
|
|
104
|
+
$[11] = formDisabled;
|
|
105
|
+
$[12] = t4;
|
|
106
|
+
$[13] = t5;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
t5 = $[13];
|
|
110
|
+
}
|
|
111
|
+
let t6;
|
|
112
|
+
if ($[14] !== formApi.formState || $[15] !== onForgottenPassword || $[16] !== t) {
|
|
113
|
+
t6 = onForgottenPassword && react_1.default.createElement("div", { className: "text-right" },
|
|
114
|
+
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")));
|
|
115
|
+
$[14] = formApi.formState;
|
|
116
|
+
$[15] = onForgottenPassword;
|
|
117
|
+
$[16] = t;
|
|
118
|
+
$[17] = t6;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
t6 = $[17];
|
|
122
|
+
}
|
|
123
|
+
let t7;
|
|
124
|
+
if ($[18] !== t) {
|
|
125
|
+
t7 = t("uxf-cms-login-form:login");
|
|
126
|
+
$[18] = t;
|
|
127
|
+
$[19] = t7;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
t7 = $[19];
|
|
131
|
+
}
|
|
132
|
+
let t8;
|
|
133
|
+
if ($[20] !== t7) {
|
|
134
|
+
t8 = react_1.default.createElement(button_1.Button, { isFullWidth: true, type: "submit" }, t7);
|
|
135
|
+
$[20] = t7;
|
|
136
|
+
$[21] = t8;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
t8 = $[21];
|
|
140
|
+
}
|
|
141
|
+
let t9;
|
|
142
|
+
if ($[22] !== t2 || $[23] !== t5 || $[24] !== t6 || $[25] !== t8) {
|
|
143
|
+
t9 = react_1.default.createElement("div", { className: "space-y-6" },
|
|
144
|
+
t2,
|
|
145
|
+
t5,
|
|
146
|
+
t6,
|
|
147
|
+
t8);
|
|
148
|
+
$[22] = t2;
|
|
149
|
+
$[23] = t5;
|
|
150
|
+
$[24] = t6;
|
|
151
|
+
$[25] = t8;
|
|
152
|
+
$[26] = t9;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
t9 = $[26];
|
|
156
|
+
}
|
|
157
|
+
let t10;
|
|
158
|
+
if ($[27] !== formApi || $[28] !== formProps || $[29] !== t9) {
|
|
159
|
+
t10 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "login-form", ...formProps }, t9);
|
|
160
|
+
$[27] = formApi;
|
|
161
|
+
$[28] = formProps;
|
|
162
|
+
$[29] = t9;
|
|
163
|
+
$[30] = t10;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
t10 = $[30];
|
|
167
|
+
}
|
|
168
|
+
return t10;
|
|
60
169
|
};
|
|
61
170
|
exports.LoginForm = LoginForm;
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.RenewPasswordForm = RenewPasswordForm;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
39
|
const form_1 = require("@uxf/form/form");
|
|
39
40
|
const text_input_1 = require("@uxf/form/text-input");
|
|
@@ -41,22 +42,153 @@ const button_1 = require("@uxf/ui/button");
|
|
|
41
42
|
const react_1 = __importStar(require("react"));
|
|
42
43
|
const react_hook_form_1 = require("react-hook-form");
|
|
43
44
|
function RenewPasswordForm(props) {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const $ = (0, compiler_runtime_1.c)(38);
|
|
46
|
+
let defaultValues;
|
|
47
|
+
let formProps;
|
|
48
|
+
if ($[0] !== props) {
|
|
49
|
+
({
|
|
50
|
+
defaultValues,
|
|
51
|
+
...formProps
|
|
52
|
+
} = props);
|
|
53
|
+
$[0] = props;
|
|
54
|
+
$[1] = defaultValues;
|
|
55
|
+
$[2] = formProps;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
defaultValues = $[1];
|
|
59
|
+
formProps = $[2];
|
|
60
|
+
}
|
|
46
61
|
const t = (0, translations_1.useUxfTranslation)();
|
|
47
62
|
const [formDisabled, setFormDisabled] = (0, react_1.useState)(true);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
let t0;
|
|
64
|
+
if ($[3] !== defaultValues) {
|
|
65
|
+
t0 = {
|
|
66
|
+
defaultValues
|
|
67
|
+
};
|
|
68
|
+
$[3] = defaultValues;
|
|
69
|
+
$[4] = t0;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
t0 = $[4];
|
|
73
|
+
}
|
|
74
|
+
const formApi = (0, react_hook_form_1.useForm)(t0);
|
|
75
|
+
let t1;
|
|
76
|
+
let t2;
|
|
77
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
78
|
+
t1 = () => {
|
|
79
|
+
setFormDisabled(false);
|
|
80
|
+
};
|
|
81
|
+
t2 = [];
|
|
82
|
+
$[5] = t1;
|
|
83
|
+
$[6] = t2;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
t1 = $[5];
|
|
87
|
+
t2 = $[6];
|
|
88
|
+
}
|
|
89
|
+
(0, react_1.useEffect)(t1, t2);
|
|
90
|
+
const t3 = formApi.control;
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[7] !== t) {
|
|
93
|
+
t4 = t("uxf-cms-renew-password-form:new-password");
|
|
94
|
+
$[7] = t;
|
|
95
|
+
$[8] = t4;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
t4 = $[8];
|
|
99
|
+
}
|
|
100
|
+
let t5;
|
|
101
|
+
if ($[9] !== formApi.control || $[10] !== formDisabled || $[11] !== props.passwordRules || $[12] !== t4) {
|
|
102
|
+
t5 = react_1.default.createElement(text_input_1.TextInput, { control: t3, isDisabled: formDisabled, isRequired: true, label: t4, name: "password", rules: props.passwordRules, type: "password" });
|
|
103
|
+
$[9] = formApi.control;
|
|
104
|
+
$[10] = formDisabled;
|
|
105
|
+
$[11] = props.passwordRules;
|
|
106
|
+
$[12] = t4;
|
|
107
|
+
$[13] = t5;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
t5 = $[13];
|
|
111
|
+
}
|
|
112
|
+
const t6 = formApi.control;
|
|
113
|
+
let t7;
|
|
114
|
+
if ($[14] !== t) {
|
|
115
|
+
t7 = t("uxf-cms-renew-password-form:new-password-again");
|
|
116
|
+
$[14] = t;
|
|
117
|
+
$[15] = t7;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
t7 = $[15];
|
|
121
|
+
}
|
|
122
|
+
let t8;
|
|
123
|
+
if ($[16] !== formApi || $[17] !== t) {
|
|
124
|
+
t8 = {
|
|
125
|
+
validate: v => v === formApi.getValues("password") || t("uxf-cms-renew-password-form:passwords-must-match")
|
|
126
|
+
};
|
|
127
|
+
$[16] = formApi;
|
|
128
|
+
$[17] = t;
|
|
129
|
+
$[18] = t8;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
t8 = $[18];
|
|
133
|
+
}
|
|
134
|
+
let t9;
|
|
135
|
+
if ($[19] !== formApi.control || $[20] !== formDisabled || $[21] !== t7 || $[22] !== t8) {
|
|
136
|
+
t9 = react_1.default.createElement(text_input_1.TextInput, { control: t6, isDisabled: formDisabled, isRequired: true, label: t7, name: "passwordAgain", rules: t8, type: "password" });
|
|
137
|
+
$[19] = formApi.control;
|
|
138
|
+
$[20] = formDisabled;
|
|
139
|
+
$[21] = t7;
|
|
140
|
+
$[22] = t8;
|
|
141
|
+
$[23] = t9;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
t9 = $[23];
|
|
145
|
+
}
|
|
146
|
+
const t10 = formDisabled || formApi.formState.isSubmitting;
|
|
147
|
+
const t11 = formApi.formState.isSubmitting;
|
|
148
|
+
let t12;
|
|
149
|
+
if ($[24] !== t) {
|
|
150
|
+
t12 = t("uxf-cms-renew-password-form:change-password");
|
|
151
|
+
$[24] = t;
|
|
152
|
+
$[25] = t12;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
t12 = $[25];
|
|
156
|
+
}
|
|
157
|
+
let t13;
|
|
158
|
+
if ($[26] !== formApi.formState.isSubmitting || $[27] !== t10 || $[28] !== t12) {
|
|
159
|
+
t13 = react_1.default.createElement(button_1.Button, { isDisabled: t10, isFullWidth: true, isLoading: t11, type: "submit" }, t12);
|
|
160
|
+
$[26] = formApi.formState.isSubmitting;
|
|
161
|
+
$[27] = t10;
|
|
162
|
+
$[28] = t12;
|
|
163
|
+
$[29] = t13;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
t13 = $[29];
|
|
167
|
+
}
|
|
168
|
+
let t14;
|
|
169
|
+
if ($[30] !== t13 || $[31] !== t5 || $[32] !== t9) {
|
|
170
|
+
t14 = react_1.default.createElement("div", { className: "space-y-6" },
|
|
171
|
+
t5,
|
|
172
|
+
t9,
|
|
173
|
+
t13);
|
|
174
|
+
$[30] = t13;
|
|
175
|
+
$[31] = t5;
|
|
176
|
+
$[32] = t9;
|
|
177
|
+
$[33] = t14;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
t14 = $[33];
|
|
181
|
+
}
|
|
182
|
+
let t15;
|
|
183
|
+
if ($[34] !== formApi || $[35] !== formProps || $[36] !== t14) {
|
|
184
|
+
t15 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "renew-password-form", ...formProps }, t14);
|
|
185
|
+
$[34] = formApi;
|
|
186
|
+
$[35] = formProps;
|
|
187
|
+
$[36] = t14;
|
|
188
|
+
$[37] = t15;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
t15 = $[37];
|
|
192
|
+
}
|
|
193
|
+
return t15;
|
|
62
194
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig } from "axios";
|
|
2
2
|
export declare function createAxiosInstance(baseURL: string, requestConfig?: AxiosRequestConfig): {
|
|
3
3
|
axiosInstance: axios.AxiosInstance;
|
|
4
|
-
axiosRequest: <Response>(ctx: any, url: string, method: axios.Method, body: object | null, query: object | null
|
|
4
|
+
axiosRequest: <Response>(ctx: any, url: string, method: axios.Method, body: object | null, query: object | null, options?: {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}) => Promise<axios.AxiosResponse<Response, any, {}, any>>;
|
|
5
7
|
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: axios.Method, config: import("./types").RequestConfig<RequestBody, RequestQuery, RequestPath>) => [import("axios-hooks").ResponseValues<Response, any, any>, import("./types").Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
|
6
8
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, Method } from "axios";
|
|
2
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
|
|
3
|
+
export declare const createAxiosRequest: (baseURL: string, axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response>(ctx: any, url: string, method: Method, body: object | null, query: object | null, options?: {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
}) => Promise<import("axios").AxiosResponse<Response, any, {}, any>>;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAxiosRequest = void 0;
|
|
4
4
|
const qs_1 = require("@uxf/core/utils/qs");
|
|
5
|
+
const axios_1 = require("axios");
|
|
5
6
|
const bad_request_error_1 = require("../../errors/bad-request-error");
|
|
6
7
|
const forbidden_error_1 = require("../../errors/forbidden-error");
|
|
7
8
|
const network_error_1 = require("../../errors/network-error");
|
|
8
9
|
const unauthorized_error_1 = require("../../errors/unauthorized-error");
|
|
9
10
|
/** @deprecated use swr */
|
|
10
|
-
const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url, method, body, query) => {
|
|
11
|
-
var _a;
|
|
11
|
+
const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url, method, body, query, options) => {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
return axiosInstance
|
|
13
14
|
.request({
|
|
14
15
|
baseURL,
|
|
@@ -17,8 +18,14 @@ const createAxiosRequest = (baseURL, axiosInstance, requestConfig) => (ctx, url,
|
|
|
17
18
|
url: query && Object.keys(query).length > 0 ? `${url}?${(0, qs_1.stringify)(query)}` : url,
|
|
18
19
|
method,
|
|
19
20
|
data: body,
|
|
21
|
+
signal: (_b = options === null || options === void 0 ? void 0 : options.signal) !== null && _b !== void 0 ? _b : requestConfig.signal,
|
|
20
22
|
})
|
|
21
23
|
.catch((error) => {
|
|
24
|
+
// An aborted request carries the request it sent and no response, which the branches below would
|
|
25
|
+
// report as a network failure.
|
|
26
|
+
if ((0, axios_1.isCancel)(error)) {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
22
29
|
if (error.response) {
|
|
23
30
|
if (error.response.status === 400) {
|
|
24
31
|
throw new bad_request_error_1.BadRequestError(error.response.data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axios_1 = require("axios");
|
|
4
|
+
const network_error_1 = require("../../errors/network-error");
|
|
5
|
+
const create_axios_request_1 = require("./create-axios-request");
|
|
6
|
+
function createInstance(request) {
|
|
7
|
+
return { request };
|
|
8
|
+
}
|
|
9
|
+
test("passes the abort signal on to axios", async () => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const request = jest.fn(() => Promise.resolve({ data: [] }));
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
await (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), {})(null, "/api/x", "get", null, null, {
|
|
14
|
+
signal: controller.signal,
|
|
15
|
+
});
|
|
16
|
+
expect((_b = (_a = request.mock.calls.at(0)) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.signal).toBe(controller.signal);
|
|
17
|
+
});
|
|
18
|
+
test("rejects a cancelled request as cancelled, not as a network error", async () => {
|
|
19
|
+
// As axios rejects an aborted request: with the request it sent, which the error mapping took for a request
|
|
20
|
+
// that got no response.
|
|
21
|
+
const request = jest.fn(() => Promise.reject(new axios_1.CanceledError(undefined, undefined, {})));
|
|
22
|
+
const result = (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), {})(null, "/api/x", "get", null, null);
|
|
23
|
+
await expect(result).rejects.toBeInstanceOf(axios_1.CanceledError);
|
|
24
|
+
await expect(result).rejects.not.toBeInstanceOf(network_error_1.NetworkError);
|
|
25
|
+
});
|
|
26
|
+
test("keeps a signal configured on the instance when the call passes none", async () => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const request = jest.fn(() => Promise.resolve({ data: [] }));
|
|
29
|
+
const controller = new AbortController();
|
|
30
|
+
await (0, create_axios_request_1.createAxiosRequest)("", createInstance(request), { signal: controller.signal })(null, "/api/x", "get", null, null);
|
|
31
|
+
expect((_b = (_a = request.mock.calls.at(0)) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.signal).toBe(controller.signal);
|
|
32
|
+
});
|