@orangecheck/auth-client 2.13.0 → 2.14.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 +81 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1699,6 +1699,13 @@ function OcSignIn({
|
|
|
1699
1699
|
const [path, setPath] = React3__namespace.useState(initialPath);
|
|
1700
1700
|
const [signedIn, setSignedIn] = React3__namespace.useState(null);
|
|
1701
1701
|
const [linkAlso, setLinkAlso] = React3__namespace.useState(false);
|
|
1702
|
+
const [oauthError, setOauthError] = React3__namespace.useState(false);
|
|
1703
|
+
React3__namespace.useEffect(() => {
|
|
1704
|
+
if (typeof window === "undefined") return;
|
|
1705
|
+
if (new URLSearchParams(window.location.search).has("oauth_error")) {
|
|
1706
|
+
setOauthError(true);
|
|
1707
|
+
}
|
|
1708
|
+
}, []);
|
|
1702
1709
|
const navigate = React3__namespace.useCallback(
|
|
1703
1710
|
async (account) => {
|
|
1704
1711
|
if (resolveReturnTo) {
|
|
@@ -1784,6 +1791,22 @@ function OcSignIn({
|
|
|
1784
1791
|
const bothEnabled = walletEnabled && emailEnabled;
|
|
1785
1792
|
const activeMethod = !emailEnabled ? "wallet" : !walletEnabled ? "email" : path;
|
|
1786
1793
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-oc-signin": "", children: [
|
|
1794
|
+
oauthError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1795
|
+
"div",
|
|
1796
|
+
{
|
|
1797
|
+
"data-oc-signin-oauth-error": "",
|
|
1798
|
+
style: {
|
|
1799
|
+
marginBottom: 14,
|
|
1800
|
+
padding: "0.6rem 0.75rem",
|
|
1801
|
+
border: "1px solid var(--destructive, #ef4444)",
|
|
1802
|
+
borderRadius: 6,
|
|
1803
|
+
color: "var(--destructive, #ef4444)",
|
|
1804
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1805
|
+
fontSize: 11
|
|
1806
|
+
},
|
|
1807
|
+
children: "That sign-in didn't complete. Please try again."
|
|
1808
|
+
}
|
|
1809
|
+
),
|
|
1787
1810
|
bothEnabled && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1788
1811
|
"div",
|
|
1789
1812
|
{
|
|
@@ -1826,6 +1849,7 @@ function OcSignIn({
|
|
|
1826
1849
|
}
|
|
1827
1850
|
)
|
|
1828
1851
|
] }),
|
|
1852
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProviderSignIn, { authOrigin, returnTo: safeReturn }),
|
|
1829
1853
|
linkPrompt && /* @__PURE__ */ jsxRuntime.jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
1830
1854
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1831
1855
|
"input",
|
|
@@ -1876,6 +1900,63 @@ function SigninTab({
|
|
|
1876
1900
|
}
|
|
1877
1901
|
);
|
|
1878
1902
|
}
|
|
1903
|
+
var OAUTH_PROVIDERS = [
|
|
1904
|
+
{ id: "google", label: "Continue with Google" }
|
|
1905
|
+
];
|
|
1906
|
+
function ProviderSignIn({
|
|
1907
|
+
authOrigin,
|
|
1908
|
+
returnTo
|
|
1909
|
+
}) {
|
|
1910
|
+
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
1911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
|
|
1912
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1913
|
+
"div",
|
|
1914
|
+
{
|
|
1915
|
+
style: {
|
|
1916
|
+
display: "flex",
|
|
1917
|
+
alignItems: "center",
|
|
1918
|
+
gap: 10,
|
|
1919
|
+
margin: "4px 0 12px",
|
|
1920
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
1921
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1922
|
+
fontSize: 10,
|
|
1923
|
+
letterSpacing: "0.16em",
|
|
1924
|
+
textTransform: "uppercase"
|
|
1925
|
+
},
|
|
1926
|
+
children: [
|
|
1927
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: line }),
|
|
1928
|
+
"or",
|
|
1929
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: line })
|
|
1930
|
+
]
|
|
1931
|
+
}
|
|
1932
|
+
),
|
|
1933
|
+
OAUTH_PROVIDERS.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1934
|
+
"a",
|
|
1935
|
+
{
|
|
1936
|
+
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
1937
|
+
returnTo
|
|
1938
|
+
)}`,
|
|
1939
|
+
"data-oc-signin-provider": p.id,
|
|
1940
|
+
style: {
|
|
1941
|
+
display: "block",
|
|
1942
|
+
boxSizing: "border-box",
|
|
1943
|
+
width: "100%",
|
|
1944
|
+
padding: "0.6rem 0.875rem",
|
|
1945
|
+
textAlign: "center",
|
|
1946
|
+
border: "1px solid var(--border, #27272a)",
|
|
1947
|
+
borderRadius: 6,
|
|
1948
|
+
background: "transparent",
|
|
1949
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
1950
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1951
|
+
fontSize: 12,
|
|
1952
|
+
textDecoration: "none"
|
|
1953
|
+
},
|
|
1954
|
+
children: p.label
|
|
1955
|
+
},
|
|
1956
|
+
p.id
|
|
1957
|
+
))
|
|
1958
|
+
] });
|
|
1959
|
+
}
|
|
1879
1960
|
function WalletFlow({ authOrigin, audience, onSuccess }) {
|
|
1880
1961
|
const [address, setAddress] = React3__namespace.useState("");
|
|
1881
1962
|
const [error, setError] = React3__namespace.useState(null);
|