@byline/ui 2.4.0 → 2.4.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/dist/react.d.ts +10 -18
- package/dist/react.js +2 -15
- package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.d.ts +8 -1
- package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.js +4 -6
- package/dist/widgets/diff-viewer/diff-modal.module.js +14 -0
- package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal_module.css +9 -9
- package/dist/{admin/components/collections → widgets/status-badge}/status-badge.js +1 -1
- package/dist/{admin/components/collections → widgets/status-badge}/status-badge.module.js +3 -3
- package/dist/{admin/components/collections → widgets/status-badge}/status-badge_module.css +3 -3
- package/package.json +2 -4
- package/src/react.ts +12 -34
- package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.tsx +16 -5
- package/src/{admin/components/collections → widgets/status-badge}/status-badge.tsx +1 -1
- package/dist/admin/components/admin-account/change-password.d.ts +0 -8
- package/dist/admin/components/admin-account/change-password.js +0 -192
- package/dist/admin/components/admin-account/change-password.module.js +0 -8
- package/dist/admin/components/admin-account/change-password_module.css +0 -27
- package/dist/admin/components/admin-account/container.d.ts +0 -29
- package/dist/admin/components/admin-account/container.js +0 -299
- package/dist/admin/components/admin-account/container.module.js +0 -28
- package/dist/admin/components/admin-account/container_module.css +0 -106
- package/dist/admin/components/admin-account/update.d.ts +0 -8
- package/dist/admin/components/admin-account/update.js +0 -207
- package/dist/admin/components/admin-account/update.module.js +0 -8
- package/dist/admin/components/admin-account/update_module.css +0 -27
- package/dist/admin/components/admin-permissions/inspector.d.ts +0 -4
- package/dist/admin/components/admin-permissions/inspector.js +0 -284
- package/dist/admin/components/admin-permissions/inspector.module.js +0 -56
- package/dist/admin/components/admin-permissions/inspector_module.css +0 -238
- package/dist/admin/components/admin-roles/create.d.ts +0 -7
- package/dist/admin/components/admin-roles/create.js +0 -177
- package/dist/admin/components/admin-roles/create.module.js +0 -8
- package/dist/admin/components/admin-roles/create_module.css +0 -27
- package/dist/admin/components/admin-roles/permissions.d.ts +0 -10
- package/dist/admin/components/admin-roles/permissions.js +0 -303
- package/dist/admin/components/admin-roles/permissions.module.js +0 -44
- package/dist/admin/components/admin-roles/permissions_module.css +0 -192
- package/dist/admin/components/admin-roles/update.d.ts +0 -8
- package/dist/admin/components/admin-roles/update.js +0 -166
- package/dist/admin/components/admin-roles/update.module.js +0 -8
- package/dist/admin/components/admin-roles/update_module.css +0 -27
- package/dist/admin/components/admin-users/create.d.ts +0 -8
- package/dist/admin/components/admin-users/create.js +0 -268
- package/dist/admin/components/admin-users/create.module.js +0 -10
- package/dist/admin/components/admin-users/create_module.css +0 -45
- package/dist/admin/components/admin-users/roles.d.ts +0 -11
- package/dist/admin/components/admin-users/roles.js +0 -148
- package/dist/admin/components/admin-users/roles.module.js +0 -18
- package/dist/admin/components/admin-users/roles_module.css +0 -75
- package/dist/admin/components/admin-users/set-password.d.ts +0 -8
- package/dist/admin/components/admin-users/set-password.js +0 -170
- package/dist/admin/components/admin-users/set-password.module.js +0 -9
- package/dist/admin/components/admin-users/set-password_module.css +0 -31
- package/dist/admin/components/admin-users/update.d.ts +0 -8
- package/dist/admin/components/admin-users/update.js +0 -254
- package/dist/admin/components/admin-users/update.module.js +0 -9
- package/dist/admin/components/admin-users/update_module.css +0 -34
- package/dist/admin/components/auth/sign-in-form.d.ts +0 -12
- package/dist/admin/components/auth/sign-in-form.js +0 -115
- package/dist/admin/components/auth/sign-in-form.module.js +0 -12
- package/dist/admin/components/auth/sign-in-form_module.css +0 -41
- package/dist/admin/components/collections/diff-modal.module.js +0 -14
- package/dist/services/admin-services-context.d.ts +0 -16
- package/dist/services/admin-services-context.js +0 -13
- package/dist/services/admin-services-types.d.ts +0 -129
- package/dist/services/admin-services-types.js +0 -1
- package/src/admin/components/admin-account/change-password.module.css +0 -40
- package/src/admin/components/admin-account/change-password.tsx +0 -232
- package/src/admin/components/admin-account/container.module.css +0 -158
- package/src/admin/components/admin-account/container.tsx +0 -230
- package/src/admin/components/admin-account/update.module.css +0 -40
- package/src/admin/components/admin-account/update.tsx +0 -263
- package/src/admin/components/admin-permissions/inspector.module.css +0 -326
- package/src/admin/components/admin-permissions/inspector.tsx +0 -298
- package/src/admin/components/admin-roles/create.module.css +0 -40
- package/src/admin/components/admin-roles/create.tsx +0 -218
- package/src/admin/components/admin-roles/permissions.module.css +0 -279
- package/src/admin/components/admin-roles/permissions.tsx +0 -396
- package/src/admin/components/admin-roles/update.module.css +0 -40
- package/src/admin/components/admin-roles/update.tsx +0 -218
- package/src/admin/components/admin-users/create.module.css +0 -63
- package/src/admin/components/admin-users/create.tsx +0 -323
- package/src/admin/components/admin-users/roles.module.css +0 -119
- package/src/admin/components/admin-users/roles.tsx +0 -172
- package/src/admin/components/admin-users/set-password.module.css +0 -46
- package/src/admin/components/admin-users/set-password.tsx +0 -199
- package/src/admin/components/admin-users/update.module.css +0 -49
- package/src/admin/components/admin-users/update.tsx +0 -328
- package/src/admin/components/auth/sign-in-form.module.css +0 -62
- package/src/admin/components/auth/sign-in-form.tsx +0 -132
- package/src/services/admin-services-context.tsx +0 -35
- package/src/services/admin-services-types.ts +0 -177
- /package/dist/{admin/components/collections → widgets/status-badge}/status-badge.d.ts +0 -0
- /package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.module.css +0 -0
- /package/src/{admin/components/collections → widgets/status-badge}/status-badge.module.css +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import { useBylineAdminServices } from "../../../services/admin-services-context.js";
|
|
6
|
-
import { Alert, Button, Checkbox, LoaderEllipsis } from "../../../uikit.js";
|
|
7
|
-
import roles_module from "./roles.module.js";
|
|
8
|
-
function setsEqual(a, b) {
|
|
9
|
-
if (a.size !== b.size) return false;
|
|
10
|
-
for (const item of a)if (!b.has(item)) return false;
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
function UserRoles({ user, allRoles, initialRoleIds, onClose, onSaved }) {
|
|
14
|
-
const { setUserRoles } = useBylineAdminServices();
|
|
15
|
-
const [initialSet, setInitialSet] = useState(()=>new Set(initialRoleIds));
|
|
16
|
-
const [selected, setSelected] = useState(()=>new Set(initialRoleIds));
|
|
17
|
-
const [saving, setSaving] = useState(false);
|
|
18
|
-
const [error, setError] = useState(null);
|
|
19
|
-
const [successMessage, setSuccessMessage] = useState(null);
|
|
20
|
-
const isDirty = !setsEqual(selected, initialSet);
|
|
21
|
-
function handleToggle(roleId, checked) {
|
|
22
|
-
setSelected((current)=>{
|
|
23
|
-
const next = new Set(current);
|
|
24
|
-
if (checked) next.add(roleId);
|
|
25
|
-
else next.delete(roleId);
|
|
26
|
-
return next;
|
|
27
|
-
});
|
|
28
|
-
setSuccessMessage(null);
|
|
29
|
-
}
|
|
30
|
-
async function handleSave() {
|
|
31
|
-
if (saving) return;
|
|
32
|
-
setSaving(true);
|
|
33
|
-
setError(null);
|
|
34
|
-
setSuccessMessage(null);
|
|
35
|
-
try {
|
|
36
|
-
const response = await setUserRoles({
|
|
37
|
-
data: {
|
|
38
|
-
userId: user.id,
|
|
39
|
-
roleIds: Array.from(selected)
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const storedSet = new Set(response.roles.map((r)=>r.id));
|
|
43
|
-
setInitialSet(storedSet);
|
|
44
|
-
setSelected(new Set(storedSet));
|
|
45
|
-
setSuccessMessage('Saved.');
|
|
46
|
-
onSaved?.(response);
|
|
47
|
-
} catch (err) {
|
|
48
|
-
const code = getErrorCode(err);
|
|
49
|
-
if ('admin.roles.userNotFound' === code) setError('This user no longer exists.');
|
|
50
|
-
else 'admin.roles.notFound' === code ? setError('One or more selected roles no longer exist. Reload the page and try again.') : setError('Could not save roles. Please try again.');
|
|
51
|
-
} finally{
|
|
52
|
-
setSaving(false);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
56
|
-
className: classnames('byline-user-roles-wrap', roles_module.wrap),
|
|
57
|
-
children: [
|
|
58
|
-
error ? /*#__PURE__*/ jsx(Alert, {
|
|
59
|
-
intent: "danger",
|
|
60
|
-
children: error
|
|
61
|
-
}) : null,
|
|
62
|
-
successMessage ? /*#__PURE__*/ jsx(Alert, {
|
|
63
|
-
intent: "success",
|
|
64
|
-
children: successMessage
|
|
65
|
-
}) : null,
|
|
66
|
-
0 === allRoles.length ? /*#__PURE__*/ jsxs("p", {
|
|
67
|
-
className: classnames('muted', 'byline-user-roles-empty', roles_module.empty),
|
|
68
|
-
children: [
|
|
69
|
-
"No roles have been created yet. Create roles in",
|
|
70
|
-
' ',
|
|
71
|
-
/*#__PURE__*/ jsx("span", {
|
|
72
|
-
className: "muted",
|
|
73
|
-
children: "/admin/roles"
|
|
74
|
-
}),
|
|
75
|
-
" first."
|
|
76
|
-
]
|
|
77
|
-
}) : /*#__PURE__*/ jsx("div", {
|
|
78
|
-
className: classnames('byline-user-roles-list', roles_module.list),
|
|
79
|
-
children: allRoles.map((role)=>/*#__PURE__*/ jsxs("div", {
|
|
80
|
-
className: classnames('byline-user-roles-row', roles_module.row),
|
|
81
|
-
children: [
|
|
82
|
-
/*#__PURE__*/ jsx(Checkbox, {
|
|
83
|
-
id: `role-${role.id}`,
|
|
84
|
-
name: `role-${role.id}`,
|
|
85
|
-
checked: selected.has(role.id),
|
|
86
|
-
disabled: saving,
|
|
87
|
-
onCheckedChange: (checked)=>handleToggle(role.id, true === checked),
|
|
88
|
-
containerClasses: classnames('byline-user-roles-checkbox-auto', roles_module["checkbox-auto"]),
|
|
89
|
-
componentClasses: classnames('byline-user-roles-checkbox-auto', roles_module["checkbox-auto"])
|
|
90
|
-
}),
|
|
91
|
-
/*#__PURE__*/ jsxs("label", {
|
|
92
|
-
htmlFor: `role-${role.id}`,
|
|
93
|
-
className: classnames('byline-user-roles-label', roles_module.label),
|
|
94
|
-
children: [
|
|
95
|
-
/*#__PURE__*/ jsxs("div", {
|
|
96
|
-
className: classnames('byline-user-roles-label-head', roles_module["label-head"]),
|
|
97
|
-
children: [
|
|
98
|
-
/*#__PURE__*/ jsx("span", {
|
|
99
|
-
className: classnames('byline-user-roles-name', roles_module.name),
|
|
100
|
-
children: role.name
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ jsx("code", {
|
|
103
|
-
className: classnames('byline-user-roles-machine', roles_module.machine),
|
|
104
|
-
children: role.machine_name
|
|
105
|
-
})
|
|
106
|
-
]
|
|
107
|
-
}),
|
|
108
|
-
role.description ? /*#__PURE__*/ jsx("p", {
|
|
109
|
-
className: classnames('muted', "byline-user-roles-description", roles_module.description),
|
|
110
|
-
children: role.description
|
|
111
|
-
}) : null
|
|
112
|
-
]
|
|
113
|
-
})
|
|
114
|
-
]
|
|
115
|
-
}, role.id))
|
|
116
|
-
}),
|
|
117
|
-
/*#__PURE__*/ jsxs("div", {
|
|
118
|
-
className: classnames('byline-user-roles-actions', roles_module.actions),
|
|
119
|
-
children: [
|
|
120
|
-
/*#__PURE__*/ jsx(Button, {
|
|
121
|
-
type: "button",
|
|
122
|
-
intent: "secondary",
|
|
123
|
-
size: "xs",
|
|
124
|
-
onClick: onClose,
|
|
125
|
-
disabled: saving,
|
|
126
|
-
className: classnames('byline-user-roles-action', roles_module.action),
|
|
127
|
-
children: successMessage ? 'Close' : 'Cancel'
|
|
128
|
-
}),
|
|
129
|
-
/*#__PURE__*/ jsx(Button, {
|
|
130
|
-
type: "button",
|
|
131
|
-
intent: "primary",
|
|
132
|
-
size: "xs",
|
|
133
|
-
onClick: ()=>void handleSave(),
|
|
134
|
-
disabled: saving || !isDirty,
|
|
135
|
-
className: classnames('byline-user-roles-action', roles_module.action),
|
|
136
|
-
children: saving ? /*#__PURE__*/ jsx(LoaderEllipsis, {
|
|
137
|
-
size: 30
|
|
138
|
-
}) : 'Save'
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
})
|
|
142
|
-
]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function getErrorCode(err) {
|
|
146
|
-
return 'string' == typeof err?.code ? err.code : null;
|
|
147
|
-
}
|
|
148
|
-
export { UserRoles };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "./roles_module.css";
|
|
2
|
-
const roles_module = {
|
|
3
|
-
wrap: "wrap-OfMVin",
|
|
4
|
-
empty: "empty-VyJNuw",
|
|
5
|
-
list: "list-Pn84NV",
|
|
6
|
-
row: "row-vl41LV",
|
|
7
|
-
label: "label-l41_WQ",
|
|
8
|
-
"label-head": "label-head-txXi6K",
|
|
9
|
-
labelHead: "label-head-txXi6K",
|
|
10
|
-
name: "name-DIzBrV",
|
|
11
|
-
machine: "machine-CKvF4T",
|
|
12
|
-
description: "description-l0rG8S",
|
|
13
|
-
actions: "actions-Z2HS5O",
|
|
14
|
-
action: "action-KN4rct",
|
|
15
|
-
"checkbox-auto": "checkbox-auto-hKjmrD",
|
|
16
|
-
checkboxAuto: "checkbox-auto-hKjmrD"
|
|
17
|
-
};
|
|
18
|
-
export default roles_module;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
:is(.wrap-OfMVin, .byline-user-roles-wrap) {
|
|
2
|
-
gap: var(--spacing-12);
|
|
3
|
-
padding: var(--spacing-4);
|
|
4
|
-
margin-top: var(--spacing-4);
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
display: flex;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
:is(.empty-VyJNuw, .byline-user-roles-empty) {
|
|
10
|
-
margin: 0;
|
|
11
|
-
font-style: italic;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
:is(.list-Pn84NV, .byline-user-roles-list) {
|
|
15
|
-
gap: var(--spacing-4);
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
display: flex;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
:is(.row-vl41LV, .byline-user-roles-row) {
|
|
21
|
-
align-items: flex-start;
|
|
22
|
-
gap: var(--spacing-8);
|
|
23
|
-
padding: var(--spacing-4) 0;
|
|
24
|
-
display: flex;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
:is(.label-l41_WQ, .byline-user-roles-label) {
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
flex: 1 1 0;
|
|
30
|
-
min-width: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:is(.label-head-txXi6K, .byline-user-roles-label-head) {
|
|
34
|
-
align-items: center;
|
|
35
|
-
gap: var(--spacing-8);
|
|
36
|
-
display: flex;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:is(.name-DIzBrV, .byline-user-roles-name) {
|
|
40
|
-
font-size: var(--font-size-sm);
|
|
41
|
-
font-weight: var(--font-weight-medium);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
:is(.machine-CKvF4T, .byline-user-roles-machine) {
|
|
45
|
-
background-color: var(--gray-100);
|
|
46
|
-
font-size: var(--font-size-xs);
|
|
47
|
-
border-radius: var(--border-radius-sm);
|
|
48
|
-
padding: .125rem .375rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:is(.description-l0rG8S, .byline-user-roles-description) {
|
|
52
|
-
font-size: var(--font-size-xs);
|
|
53
|
-
margin-bottom: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
:is(.actions-Z2HS5O, .byline-user-roles-actions) {
|
|
57
|
-
justify-content: flex-end;
|
|
58
|
-
align-items: center;
|
|
59
|
-
gap: var(--spacing-8);
|
|
60
|
-
margin-top: var(--spacing-16);
|
|
61
|
-
display: flex;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
:is(.action-KN4rct, .byline-user-roles-action) {
|
|
65
|
-
min-width: 4rem;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:is(.checkbox-auto-hKjmrD, .byline-user-roles-checkbox-auto) {
|
|
69
|
-
width: auto !important;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:is(:is([data-theme="dark"], .dark) .machine-CKvF4T, :is([data-theme="dark"], .dark) .byline-user-roles-machine) {
|
|
73
|
-
background-color: var(--canvas-800);
|
|
74
|
-
}
|
|
75
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AdminUserResponse } from '@byline/admin/admin-users';
|
|
2
|
-
interface SetPasswordProps {
|
|
3
|
-
user: AdminUserResponse;
|
|
4
|
-
onClose?: () => void;
|
|
5
|
-
onSuccess?: (user: AdminUserResponse) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function SetPassword({ user, onClose, onSuccess }: SetPasswordProps): import("react").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { revalidateLogic, useForm } from "@tanstack/react-form-start";
|
|
5
|
-
import { passwordSchema } from "@byline/core/validation";
|
|
6
|
-
import classnames from "classnames";
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
import { useBylineAdminServices } from "../../../services/admin-services-context.js";
|
|
9
|
-
import { Alert, Button, InputPassword, LoaderEllipsis } from "../../../uikit.js";
|
|
10
|
-
import set_password_module from "./set-password.module.js";
|
|
11
|
-
const setPasswordFormSchema = z.object({
|
|
12
|
-
password: passwordSchema,
|
|
13
|
-
confirm: z.string({
|
|
14
|
-
message: 'Please confirm the password'
|
|
15
|
-
})
|
|
16
|
-
}).refine((v)=>v.password === v.confirm, {
|
|
17
|
-
message: 'Passwords do not match',
|
|
18
|
-
path: [
|
|
19
|
-
'confirm'
|
|
20
|
-
]
|
|
21
|
-
});
|
|
22
|
-
function SetPassword({ user, onClose, onSuccess }) {
|
|
23
|
-
const { setAdminUserPassword } = useBylineAdminServices();
|
|
24
|
-
const [formError, setFormError] = useState(null);
|
|
25
|
-
const [successMessage, setSuccessMessage] = useState(null);
|
|
26
|
-
const form = useForm({
|
|
27
|
-
defaultValues: {
|
|
28
|
-
password: '',
|
|
29
|
-
confirm: ''
|
|
30
|
-
},
|
|
31
|
-
validationLogic: revalidateLogic({
|
|
32
|
-
mode: 'blur',
|
|
33
|
-
modeAfterSubmission: 'change'
|
|
34
|
-
}),
|
|
35
|
-
validators: {
|
|
36
|
-
onDynamic: setPasswordFormSchema
|
|
37
|
-
},
|
|
38
|
-
onSubmit: async ({ value })=>{
|
|
39
|
-
setFormError(null);
|
|
40
|
-
setSuccessMessage(null);
|
|
41
|
-
try {
|
|
42
|
-
const updated = await setAdminUserPassword({
|
|
43
|
-
data: {
|
|
44
|
-
id: user.id,
|
|
45
|
-
vid: user.vid,
|
|
46
|
-
password: value.password
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
setSuccessMessage('Password updated.');
|
|
50
|
-
form.reset({
|
|
51
|
-
password: '',
|
|
52
|
-
confirm: ''
|
|
53
|
-
});
|
|
54
|
-
onSuccess?.(updated);
|
|
55
|
-
} catch (err) {
|
|
56
|
-
const code = getErrorCode(err);
|
|
57
|
-
if ('admin.users.versionConflict' === code) return void setFormError('This user has been modified elsewhere since you opened this form. Reload to refresh and try again.');
|
|
58
|
-
if ('admin.users.notFound' === code) return void setFormError('This user no longer exists.');
|
|
59
|
-
setFormError('Could not set the password. Please try again.');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return /*#__PURE__*/ jsx("div", {
|
|
64
|
-
className: classnames('byline-user-set-password-wrap', set_password_module.wrap),
|
|
65
|
-
children: /*#__PURE__*/ jsxs("form", {
|
|
66
|
-
noValidate: true,
|
|
67
|
-
onSubmit: (event)=>{
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
event.stopPropagation();
|
|
70
|
-
form.handleSubmit();
|
|
71
|
-
},
|
|
72
|
-
className: classnames('byline-user-set-password-form', set_password_module.form),
|
|
73
|
-
children: [
|
|
74
|
-
formError ? /*#__PURE__*/ jsx(Alert, {
|
|
75
|
-
intent: "danger",
|
|
76
|
-
children: formError
|
|
77
|
-
}) : null,
|
|
78
|
-
successMessage ? /*#__PURE__*/ jsx(Alert, {
|
|
79
|
-
intent: "success",
|
|
80
|
-
children: successMessage
|
|
81
|
-
}) : null,
|
|
82
|
-
/*#__PURE__*/ jsxs("p", {
|
|
83
|
-
className: "muted",
|
|
84
|
-
children: [
|
|
85
|
-
"Sets a new password for",
|
|
86
|
-
' ',
|
|
87
|
-
/*#__PURE__*/ jsx("span", {
|
|
88
|
-
className: classnames('byline-user-set-password-target', set_password_module.target),
|
|
89
|
-
children: user.email
|
|
90
|
-
}),
|
|
91
|
-
". The user will need to sign in again with the new password."
|
|
92
|
-
]
|
|
93
|
-
}),
|
|
94
|
-
/*#__PURE__*/ jsx(form.Field, {
|
|
95
|
-
name: "password",
|
|
96
|
-
children: (field)=>/*#__PURE__*/ jsx(InputPassword, {
|
|
97
|
-
label: "New password",
|
|
98
|
-
id: "password",
|
|
99
|
-
name: field.name,
|
|
100
|
-
value: field.state.value,
|
|
101
|
-
onBlur: field.handleBlur,
|
|
102
|
-
onChange: (e)=>field.handleChange(e.currentTarget.value),
|
|
103
|
-
error: field.state.meta.errors.length > 0,
|
|
104
|
-
errorText: firstError(field.state.meta.errors),
|
|
105
|
-
autoComplete: "new-password",
|
|
106
|
-
required: true
|
|
107
|
-
})
|
|
108
|
-
}),
|
|
109
|
-
/*#__PURE__*/ jsx(form.Field, {
|
|
110
|
-
name: "confirm",
|
|
111
|
-
children: (field)=>/*#__PURE__*/ jsx(InputPassword, {
|
|
112
|
-
label: "Confirm new password",
|
|
113
|
-
id: "confirm",
|
|
114
|
-
name: field.name,
|
|
115
|
-
value: field.state.value,
|
|
116
|
-
onBlur: field.handleBlur,
|
|
117
|
-
onChange: (e)=>field.handleChange(e.currentTarget.value),
|
|
118
|
-
error: field.state.meta.errors.length > 0,
|
|
119
|
-
errorText: firstError(field.state.meta.errors),
|
|
120
|
-
autoComplete: "new-password",
|
|
121
|
-
required: true
|
|
122
|
-
})
|
|
123
|
-
}),
|
|
124
|
-
/*#__PURE__*/ jsxs("div", {
|
|
125
|
-
className: classnames('byline-user-set-password-actions', set_password_module.actions),
|
|
126
|
-
children: [
|
|
127
|
-
/*#__PURE__*/ jsx(Button, {
|
|
128
|
-
type: "button",
|
|
129
|
-
intent: "secondary",
|
|
130
|
-
size: "sm",
|
|
131
|
-
onClick: onClose,
|
|
132
|
-
className: classnames('byline-user-set-password-action', set_password_module.action),
|
|
133
|
-
children: successMessage ? 'Close' : 'Cancel'
|
|
134
|
-
}),
|
|
135
|
-
/*#__PURE__*/ jsx(form.Subscribe, {
|
|
136
|
-
selector: (state)=>({
|
|
137
|
-
canSubmit: state.canSubmit,
|
|
138
|
-
isSubmitting: state.isSubmitting,
|
|
139
|
-
isDirty: state.isDirty
|
|
140
|
-
}),
|
|
141
|
-
children: ({ canSubmit, isSubmitting })=>/*#__PURE__*/ jsx(Button, {
|
|
142
|
-
size: "sm",
|
|
143
|
-
intent: "primary",
|
|
144
|
-
type: "submit",
|
|
145
|
-
disabled: !canSubmit || isSubmitting,
|
|
146
|
-
className: classnames('byline-user-set-password-action', set_password_module.action),
|
|
147
|
-
children: true === isSubmitting ? /*#__PURE__*/ jsx(LoaderEllipsis, {
|
|
148
|
-
size: 42
|
|
149
|
-
}) : 'Save'
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
]
|
|
153
|
-
})
|
|
154
|
-
]
|
|
155
|
-
})
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
function firstError(errors) {
|
|
159
|
-
for (const err of errors){
|
|
160
|
-
if ('string' == typeof err) return err;
|
|
161
|
-
if (err && 'object' == typeof err && 'message' in err) {
|
|
162
|
-
const msg = err.message;
|
|
163
|
-
if ('string' == typeof msg) return msg;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function getErrorCode(err) {
|
|
168
|
-
return 'string' == typeof err?.code ? err.code : null;
|
|
169
|
-
}
|
|
170
|
-
export { SetPassword };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
:is(.wrap-JYgwBj, .byline-user-set-password-wrap) {
|
|
2
|
-
gap: var(--spacing-8);
|
|
3
|
-
padding: var(--spacing-4);
|
|
4
|
-
margin-top: var(--spacing-4);
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
display: flex;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
:is(.form-p6W4WN, .byline-user-set-password-form) {
|
|
10
|
-
gap: var(--spacing-16);
|
|
11
|
-
padding-top: var(--spacing-8);
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
display: flex;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:is(.target-f3_PF_, .byline-user-set-password-target) {
|
|
17
|
-
font-weight: var(--font-weight-semibold);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
:is(.actions-P5S9hQ, .byline-user-set-password-actions) {
|
|
21
|
-
justify-content: flex-end;
|
|
22
|
-
align-items: center;
|
|
23
|
-
gap: var(--spacing-8);
|
|
24
|
-
margin-top: var(--spacing-16);
|
|
25
|
-
display: flex;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:is(.action-VPbV6x, .byline-user-set-password-action) {
|
|
29
|
-
min-width: 4rem;
|
|
30
|
-
}
|
|
31
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AdminUserResponse } from '@byline/admin/admin-users';
|
|
2
|
-
interface UpdateUserProps {
|
|
3
|
-
user: AdminUserResponse;
|
|
4
|
-
onClose?: () => void;
|
|
5
|
-
onSuccess?: (user: AdminUserResponse) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function UpdateUser({ user, onClose, onSuccess }: UpdateUserProps): import("react").JSX.Element;
|
|
8
|
-
export {};
|