@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.mjs
CHANGED
|
@@ -1070,40 +1070,24 @@ function LinkPromptStep({
|
|
|
1070
1070
|
authOrigin,
|
|
1071
1071
|
onResolved
|
|
1072
1072
|
}) {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1073
|
+
return /* @__PURE__ */ jsxs("div", { "data-oc-linkprompt": method, children: [
|
|
1074
|
+
/* @__PURE__ */ jsxs("div", { style: { ...panelStyle("success"), marginBottom: 16 }, children: [
|
|
1075
|
+
/* @__PURE__ */ jsx(SectionLabel, { tone: "success", children: "\xA7 signed in" }),
|
|
1076
|
+
/* @__PURE__ */ jsxs("p", { style: { ...bodyStyle, margin: 0 }, children: [
|
|
1077
|
+
"You asked to also link ",
|
|
1078
|
+
method === "btc" ? "a Bitcoin address" : "an email",
|
|
1079
|
+
" \u2014 here it is. Finish below, or cancel to head straight on."
|
|
1080
|
+
] })
|
|
1081
|
+
] }),
|
|
1082
|
+
method === "btc" ? /* @__PURE__ */ jsx(
|
|
1076
1083
|
BtcLinkForm,
|
|
1077
1084
|
{
|
|
1078
1085
|
authOrigin,
|
|
1079
1086
|
didOc,
|
|
1080
1087
|
onDone: onResolved,
|
|
1081
|
-
onCancel:
|
|
1082
|
-
}
|
|
1083
|
-
) : /* @__PURE__ */ jsx(
|
|
1084
|
-
EmailLinkForm,
|
|
1085
|
-
{
|
|
1086
|
-
authOrigin,
|
|
1087
|
-
onDone: onResolved,
|
|
1088
|
-
onCancel: () => setStage("offer")
|
|
1088
|
+
onCancel: onResolved
|
|
1089
1089
|
}
|
|
1090
|
-
)
|
|
1091
|
-
}
|
|
1092
|
-
return /* @__PURE__ */ jsxs("div", { style: panelStyle("accent"), "data-oc-linkprompt": method, children: [
|
|
1093
|
-
/* @__PURE__ */ jsx(SectionLabel, { tone: "success", children: "\xA7 signed in" }),
|
|
1094
|
-
/* @__PURE__ */ 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." }),
|
|
1095
|
-
/* @__PURE__ */ jsxs(FormButtons, { children: [
|
|
1096
|
-
/* @__PURE__ */ jsx(
|
|
1097
|
-
"button",
|
|
1098
|
-
{
|
|
1099
|
-
type: "button",
|
|
1100
|
-
onClick: () => setStage("linking"),
|
|
1101
|
-
style: primaryBtnStyle(false),
|
|
1102
|
-
children: method === "btc" ? "link a Bitcoin address" : "link an email"
|
|
1103
|
-
}
|
|
1104
|
-
),
|
|
1105
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: onResolved, style: ghostBtnStyle(false), children: "skip" })
|
|
1106
|
-
] })
|
|
1090
|
+
) : /* @__PURE__ */ jsx(EmailLinkForm, { authOrigin, onDone: onResolved, onCancel: onResolved })
|
|
1107
1091
|
] });
|
|
1108
1092
|
}
|
|
1109
1093
|
function EmailLinkForm({
|
|
@@ -1625,6 +1609,7 @@ function OcSignIn({
|
|
|
1625
1609
|
const safeReturn = safeReturnTo(returnTo);
|
|
1626
1610
|
const [path, setPath] = React3.useState(initialPath);
|
|
1627
1611
|
const [signedIn, setSignedIn] = React3.useState(null);
|
|
1612
|
+
const [linkAlso, setLinkAlso] = React3.useState(false);
|
|
1628
1613
|
const navigate = React3.useCallback(
|
|
1629
1614
|
async (account) => {
|
|
1630
1615
|
if (resolveReturnTo) {
|
|
@@ -1644,7 +1629,7 @@ function OcSignIn({
|
|
|
1644
1629
|
if (onSuccess) onSuccess(account, token);
|
|
1645
1630
|
else void navigate(account);
|
|
1646
1631
|
};
|
|
1647
|
-
if (!linkPrompt) {
|
|
1632
|
+
if (!linkPrompt || !linkAlso) {
|
|
1648
1633
|
proceed();
|
|
1649
1634
|
return;
|
|
1650
1635
|
}
|
|
@@ -1654,19 +1639,20 @@ function OcSignIn({
|
|
|
1654
1639
|
headers: { Accept: "application/json" }
|
|
1655
1640
|
});
|
|
1656
1641
|
const me = meRes.ok ? await meRes.json() : null;
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1642
|
+
const didOc = me?.account?.did_oc;
|
|
1643
|
+
if (didOc) {
|
|
1644
|
+
setSignedIn({
|
|
1645
|
+
method: via === "email" ? "btc" : "email",
|
|
1646
|
+
didOc,
|
|
1647
|
+
proceed
|
|
1648
|
+
});
|
|
1663
1649
|
return;
|
|
1664
1650
|
}
|
|
1665
1651
|
} catch {
|
|
1666
1652
|
}
|
|
1667
1653
|
proceed();
|
|
1668
1654
|
},
|
|
1669
|
-
[onSuccess, linkPrompt, navigate, authOrigin]
|
|
1655
|
+
[onSuccess, linkPrompt, linkAlso, navigate, authOrigin]
|
|
1670
1656
|
);
|
|
1671
1657
|
if (!walletEnabled && !emailEnabled) {
|
|
1672
1658
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1707,6 +1693,7 @@ function OcSignIn({
|
|
|
1707
1693
|
const showWallet = walletEnabled && (path === "wallet" || !emailEnabled);
|
|
1708
1694
|
const showEmail = emailEnabled && (path === "email" || !walletEnabled);
|
|
1709
1695
|
const bothEnabled = walletEnabled && emailEnabled;
|
|
1696
|
+
const activeMethod = !emailEnabled ? "wallet" : !walletEnabled ? "email" : path;
|
|
1710
1697
|
return /* @__PURE__ */ jsxs("div", { className, "data-oc-signin": "", children: [
|
|
1711
1698
|
bothEnabled && /* @__PURE__ */ jsxs(
|
|
1712
1699
|
"div",
|
|
@@ -1749,6 +1736,24 @@ function OcSignIn({
|
|
|
1749
1736
|
onSuccess: (a, t) => void handleSuccess(a, t, "email")
|
|
1750
1737
|
}
|
|
1751
1738
|
)
|
|
1739
|
+
] }),
|
|
1740
|
+
linkPrompt && /* @__PURE__ */ jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
1741
|
+
/* @__PURE__ */ jsx(
|
|
1742
|
+
"input",
|
|
1743
|
+
{
|
|
1744
|
+
type: "checkbox",
|
|
1745
|
+
checked: linkAlso,
|
|
1746
|
+
onChange: (e) => setLinkAlso(e.target.checked),
|
|
1747
|
+
style: { marginTop: 2, accentColor: "var(--primary, #f97316)" }
|
|
1748
|
+
}
|
|
1749
|
+
),
|
|
1750
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1751
|
+
"After signing in, also link",
|
|
1752
|
+
" ",
|
|
1753
|
+
activeMethod === "email" ? "a Bitcoin wallet" : "an email",
|
|
1754
|
+
" ",
|
|
1755
|
+
/* @__PURE__ */ jsx("span", { style: { opacity: 0.65 }, children: "\u2014 optional, one more signature." })
|
|
1756
|
+
] })
|
|
1752
1757
|
] })
|
|
1753
1758
|
] });
|
|
1754
1759
|
}
|
|
@@ -2100,6 +2105,19 @@ var inputStyle2 = {
|
|
|
2100
2105
|
fontSize: 16,
|
|
2101
2106
|
outline: "none"
|
|
2102
2107
|
};
|
|
2108
|
+
var linkAlsoStyle = {
|
|
2109
|
+
display: "flex",
|
|
2110
|
+
alignItems: "flex-start",
|
|
2111
|
+
gap: 8,
|
|
2112
|
+
marginTop: 16,
|
|
2113
|
+
paddingTop: 14,
|
|
2114
|
+
borderTop: "1px solid var(--border, #27272a)",
|
|
2115
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
2116
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2117
|
+
fontSize: 12,
|
|
2118
|
+
lineHeight: 1.5,
|
|
2119
|
+
cursor: "pointer"
|
|
2120
|
+
};
|
|
2103
2121
|
function submitStyle(disabled) {
|
|
2104
2122
|
return {
|
|
2105
2123
|
marginTop: 12,
|