@authhero/react-admin 0.24.0 → 0.26.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.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c89fb59: Skip dialog if there is a env varitable for environment
8
+
9
+ ## 0.25.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 7bf78f7: Add deploy buttons for react-admin
14
+
3
15
  ## 0.24.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # react-admin
2
2
 
3
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fauthhero%2Fauthhero&env=VITE_AUTH0_DOMAIN,VITE_AUTH0_CLIENT_ID,VITE_AUTH0_API_URL,VITE_SINGLE_DOMAIN_MODE&envDescription=Configure%20your%20AuthHero%20connection.%20Set%20VITE_SINGLE_DOMAIN_MODE%20to%20%22true%22%20to%20skip%20domain%20selector.&envLink=https%3A%2F%2Fgithub.com%2Fauthhero%2Fauthhero%2Fblob%2Fmain%2Fapps%2Freact-admin%2FREADME.md&project-name=authhero-admin&repository-name=authhero-admin&root-directory=apps%2Freact-admin&build-command=pnpm%20run%20build&output-directory=dist&install-command=corepack%20enable%20%26%26%20corepack%20prepare%20pnpm%4010.11.0%20--activate%20%26%26%20pnpm%20install%20--no-frozen-lockfile)
4
+ [![Deploy to Cloudflare Pages](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/authhero/authhero)
5
+
6
+ > **Cloudflare Pages Setup:** Select "Pages" during setup, set root directory to `apps/react-admin`, build command to `pnpm run build`, and output directory to `dist`. Add environment variables `VITE_AUTH0_DOMAIN`, `VITE_AUTH0_CLIENT_ID`, `VITE_AUTH0_API_URL`, and `VITE_SINGLE_DOMAIN_MODE`.
7
+
3
8
  ## Installation
4
9
 
5
10
  Install the application dependencies by running:
@@ -26,6 +31,9 @@ VITE_AUTH0_API_URL=https://auth2.sesamy.com
26
31
  VITE_AUTH0_DOMAIN=localhost:3000
27
32
  VITE_AUTH0_CLIENT_ID=auth-admin
28
33
  VITE_AUTH0_API_URL=https://localhost:3000
34
+
35
+ # Optional: Skip domain selector and use configured domain directly
36
+ VITE_SINGLE_DOMAIN_MODE=true
29
37
  ```
30
38
 
31
39
  See `.env.example` for more details.
@@ -33,7 +41,8 @@ See `.env.example` for more details.
33
41
  **Notes:**
34
42
 
35
43
  - If `VITE_AUTH0_DOMAIN` is set, it will be automatically added to the domain list
36
- - Users can still add additional domains through the UI
44
+ - Users can still add additional domains through the UI (unless `VITE_SINGLE_DOMAIN_MODE=true`)
45
+ - Set `VITE_SINGLE_DOMAIN_MODE=true` to skip the domain selector entirely
37
46
 
38
47
  ## Development
39
48
 
@@ -55,6 +64,12 @@ npm run build
55
64
  yarn build
56
65
  ```
57
66
 
67
+ ## Deployment
68
+
69
+ The React Admin application can be deployed to Vercel. See the [Vercel deployment guide](../docs/deployment-targets/vercel.md) for detailed instructions.
70
+
71
+ **Important:** When deploying to Vercel, you must set the environment variable `ENABLE_EXPERIMENTAL_COREPACK=1` to avoid build errors with pnpm.
72
+
58
73
  ## DataProvider
59
74
 
60
75
  The included data provider use [FakeREST](https://github.com/marmelab/fakerest) to simulate a backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authhero/react-admin",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "packageManager": "pnpm@10.20.0",
5
5
  "private": false,
6
6
  "repository": {
package/src/index.tsx CHANGED
@@ -7,13 +7,12 @@ import { AuthCallback } from "./AuthCallback";
7
7
  import { DomainSelector } from "./components/DomainSelector";
8
8
  import { getSelectedDomainFromStorage } from "./utils/domainUtils";
9
9
 
10
- // Check if running on local.authhero.net - if so, auto-connect to localhost:3000
11
- const isLocalDevelopment = window.location.hostname.startsWith("local.");
12
- const LOCAL_DOMAIN = "localhost:3000";
10
+ // If a domain is configured via env, use single-domain mode automatically
11
+ const envDomain = import.meta.env.VITE_AUTH0_DOMAIN;
13
12
 
14
13
  function Root() {
15
14
  const [selectedDomain, setSelectedDomain] = useState<string | null>(
16
- isLocalDevelopment ? LOCAL_DOMAIN : null,
15
+ envDomain || null,
17
16
  );
18
17
  const currentPath = location.pathname;
19
18
  const isAuthCallback = currentPath === "/auth-callback";
@@ -24,10 +23,9 @@ function Root() {
24
23
  currentPath.startsWith("/tenants/create") ||
25
24
  currentPath === "/tenants/";
26
25
 
27
- // Load domain from cookies on component mount (skip for local development)
26
+ // Load domain from cookies on component mount (only when no env domain configured)
28
27
  useEffect(() => {
29
- if (isLocalDevelopment) {
30
- // For local development, always use localhost:3000
28
+ if (envDomain) {
31
29
  return;
32
30
  }
33
31
  const savedDomain = getSelectedDomainFromStorage();
@@ -47,9 +45,8 @@ function Root() {
47
45
  );
48
46
  }
49
47
 
50
- // Show domain selector on root path or if no domain is selected
51
- // Skip for local development - redirect to /tenants instead
52
- if (!isLocalDevelopment && (isRootPath || !selectedDomain)) {
48
+ // Show domain selector only if no domain is selected
49
+ if (!selectedDomain) {
53
50
  return (
54
51
  <DomainSelector
55
52
  onDomainSelected={(domain) => setSelectedDomain(domain)}
@@ -58,8 +55,8 @@ function Root() {
58
55
  );
59
56
  }
60
57
 
61
- // For local development on root path, redirect to /tenants
62
- if (isLocalDevelopment && isRootPath) {
58
+ // For env-configured domain on root path, redirect to /tenants
59
+ if (envDomain && isRootPath) {
63
60
  window.location.href = "/tenants";
64
61
  return null;
65
62
  }
@@ -89,12 +86,7 @@ function Root() {
89
86
  );
90
87
  }
91
88
 
92
- // Fallback to domain selector (or redirect for local development)
93
- if (isLocalDevelopment) {
94
- window.location.href = "/tenants";
95
- return null;
96
- }
97
-
89
+ // Fallback to domain selector
98
90
  return (
99
91
  <DomainSelector
100
92
  onDomainSelected={(domain) => setSelectedDomain(domain)}
package/vercel.json CHANGED
@@ -13,5 +13,5 @@
13
13
  "destination": "/index.html"
14
14
  }
15
15
  ],
16
- "installCommand": "pnpm install --no-frozen-lockfile"
16
+ "installCommand": "corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm install --no-frozen-lockfile"
17
17
  }