@orangecheck/auth-client 2.14.1 → 2.15.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/dist/index.js CHANGED
@@ -1900,17 +1900,24 @@ function SigninTab({
1900
1900
  }
1901
1901
  );
1902
1902
  }
1903
- var OAUTH_PROVIDERS = [
1904
- { id: "google", label: "Continue with Google" }
1905
- ];
1906
1903
  function ProviderSignIn({
1907
1904
  authOrigin,
1908
1905
  returnTo
1909
1906
  }) {
1907
+ const [providers, setProviders] = React3__namespace.useState([]);
1910
1908
  const [origin, setOrigin] = React3__namespace.useState("");
1911
1909
  React3__namespace.useEffect(() => {
1912
1910
  setOrigin(window.location.origin);
1913
- }, []);
1911
+ let cancelled = false;
1912
+ fetch(`${authOrigin}/api/auth/providers`, { credentials: "include" }).then((r) => r.ok ? r.json() : null).then((body) => {
1913
+ if (!cancelled && body?.providers) setProviders(body.providers);
1914
+ }).catch(() => {
1915
+ });
1916
+ return () => {
1917
+ cancelled = true;
1918
+ };
1919
+ }, [authOrigin]);
1920
+ if (providers.length === 0) return null;
1914
1921
  const providerReturnTo = origin ? `${origin}${returnTo}` : returnTo;
1915
1922
  const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
1916
1923
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
@@ -1935,7 +1942,7 @@ function ProviderSignIn({
1935
1942
  ]
1936
1943
  }
1937
1944
  ),
1938
- OAUTH_PROVIDERS.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
1945
+ providers.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
1939
1946
  "a",
1940
1947
  {
1941
1948
  href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
@@ -1946,6 +1953,7 @@ function ProviderSignIn({
1946
1953
  display: "block",
1947
1954
  boxSizing: "border-box",
1948
1955
  width: "100%",
1956
+ marginTop: i === 0 ? 0 : 8,
1949
1957
  padding: "0.6rem 0.875rem",
1950
1958
  textAlign: "center",
1951
1959
  border: "1px solid var(--border, #27272a)",