@authhero/react-admin 0.16.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @authhero/react-admin
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 928d358: Add userinfo hook
8
+
9
+ ## 0.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - c8c83e3: Add a admin:organizations permission to hande organizations in the control_plane
14
+
3
15
  ## 0.16.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authhero/react-admin",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1254,6 +1254,22 @@ export default (
1254
1254
  return { data: res.json };
1255
1255
  },
1256
1256
 
1257
- deleteMany: () => Promise.reject("not supporting deleteMany"),
1257
+ deleteMany: async (resource, params) => {
1258
+ const headers = new Headers({ "content-type": "text/plain" });
1259
+ if (tenantId) headers.set("tenant-id", tenantId);
1260
+
1261
+ const deletedIds: typeof params.ids = [];
1262
+
1263
+ for (const id of params.ids) {
1264
+ const resourceUrl = `${resource}/${encodeURIComponent(String(id))}`;
1265
+ await httpClient(`${apiUrl}/api/v2/${resourceUrl}`, {
1266
+ method: "DELETE",
1267
+ headers,
1268
+ });
1269
+ deletedIds.push(id);
1270
+ }
1271
+
1272
+ return { data: deletedIds };
1273
+ },
1258
1274
  };
1259
1275
  };
@@ -9,9 +9,32 @@ import {
9
9
  } from "react-admin";
10
10
  import { Stack } from "@mui/material";
11
11
 
