@authhero/react-admin 0.10.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.
Files changed (110) hide show
  1. package/.eslintrc.js +21 -0
  2. package/.vercelignore +4 -0
  3. package/CHANGELOG.md +56 -0
  4. package/LICENSE +21 -0
  5. package/README.md +50 -0
  6. package/index.html +125 -0
  7. package/package.json +61 -0
  8. package/prettier.config.js +1 -0
  9. package/public/favicon.ico +0 -0
  10. package/public/manifest.json +15 -0
  11. package/src/App.spec.tsx +42 -0
  12. package/src/App.tsx +232 -0
  13. package/src/AuthCallback.tsx +138 -0
  14. package/src/Layout.tsx +12 -0
  15. package/src/TenantsApp.tsx +115 -0
  16. package/src/auth0DataProvider.ts +1242 -0
  17. package/src/authProvider.ts +521 -0
  18. package/src/components/CertificateErrorDialog.tsx +116 -0
  19. package/src/components/DomainSelector.tsx +401 -0
  20. package/src/components/TenantAppBar.tsx +83 -0
  21. package/src/components/TenantLayout.tsx +25 -0
  22. package/src/components/TenantsAppBar.tsx +21 -0
  23. package/src/components/TenantsLayout.tsx +28 -0
  24. package/src/components/activity/ActivityDashboard.tsx +381 -0
  25. package/src/components/activity/index.ts +1 -0
  26. package/src/components/branding/BrandingList.tsx +0 -0
  27. package/src/components/branding/BrandingShow.tsx +0 -0
  28. package/src/components/branding/ThemesTab.tsx +286 -0
  29. package/src/components/branding/edit.tsx +149 -0
  30. package/src/components/branding/hooks/useThemesData.ts +123 -0
  31. package/src/components/branding/index.ts +2 -0
  32. package/src/components/branding/list.tsx +12 -0
  33. package/src/components/clients/create.tsx +12 -0
  34. package/src/components/clients/edit.tsx +1285 -0
  35. package/src/components/clients/index.ts +3 -0
  36. package/src/components/clients/list.tsx +37 -0
  37. package/src/components/common/DateAgo.tsx +6 -0
  38. package/src/components/common/JsonOutput.tsx +26 -0
  39. package/src/components/common/index.ts +1 -0
  40. package/src/components/connections/create.tsx +35 -0
  41. package/src/components/connections/edit.tsx +212 -0
  42. package/src/components/connections/index.ts +3 -0
  43. package/src/components/connections/list.tsx +15 -0
  44. package/src/components/custom-domains/create.tsx +26 -0
  45. package/src/components/custom-domains/edit.tsx +101 -0
  46. package/src/components/custom-domains/index.ts +3 -0
  47. package/src/components/custom-domains/list.tsx +16 -0
  48. package/src/components/flows/create.tsx +30 -0
  49. package/src/components/flows/edit.tsx +238 -0
  50. package/src/components/flows/index.ts +3 -0
  51. package/src/components/flows/list.tsx +15 -0
  52. package/src/components/forms/FlowEditor.tsx +1363 -0
  53. package/src/components/forms/NodeEditor.tsx +1119 -0
  54. package/src/components/forms/RichTextEditor.tsx +145 -0
  55. package/src/components/forms/create.tsx +30 -0
  56. package/src/components/forms/edit.tsx +256 -0
  57. package/src/components/forms/index.ts +3 -0
  58. package/src/components/forms/list.tsx +16 -0
  59. package/src/components/hooks/create.tsx +96 -0
  60. package/src/components/hooks/edit.tsx +114 -0
  61. package/src/components/hooks/index.ts +3 -0
  62. package/src/components/hooks/list.tsx +17 -0
  63. package/src/components/listActions/PostListActions.tsx +10 -0
  64. package/src/components/logs/LogIcon.tsx +32 -0
  65. package/src/components/logs/LogShow.tsx +82 -0
  66. package/src/components/logs/LogType.tsx +38 -0
  67. package/src/components/logs/index.ts +4 -0
  68. package/src/components/logs/list.tsx +41 -0
  69. package/src/components/organizations/create.tsx +13 -0
  70. package/src/components/organizations/edit.tsx +682 -0
  71. package/src/components/organizations/index.ts +3 -0
  72. package/src/components/organizations/list.tsx +21 -0
  73. package/src/components/resource-servers/create.tsx +87 -0
  74. package/src/components/resource-servers/edit.tsx +121 -0
  75. package/src/components/resource-servers/index.ts +3 -0
  76. package/src/components/resource-servers/list.tsx +47 -0
  77. package/src/components/roles/create.tsx +12 -0
  78. package/src/components/roles/edit.tsx +426 -0
  79. package/src/components/roles/index.ts +3 -0
  80. package/src/components/roles/list.tsx +24 -0
  81. package/src/components/sessions/edit.tsx +101 -0
  82. package/src/components/sessions/index.ts +3 -0
  83. package/src/components/sessions/list.tsx +20 -0
  84. package/src/components/sessions/show.tsx +113 -0
  85. package/src/components/settings/edit.tsx +236 -0
  86. package/src/components/settings/index.ts +2 -0
  87. package/src/components/settings/list.tsx +14 -0
  88. package/src/components/tenants/create.tsx +20 -0
  89. package/src/components/tenants/edit.tsx +54 -0
  90. package/src/components/tenants/index.ts +2 -0
  91. package/src/components/tenants/list.tsx +67 -0
  92. package/src/components/themes/edit.tsx +200 -0
  93. package/src/components/themes/index.ts +2 -0
  94. package/src/components/themes/list.tsx +12 -0
  95. package/src/components/users/create.tsx +144 -0
  96. package/src/components/users/edit.tsx +1711 -0
  97. package/src/components/users/index.ts +3 -0
  98. package/src/components/users/list.tsx +35 -0
  99. package/src/data.json +121 -0
  100. package/src/dataProvider.ts +97 -0
  101. package/src/index.tsx +106 -0
  102. package/src/lib/logs.ts +21 -0
  103. package/src/types/reactflow.d.ts +86 -0
  104. package/src/utils/domainUtils.ts +169 -0
  105. package/src/utils/tokenUtils.ts +75 -0
  106. package/src/vite-env.d.ts +1 -0
  107. package/tsconfig.json +37 -0
  108. package/tsconfig.node.json +10 -0
  109. package/vercel.json +17 -0
  110. package/vite.config.ts +30 -0
