@orangecheck/auth-client 2.9.0 → 2.10.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 +54 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1092,40 +1092,24 @@ function LinkPromptStep({
|
|
|
1092
1092
|
authOrigin,
|
|
1093
1093
|
onResolved
|
|
1094
1094
|
}) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1095
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-oc-linkprompt": method, children: [
|
|
1096
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...panelStyle("success"), marginBottom: 16 }, children: [
|
|
1097
|
+
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { tone: "success", children: "\xA7 signed in" }),
|
|
1098
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { ...bodyStyle, margin: 0 }, children: [
|
|
1099
|
+
"You asked to also link ",
|
|
1100
|
+
method === "btc" ? "a Bitcoin address" : "an email",
|
|
1101
|
+
" \u2014 here it is. Finish below, or cancel to head straight on."
|
|
1102
|
+
] })
|
|
1103
|
+
] }),
|
|
1104
|
+
method === "btc" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1098
1105
|
BtcLinkForm,
|
|
1099
1106
|
{
|
|
1100
1107
|
authOrigin,
|
|
1101
1108
|
didOc,
|
|
1102
1109
|
onDone: onResolved,
|
|
1103
|
-
onCancel:
|
|
1104
|
-
}
|
|
1105
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1106
|
-
EmailLinkForm,
|
|
1107
|
-
{
|
|
1108
|
-
authOrigin,
|
|
1109
|
-
onDone: onResolved,
|
|
1110
|
-
onCancel: () => setStage("offer")
|
|
1110
|
+
onCancel: onResolved
|
|
1111
1111
|
}
|
|
1112
|
-
)
|
|
1113
|
-
}
|
|
1114
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: panelStyle("accent"), "data-oc-linkprompt": method, children: [
|
|
1115
|
-
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { tone: "success", children: "\xA7 signed in" }),
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: bodyStyle, children: method === "btc" ? "You're in. Link a Bitcoin address now \u2014 a second way to sign in, and it unlocks your on-chain footprint. You prove it with one wallet signature, right here \u2014 no separate trip to your account page." : "You're in. Add your email now \u2014 a backup way to sign in if you ever lose your wallet. You prove it with a one-time code, right here \u2014 no separate trip to your account page." }),
|
|
1117
|
-
/* @__PURE__ */ jsxRuntime.jsxs(FormButtons, { children: [
|
|
1118
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
-
"button",
|
|
1120
|
-
{
|
|
1121
|
-
type: "button",
|
|
1122
|
-
onClick: () => setStage("linking"),
|
|
1123
|
-
style: primaryBtnStyle(false),
|
|
1124
|
-
children: method === "btc" ? "link a Bitcoin address" : "link an email"
|
|
1125
|
-
}
|
|
1126
|
-
),
|
|
1127
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onResolved, style: ghostBtnStyle(false), children: "skip" })
|
|
1128
|
-
] })
|
|
1112
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(EmailLinkForm, { authOrigin, onDone: onResolved, onCancel: onResolved })
|
|
1129
1113
|
] });
|
|
1130
1114
|
}
|
|
1131
1115
|
function EmailLinkForm({
|
|
@@ -1647,6 +1631,7 @@ function OcSignIn({
|
|
|
1647
1631
|
const safeReturn = safeReturnTo(returnTo);
|
|
1648
1632
|
const [path, setPath] = React3__namespace.useState(initialPath);
|
|
1649
1633
|
const [signedIn, setSignedIn] = React3__namespace.useState(null);
|
|
1634
|
+
const [linkAlso, setLinkAlso] = React3__namespace.useState(false);
|
|
1650
1635
|
const navigate = React3__namespace.useCallback(
|
|
1651
1636
|
async (account) => {
|
|
1652
1637
|
if (resolveReturnTo) {
|
|
@@ -1666,7 +1651,7 @@ function OcSignIn({
|
|
|
1666
1651
|
if (onSuccess) onSuccess(account, token);
|
|
1667
1652
|
else void navigate(account);
|
|
1668
1653
|
};
|
|
1669
|
-
if (!linkPrompt) {
|
|
1654
|
+
if (!linkPrompt || !linkAlso) {
|
|
1670
1655
|
proceed();
|
|
1671
1656
|
return;
|
|
1672
1657
|
}
|
|
@@ -1676,19 +1661,20 @@ function OcSignIn({
|
|
|
1676
1661
|
headers: { Accept: "application/json" }
|
|
1677
1662
|
});
|
|
1678
1663
|
const me = meRes.ok ? await meRes.json() : null;
|
|
1679
|
-
const
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1664
|
+
const didOc = me?.account?.did_oc;
|
|
1665
|
+
if (didOc) {
|
|
1666
|
+
setSignedIn({
|
|
1667
|
+
method: via === "email" ? "btc" : "email",
|
|
1668
|
+
didOc,
|
|
1669
|
+
proceed
|
|
1670
|
+
});
|
|
1685
1671
|
return;
|
|
1686
1672
|
}
|
|
1687
1673
|
} catch {
|
|
1688
1674
|
}
|
|
1689
1675
|
proceed();
|
|
1690
1676
|
},
|
|
1691
|
-
[onSuccess, linkPrompt, navigate, authOrigin]
|
|
1677
|
+
[onSuccess, linkPrompt, linkAlso, navigate, authOrigin]
|
|
1692
1678
|
);
|
|
1693
1679
|
if (!walletEnabled && !emailEnabled) {
|
|
1694
1680
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1729,6 +1715,7 @@ function OcSignIn({
|
|
|
1729
1715
|
const showWallet = walletEnabled && (path === "wallet" || !emailEnabled);
|
|
1730
1716
|
const showEmail = emailEnabled && (path === "email" || !walletEnabled);
|
|
1731
1717
|
const bothEnabled = walletEnabled && emailEnabled;
|
|
1718
|
+
const activeMethod = !emailEnabled ? "wallet" : !walletEnabled ? "email" : path;
|
|
1732
1719
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-oc-signin": "", children: [
|
|
1733
1720
|
bothEnabled && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1734
1721
|
"div",
|
|
@@ -1771,6 +1758,24 @@ function OcSignIn({
|
|
|
1771
1758
|
onSuccess: (a, t) => void handleSuccess(a, t, "email")
|
|
1772
1759
|
}
|
|
1773
1760
|
)
|
|
1761
|
+
] }),
|
|
1762
|
+
linkPrompt && /* @__PURE__ */ jsxRuntime.jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
1763
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1764
|
+
"input",
|
|
1765
|
+
{
|
|
1766
|
+
type: "checkbox",
|
|
1767
|
+
checked: linkAlso,
|
|
1768
|
+
onChange: (e) => setLinkAlso(e.target.checked),
|
|
1769
|
+
style: { marginTop: 2, accentColor: "var(--primary, #f97316)" }
|
|
1770
|
+
}
|
|
1771
|
+
),
|
|
1772
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1773
|
+
"After signing in, also link",
|
|
1774
|
+
" ",
|
|
1775
|
+
activeMethod === "email" ? "a Bitcoin wallet" : "an email",
|
|
1776
|
+
" ",
|
|
1777
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { opacity: 0.65 }, children: "\u2014 optional, one more signature." })
|
|
1778
|
+
] })
|
|
1774
1779
|
] })
|
|
1775
1780
|
] });
|
|
1776
1781
|
}
|
|
@@ -2122,6 +2127,19 @@ var inputStyle2 = {
|
|
|
2122
2127
|
fontSize: 16,
|
|
2123
2128
|
outline: "none"
|
|
2124
2129
|
};
|
|
2130
|
+
var linkAlsoStyle = {
|
|
2131
|
+
display: "flex",
|
|
2132
|
+
alignItems: "flex-start",
|
|
2133
|
+
gap: 8,
|
|
2134
|
+
marginTop: 16,
|
|
2135
|
+
paddingTop: 14,
|
|
2136
|
+
borderTop: "1px solid var(--border, #27272a)",
|
|
2137
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
2138
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2139
|
+
fontSize: 12,
|
|
2140
|
+
lineHeight: 1.5,
|
|
2141
|
+
cursor: "pointer"
|
|
2142
|
+
};
|
|
2125
2143
|
function submitStyle(disabled) {
|
|
2126
2144
|
return {
|
|
2127
2145
|
marginTop: 12,
|