@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.mjs
CHANGED
|
@@ -1677,6 +1677,13 @@ function OcSignIn({
|
|
|
1677
1677
|
const [path, setPath] = React3.useState(initialPath);
|
|
1678
1678
|
const [signedIn, setSignedIn] = React3.useState(null);
|
|
1679
1679
|
const [linkAlso, setLinkAlso] = React3.useState(false);
|
|
1680
|
+
const [oauthError, setOauthError] = React3.useState(false);
|
|
1681
|
+
React3.useEffect(() => {
|
|
1682
|
+
if (typeof window === "undefined") return;
|
|
1683
|
+
if (new URLSearchParams(window.location.search).has("oauth_error")) {
|
|
1684
|
+
setOauthError(true);
|
|
1685
|
+
}
|
|
1686
|
+
}, []);
|
|
1680
1687
|
const navigate = React3.useCallback(
|
|
1681
1688
|
async (account) => {
|
|
1682
1689
|
if (resolveReturnTo) {
|
|
@@ -1762,6 +1769,22 @@ function OcSignIn({
|
|
|
1762
1769
|
const bothEnabled = walletEnabled && emailEnabled;
|
|
1763
1770
|
const activeMethod = !emailEnabled ? "wallet" : !walletEnabled ? "email" : path;
|
|
1764
1771
|
return /* @__PURE__ */ jsxs("div", { className, "data-oc-signin": "", children: [
|
|
1772
|
+
oauthError && /* @__PURE__ */ jsx(
|
|
1773
|
+
"div",
|
|
1774
|
+
{
|
|
1775
|
+
"data-oc-signin-oauth-error": "",
|
|
1776
|
+
style: {
|
|
1777
|
+
marginBottom: 14,
|
|
1778
|
+
padding: "0.6rem 0.75rem",
|
|
1779
|
+
border: "1px solid var(--destructive, #ef4444)",
|
|
1780
|
+
borderRadius: 6,
|
|
1781
|
+
color: "var(--destructive, #ef4444)",
|
|
1782
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1783
|
+
fontSize: 11
|
|
1784
|
+
},
|
|
1785
|
+
children: "That sign-in didn't complete. Please try again."
|
|
1786
|
+
}
|
|
1787
|
+
),
|
|
1765
1788
|
bothEnabled && /* @__PURE__ */ jsxs(
|
|
1766
1789
|
"div",
|
|
1767
1790
|
{
|
|
@@ -1804,6 +1827,7 @@ function OcSignIn({
|
|
|
1804
1827
|
}
|
|
1805
1828
|
)
|
|
1806
1829
|
] }),
|
|
1830
|
+
/* @__PURE__ */ jsx(ProviderSignIn, { authOrigin, returnTo: safeReturn }),
|
|
1807
1831
|
linkPrompt && /* @__PURE__ */ jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
1808
1832
|
/* @__PURE__ */ jsx(
|
|
1809
1833
|
"input",
|
|
@@ -1854,6 +1878,63 @@ function SigninTab({
|
|
|
1854
1878
|
}
|
|
1855
1879
|
);
|
|
1856
1880
|
}
|
|
1881
|
+
var OAUTH_PROVIDERS = [
|
|
1882
|
+
{ id: "google", label: "Continue with Google" }
|
|
1883
|
+
];
|
|
1884
|
+
function ProviderSignIn({
|
|
1885
|
+
authOrigin,
|
|
1886
|
+
returnTo
|
|
1887
|
+
}) {
|
|
1888
|
+
const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
|
|
1889
|
+
return /* @__PURE__ */ jsxs("div", { "data-oc-signin-providers": "", style: { marginTop: 20 }, children: [
|
|
1890
|
+
/* @__PURE__ */ jsxs(
|
|
1891
|
+
"div",
|
|
1892
|
+
{
|
|
1893
|
+
style: {
|
|
1894
|
+
display: "flex",
|
|
1895
|
+
alignItems: "center",
|
|
1896
|
+
gap: 10,
|
|
1897
|
+
margin: "4px 0 12px",
|
|
1898
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
1899
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1900
|
+
fontSize: 10,
|
|
1901
|
+
letterSpacing: "0.16em",
|
|
1902
|
+
textTransform: "uppercase"
|
|
1903
|
+
},
|
|
1904
|
+
children: [
|
|
1905
|
+
/* @__PURE__ */ jsx("span", { style: line }),
|
|
1906
|
+
"or",
|
|
1907
|
+
/* @__PURE__ */ jsx("span", { style: line })
|
|
1908
|
+
]
|
|
1909
|
+
}
|
|
1910
|
+
),
|
|
1911
|
+
OAUTH_PROVIDERS.map((p) => /* @__PURE__ */ jsx(
|
|
1912
|
+
"a",
|
|
1913
|
+
{
|
|
1914
|
+
href: `${authOrigin}/api/auth/${p.id}/start?return_to=${encodeURIComponent(
|
|
1915
|
+
returnTo
|
|
1916
|
+
)}`,
|
|
1917
|
+
"data-oc-signin-provider": p.id,
|
|
1918
|
+
style: {
|
|
1919
|
+
display: "block",
|
|
1920
|
+
boxSizing: "border-box",
|
|
1921
|
+
width: "100%",
|
|
1922
|
+
padding: "0.6rem 0.875rem",
|
|
1923
|
+
textAlign: "center",
|
|
1924
|
+
border: "1px solid var(--border, #27272a)",
|
|
1925
|
+
borderRadius: 6,
|
|
1926
|
+
background: "transparent",
|
|
1927
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
1928
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1929
|
+
fontSize: 12,
|
|
1930
|
+
textDecoration: "none"
|
|
1931
|
+
},
|
|
1932
|
+
children: p.label
|
|
1933
|
+
},
|
|
1934
|
+
p.id
|
|
1935
|
+
))
|
|
1936
|
+
] });
|
|
1937
|
+
}
|
|
1857
1938
|
function WalletFlow({ authOrigin, audience, onSuccess }) {
|
|
1858
1939
|
const [address, setAddress] = React3.useState("");
|
|
1859
1940
|
const [error, setError] = React3.useState(null);
|