@orangecheck/auth-client 2.14.0 → 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.mjs CHANGED
@@ -1878,13 +1878,25 @@ function SigninTab({
1878
1878
  }
1879
1879
  );
1880
1880
  }
1881
- var OAUTH_PROVIDERS = [
1882
- { id: "google", label: "Continue with Google" }
1883
- ];
1884
1881
  function ProviderSignIn({
1885
1882
  authOrigin,
1886
1883
  returnTo
1887
1884
  }) {
1885
+ const [providers, setProviders] = React3.useState([]);
1886
+ const [origin, setOrigin] = React3.useState("");
1887
+ React3.useEffect(() => {
1888
+ setOrigin(window.location.origin);
1889
+ let cancelled = false;
1890
+ fetch(`${authOrigin}/api/auth/providers`, { credentials: "include" }).then((r) => r.ok ? r.json() : null).then((body) => {
1891
+ if (!cancelled && body?.providers) setProviders(body.providers);
1892
+ }).catch(() => {
1893
+ });
1894
+ return () => {
1895
+ cancelled = true;
1896
+ };
1897
+ }, [authOrigin]);
1898
+ if (providers.length === 0) return null;
1899
+ const providerReturnTo = origin ? `${origin}${returnTo}` : returnTo;
1888
1900
  const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
1889
1901
  return /* @__PURE__ */ jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
1890
1902
  /* @__PURE__ */ jsxs(
@@ -1908,17 +1920,18 @@ function ProviderSignIn({
1908
1920
  ]
1909
1921
  }
1910
1922
  ),
1911
- OAUTH_PROVIDERS.map((p) => /* @__PURE__ */ jsx(
1923
+ providers.map((p, i) => /* @__PURE__ */ jsx(
1912
1924
  "a",
1913
1925
  {
1914
1926
  href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
1915
- returnTo
1927
+ providerReturnTo
1916
1928
  )}`,
1917
1929
  "data-oc-signin-provider": p.id,
1918
1930
  style: {
1919
1931
  display: "block",
1920
1932
  boxSizing: "border-box",
1921
1933
  width: "100%",
1934
+ marginTop: i === 0 ? 0 : 8,
1922
1935
  padding: "0.6rem 0.875rem",
1923
1936
  textAlign: "center",
1924
1937
  border: "1px solid var(--border, #27272a)",