@@ -0,0 +1,200 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export { ThemesEdit } from "./edit";
2
+ export { ThemesList } from "./list";
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,144 @@
1
+ import {
2
+ Create,
3
+ SimpleForm,
4
+ TextInput,
5
+ required,
6
+ SelectInput,
7
+ useGetList,
8
+ FormDataConsumer,
9
+ } from "react-admin";
10
+ import { useState } from "react";
11
+
12
+ export function UserCreate() {
13
+ const [_, setSelectedConnection] = useState(null);
14
+
15
+ // Fetch available connections for the tenant
16
+ const { data: connections, isLoading } = useGetList("connections", {
17
+ pagination: { page: 1, perPage: 100 },
18
+ sort: { field: "name", order: "ASC" },
19
+ });
20
+
21
+ const transform = (data) => {
22
+ // Set the provider based on the connection if available
23
+ if (data.connection) {
24
+ const connectionData = connections?.find(
25
+ (c) => c.name === data.connection,
26
+ );
27
+ if (connectionData) {
28
+ // For Username-Password-Authentication connections, the provider should be "auth2"
29
+ if (connectionData.strategy === "Username-Password-Authentication") {
30
+ data.provider = "auth2";
31
+ } else {
32
+ data.provider = connectionData.strategy || "database";
33
+ }
34
+ }
35
+ }
36
+ return data;
37
+ };
38
+
39
+ return (
40
+ <Create transform={transform}>
41
+ <SimpleForm>
42
+ <SelectInput
43
+ source="connection"
44
+ label="Connection Provider"
45
+ choices={
46
+ isLoading
47
+ ? []
48
+ : connections?.map((connection) => ({
49
+ id: connection.name,
50
+ name: connection.name,
51
+ // Store connection strategy for reference
52
+ _strategy: connection.strategy,
53
+ }))
54
+ }
55
+ validate={[required()]}
56
+ onChange={(e) => {
57
+ const selectedConnectionData = connections?.find(
58
+ (c) => c.name === e.target.value,
59
+ );
60
+ setSelectedConnection(selectedConnectionData);
61
+ }}
62
+ />
63
+
64
+ <FormDataConsumer>
65
+ {({ formData }) => {
66
+ const connectionValue = formData.connection;
67
+ const connectionData = connections?.find(
68
+ (c) => c.name === connectionValue,
69
+ );
70
+
71
+ if (!connectionData) {
72
+ // If no connection is selected yet, show both fields
73
+ return (
74
+ <>
75
+ <TextInput source="email" type="email" />
76
+ <TextInput source="phone_number" />
77
+ </>
78
+ );
79
+ }
80
+
81
+ // Show email input for email-based connections
82
+ if (
83
+ connectionData.strategy === "email" ||
84
+ connectionData.strategy === "auth2" ||
85
+ connectionData.strategy === "Username-Password-Authentication"
86
+ ) {
87
+ // For password connections, also show password field
88
+ if (
89
+ connectionData.strategy === "Username-Password-Authentication"
90
+ ) {
91
+ return (
92
+ <>
93
+ <TextInput
94
+ source="email"
95
+ type="email"
96
+ validate={[required()]}
97
+ />
98
+ <TextInput
99
+ source="password"
100
+ type="password"
101
+ validate={[required()]}
102
+ helperText="Password for the user account"
103
+ />
104
+ </>
105
+ );
106
+ }
107
+ return (
108
+ <TextInput
109
+ source="email"
110
+ type="email"
111
+ validate={[required()]}
112
+ />
113
+ );
114
+ }
115
+
116
+ // Show phone input for SMS-based connections
117
+ if (connectionData.strategy === "sms") {
118
+ return (
119
+ <TextInput
120
+ source="phone_number"
121
+ validate={[required()]}
122
+ helperText="Enter the phone number with country code e.g., +1234567890"
123
+ />
124
+ );
125
+ }
126
+
127
+ // Default case - show both fields but make neither required
128
+ return (
129
+ <>
130
+ <TextInput source="email" type="email" />
131
+ <TextInput source="phone_number" />
132
+ </>
133
+ );
134
+ }}
135
+ </FormDataConsumer>
136
+
137
+ <TextInput source="name" />
138
+ <TextInput source="given_name" />
139
+ <TextInput source="family_name" />
140
+ <TextInput source="picture" />
141
+ </SimpleForm>
142
+ </Create>
143
+ );
144
+ }