12
+ // Recursively remove null/undefined values from an object
13
+ function removeNullValues(obj: Record<string, unknown>): Record<string, unknown> {
14
+ const result: Record<string, unknown> = {};
15
+ for (const [key, value] of Object.entries(obj)) {
16
+ if (value === null || value === undefined) {
17
+ continue;
18
+ }
19
+ if (typeof value === "object" && !Array.isArray(value)) {
20
+ const cleaned = removeNullValues(value as Record<string, unknown>);
21
+ if (Object.keys(cleaned).length > 0) {
22
+ result[key] = cleaned;
23
+ }
24
+ } else {
25
+ result[key] = value;
26
+ }
27
+ }
28
+ return result;
29
+ }
30
+
12
31
  export function SettingsEdit() {
32
+ const transform = (data: Record<string, unknown>) => {
33
+ return removeNullValues(data);
34
+ };
35
+
13
36
  return (
14
- <Edit>
37
+ <Edit transform={transform}>
15
38
  <TabbedForm>
16
39
  <TabbedForm.Tab label="General">
17
40
  <Stack spacing={2}>
@@ -215,6 +238,11 @@ export function SettingsEdit() {
215
238
  source="flags.mfa_show_factor_list_on_enrollment"
216
239
  label="MFA Show Factor List on Enrollment"
217
240
  />
241
+ <BooleanInput
242
+ source="flags.inherit_global_permissions_in_organizations"
243
+ label="Inherit Tenant Permissions in Organizations"
244
+ helperText="When enabled, tenant-level permissions will be inherited when users request organization-scoped tokens"
245
+ />
218
246
  </Stack>
219
247
  </TabbedForm.Tab>
220
248
 
@@ -1,21 +0,0 @@
1
- // Create a custom AppBar specifically for TenantsApp
2
- import { AppBar as ReactAdminAppBar, TitlePortal } from "react-admin";
3
- import { Box } from "@mui/material";
4
-
5
- interface TenantsAppBarProps {
6
- domainSelectorButton?: React.ReactNode;
7
- [key: string]: any;
8
- }
9
-
10
- export function TenantsAppBar(props: TenantsAppBarProps) {
11
- const { domainSelectorButton, ...rest } = props;
12
-
13
- return (
14
- <ReactAdminAppBar {...rest}>
15
- <TitlePortal />
16
- <Box sx={{ display: "flex", alignItems: "center", flex: 1, justifyContent: "flex-end" }}>
17
- {domainSelectorButton}
18
- </Box>
19
- </ReactAdminAppBar>
20
- );
21
- }
@@ -1,62 +0,0 @@
1
- import {
2
- BooleanInput,
3
- DateField,
4
- Edit,
5
- FieldTitle,
6
- Labeled,
7
- SelectInput,
8
- TabbedForm,
9
- TextInput,
10
- } from "react-admin";
11
- import { ColorInput } from "react-admin-color-picker";
12
-
13
- export function TenantsEdit() {
14
- return (
15
- <Edit>
16
- <TabbedForm>
17
- <TabbedForm.Tab label="Info">
18
- <TextInput source="id" />
19
- <TextInput source="name" />
20
- <TextInput source="audience" label="Audience" />
21
- <TextInput source="support_url" label="Support Url" />
22
- <Labeled label={<FieldTitle source="created_at" />}>
23
- <DateField source="created_at" showTime={true} />
24
- </Labeled>
25
- <Labeled label={<FieldTitle source="updated_at" />}>
26
- <DateField source="updated_at" showTime={true} />
27
- </Labeled>
28
- </TabbedForm.Tab>
29
- <TabbedForm.Tab label="Communication">
30
- <TextInput source="sender_email" />
31
- <TextInput source="sender_name" />
32
- </TabbedForm.Tab>
33
- <TabbedForm.Tab label="Style">
34
- <SelectInput
35
- source="language"
36
- label="Languages"
37
- choices={[
38
- { id: "en", name: "English" },
39
- { id: "nb", name: "Norwegian" },
40
- { id: "sv", name: "Swedish" },
41
- { id: "it", name: "Italian" },
42
- { id: "pl", name: "Polish" },
43
- { id: "da", name: "Danish" },
44
- { id: "cs", name: "Czech" },
45
- { id: "fi", name: "Finnish" },
46
- ]}
47
- />
48
- <ColorInput source="primary_color" label="Primary Color" />
49
- <ColorInput source="secondary_color" label="Secondary Color" />
50
- <TextInput source="logo" label="Logo" />
51
- </TabbedForm.Tab>
52
- <TabbedForm.Tab label="Settings">
53
- <BooleanInput
54
- source="flags.inherit_global_permissions_in_organizations"
55
- label="Inherit Tenant Permissions in Organizations"
56
- helperText="When enabled, tenant-level permissions will be inherited when users request organization-scoped tokens"
57
- />
58
- </TabbedForm.Tab>
59
- </TabbedForm>
60
- </Edit>
61
- );
62
- }
@@ -1,200 +0,0 @@
1
- import {
2
- Edit,
3
- TextInput,
4
- NumberInput,
5
- BooleanInput,
6
- SelectInput,
7
- SimpleForm,
8
- } from "react-admin";
9
- import { ColorInput } from "react-admin-color-picker";
10
-
11
- export function ThemesEdit() {
12
- return (
13
- <Edit>
14
- <SimpleForm>
15
- <TextInput source="displayName" label="Display Name" />
16
-
17
- {/* Colors Section */}
18
- <h3 style={{ marginTop: 24, marginBottom: 16 }}>Colors</h3>
19
- <ColorInput source="colors.primary_button" label="Primary Button" />
20
- <ColorInput
21
- source="colors.primary_button_label"
22
- label="Primary Button Label"
23
- />
24
- <ColorInput
25
- source="colors.secondary_button_border"
26
- label="Secondary Button Border"
27
- />
28
- <ColorInput
29
- source="colors.secondary_button_label"
30
- label="Secondary Button Label"
31
- />
32
- <ColorInput source="colors.base_focus_color" label="Base Focus Color" />
33
- <ColorInput source="colors.base_hover_color" label="Base Hover Color" />
34
- <ColorInput source="colors.body_text" label="Body Text" />
35
- <SelectInput
36
- source="colors.captcha_widget_theme"
37
- label="Captcha Widget Theme"
38
- choices={[{ id: "auto", name: "Auto" }]}
39
- />
40
- <ColorInput source="colors.error" label="Error" />
41
- <ColorInput source="colors.header" label="Header" />
42
- <ColorInput source="colors.icons" label="Icons" />
43
- <ColorInput source="colors.input_background" label="Input Background" />
44
- <ColorInput source="colors.input_border" label="Input Border" />
45
- <ColorInput
46
- source="colors.input_filled_text"
47
- label="Input Filled Text"
48
- />
49
- <ColorInput
50
- source="colors.input_labels_placeholders"
51
- label="Input Labels/Placeholders"
52
- />
53
- <ColorInput
54
- source="colors.links_focused_components"
55
- label="Links/Focused Components"
56
- />
57
- <ColorInput source="colors.success" label="Success" />
58
- <ColorInput
59
- source="colors.widget_background"
60
- label="Widget Background"
61
- />
62
- <ColorInput source="colors.widget_border" label="Widget Border" />
63
-
64
- {/* Borders Section */}
65
- <h3 style={{ marginTop: 24, marginBottom: 16 }}>Borders</h3>
66
- <NumberInput
67
- source="borders.button_border_radius"
68
- label="Button Border Radius"
69
- />
70
- <NumberInput
71
- source="borders.button_border_weight"
72
- label="Button Border Weight"
73
- />
74
- <SelectInput
75
- source="borders.buttons_style"
76
- label="Buttons Style"
77
- choices={[
78
- { id: "pill", name: "Pill" },
79
- { id: "rounded", name: "Rounded" },
80
- { id: "sharp", name: "Sharp" },
81
- ]}
82
- />
83
- <NumberInput
84
- source="borders.input_border_radius"
85
- label="Input Border Radius"
86
- />
87
- <NumberInput
88
- source="borders.input_border_weight"
89
- label="Input Border Weight"
90
- />
91
- <SelectInput
92
- source="borders.inputs_style"
93
- label="Inputs Style"
94
- choices={[
95
- { id: "pill", name: "Pill" },
96
- { id: "rounded", name: "Rounded" },
97
- { id: "sharp", name: "Sharp" },
98
- ]}
99
- />
100
- <BooleanInput
101
- source="borders.show_widget_shadow"
102
- label="Show Widget Shadow"
103
- />
104
- <NumberInput
105
- source="borders.widget_border_weight"
106
- label="Widget Border Weight"
107
- />
108
- <NumberInput
109
- source="borders.widget_corner_radius"
110
- label="Widget Corner Radius"
111
- />
112
-
113
- {/* Fonts Section */}
114
- <h3 style={{ marginTop: 24, marginBottom: 16 }}>Fonts</h3>
115
- <TextInput source="fonts.font_url" label="Font URL" fullWidth />
116
- <NumberInput
117
- source="fonts.reference_text_size"
118
- label="Reference Text Size"
119
- />
120
-
121
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Body Text</h4>
122
- <BooleanInput source="fonts.body_text.bold" label="Bold" />
123
- <NumberInput source="fonts.body_text.size" label="Size" />
124
-
125
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Button Text</h4>
126
- <BooleanInput source="fonts.buttons_text.bold" label="Bold" />
127
- <NumberInput source="fonts.buttons_text.size" label="Size" />
128
-
129
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Input Labels</h4>
130
- <BooleanInput source="fonts.input_labels.bold" label="Bold" />
131
- <NumberInput source="fonts.input_labels.size" label="Size" />
132
-
133
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Links</h4>
134
- <BooleanInput source="fonts.links.bold" label="Bold" />
135
- <NumberInput source="fonts.links.size" label="Size" />
136
- <SelectInput
137
- source="fonts.links_style"
138
- label="Links Style"
139
- choices={[
140
- { id: "normal", name: "Normal" },
141
- { id: "underlined", name: "Underlined" },
142
- ]}
143
- />
144
-
145
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Subtitle</h4>
146
- <BooleanInput source="fonts.subtitle.bold" label="Bold" />
147
- <NumberInput source="fonts.subtitle.size" label="Size" />
148
-
149
- <h4 style={{ marginTop: 16, marginBottom: 8 }}>Title</h4>
150
- <BooleanInput source="fonts.title.bold" label="Bold" />
151
- <NumberInput source="fonts.title.size" label="Size" />
152
-
153
- {/* Page Background Section */}
154
- <h3 style={{ marginTop: 24, marginBottom: 16 }}>Page Background</h3>
155
- <ColorInput
156
- source="page_background.background_color"
157
- label="Background Color"
158
- />
159
- <TextInput
160
- source="page_background.background_image_url"
161
- label="Background Image URL"
162
- fullWidth
163
- />
164
- <SelectInput
165
- source="page_background.page_layout"
166
- label="Page Layout"
167
- choices={[{ id: "center", name: "Center" }]}
168
- />
169
-
170
- {/* Widget Section */}
171
- <h3 style={{ marginTop: 24, marginBottom: 16 }}>Widget</h3>
172
- <SelectInput
173
- source="widget.header_text_alignment"
174
- label="Header Text Alignment"
175
- choices={[{ id: "center", name: "Center" }]}
176
- />
177
- <NumberInput source="widget.logo_height" label="Logo Height" />
178
- <SelectInput
179
- source="widget.logo_position"
180
- label="Logo Position"
181
- choices={[
182
- { id: "center", name: "Center" },
183
- { id: "left", name: "Left" },
184
- { id: "none", name: "None" },
185
- { id: "right", name: "Right" },
186
- ]}
187
- />
188
- <TextInput source="widget.logo_url" label="Logo URL" fullWidth />
189
- <SelectInput
190
- source="widget.social_buttons_layout"
191
- label="Social Buttons Layout"
192
- choices={[
193
- { id: "bottom", name: "Bottom" },
194
- { id: "top", name: "Top" },
195
- ]}
196
- />
197
- </SimpleForm>
198
- </Edit>
199
- );
200
- }
@@ -1,2 +0,0 @@
1
- export { ThemesEdit } from "./edit";
2
- export { ThemesList } from "./list";
@@ -1,12 +0,0 @@
1
- import { List, Datagrid, TextField } from "react-admin";
2
-
3
- export function ThemesList() {
4
- return (
5
- <List>
6
- <Datagrid>
7
- <TextField source="displayName" />
8
- <TextField source="themeId" />
9
- </Datagrid>
10
- </List>
11
- );
12
- }