@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.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1900,13 +1900,25 @@ 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([]);
|
|
1908
|
+
const [origin, setOrigin] = React3__namespace.useState("");
|
|
1909
|
+
React3__namespace.useEffect(() => {
|
|
1910
|
+
setOrigin(window.location.origin);
|
|
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;
|
|
1921
|
+
const providerReturnTo = origin ? `${origin}${returnTo}` : returnTo;
|
|
1910
1922
|
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
1911
1923
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
|
|
1912
1924
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1930,17 +1942,18 @@ function ProviderSignIn({
|
|
|
1930
1942
|
]
|
|
1931
1943
|
}
|
|
1932
1944
|
),
|
|
1933
|
-
|
|
1945
|
+
providers.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1934
1946
|
"a",
|
|
1935
1947
|
{
|
|
1936
1948
|
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
1937
|
-
|
|
1949
|
+
providerReturnTo
|
|
1938
1950
|
)}`,
|
|
1939
1951
|
"data-oc-signin-provider": p.id,
|
|
1940
1952
|
style: {
|
|
1941
1953
|
display: "block",
|
|
1942
1954
|
boxSizing: "border-box",
|
|
1943
1955
|
width: "100%",
|
|
1956
|
+
marginTop: i === 0 ? 0 : 8,
|
|
1944
1957
|
padding: "0.6rem 0.875rem",
|
|
1945
1958
|
textAlign: "center",
|
|
1946
1959
|
border: "1px solid var(--border, #27272a)",
|