@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 +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1878,17 +1878,24 @@ 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([]);
|
|
1888
1886
|
const [origin, setOrigin] = React3.useState("");
|
|
1889
1887
|
React3.useEffect(() => {
|
|
1890
1888
|
setOrigin(window.location.origin);
|
|
1891
|
-
|
|
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;
|
|
1892
1899
|
const providerReturnTo = origin ? `${origin}${returnTo}` : returnTo;
|
|
1893
1900
|
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
1894
1901
|
return /* @__PURE__ */ jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
|
|
@@ -1913,7 +1920,7 @@ function ProviderSignIn({
|
|
|
1913
1920
|
]
|
|
1914
1921
|
}
|
|
1915
1922
|
),
|
|
1916
|
-
|
|
1923
|
+
providers.map((p, i) => /* @__PURE__ */ jsx(
|
|
1917
1924
|
"a",
|
|
1918
1925
|
{
|
|
1919
1926
|
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
@@ -1924,6 +1931,7 @@ function ProviderSignIn({
|
|
|
1924
1931
|
display: "block",
|
|
1925
1932
|
boxSizing: "border-box",
|
|
1926
1933
|
width: "100%",
|
|
1934
|
+
marginTop: i === 0 ? 0 : 8,
|
|
1927
1935
|
padding: "0.6rem 0.875rem",
|
|
1928
1936
|
textAlign: "center",
|
|
1929
1937
|
border: "1px solid var(--border, #27272a)",
|