@orangecheck/auth-client 2.9.1 → 2.11.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 +71 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -749,7 +749,6 @@ var OcAddressInput = React3.forwardRef(
|
|
|
749
749
|
}
|
|
750
750
|
);
|
|
751
751
|
var DEFAULT_AUTH_ORIGIN = "https://ochk.io";
|
|
752
|
-
var LINK_PROMPT_DISMISS_KEY = "oc:linkprompt-dismissed";
|
|
753
752
|
function OcLinkedIdentities({
|
|
754
753
|
authOrigin = DEFAULT_AUTH_ORIGIN,
|
|
755
754
|
className,
|
|
@@ -1071,47 +1070,43 @@ function LinkPromptStep({
|
|
|
1071
1070
|
authOrigin,
|
|
1072
1071
|
onResolved
|
|
1073
1072
|
}) {
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1073
|
+
const what = method === "btc" ? "a Bitcoin address" : "an email";
|
|
1074
|
+
return /* @__PURE__ */ jsxs("div", { "data-oc-linkprompt": method, children: [
|
|
1075
|
+
/* @__PURE__ */ jsxs("div", { style: { ...panelStyle("success"), marginBottom: 16 }, children: [
|
|
1076
|
+
/* @__PURE__ */ jsx(SectionLabel, { tone: "success", children: "\xA7 signed in" }),
|
|
1077
|
+
/* @__PURE__ */ jsxs("p", { style: { ...bodyStyle, margin: 0 }, children: [
|
|
1078
|
+
"You chose to also link ",
|
|
1079
|
+
what,
|
|
1080
|
+
". Complete it below \u2014 or skip for now; it is entirely optional and changes nothing about the sign-in you just completed."
|
|
1081
|
+
] })
|
|
1082
|
+
] }),
|
|
1083
|
+
method === "btc" ? /* @__PURE__ */ jsx(
|
|
1084
1084
|
BtcLinkForm,
|
|
1085
1085
|
{
|
|
1086
1086
|
authOrigin,
|
|
1087
1087
|
didOc,
|
|
1088
1088
|
onDone: onResolved,
|
|
1089
|
-
onCancel:
|
|
1089
|
+
onCancel: onResolved
|
|
1090
1090
|
}
|
|
1091
|
-
) : /* @__PURE__ */ jsx(
|
|
1092
|
-
|
|
1091
|
+
) : /* @__PURE__ */ jsx(EmailLinkForm, { authOrigin, onDone: onResolved, onCancel: onResolved }),
|
|
1092
|
+
/* @__PURE__ */ jsxs(
|
|
1093
|
+
"div",
|
|
1093
1094
|
{
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1095
|
+
"data-oc-linkprompt-skip": "",
|
|
1096
|
+
style: { marginTop: 14, paddingTop: 14, borderTop: `1px solid ${V.border}` },
|
|
1097
|
+
children: [
|
|
1098
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onResolved, style: ghostBtnStyle(false), children: "skip \u2014 I'll do this later" }),
|
|
1099
|
+
/* @__PURE__ */ jsxs("p", { style: { ...hintStyle, marginTop: 8 }, children: [
|
|
1100
|
+
"> ",
|
|
1101
|
+
"Changed your mind? Skipping continues you straight on \u2014 your sign-in is unaffected. You can link ",
|
|
1102
|
+
what,
|
|
1103
|
+
" anytime later from your identity page,",
|
|
1104
|
+
" ",
|
|
1105
|
+
"me.ochk.io/me/identity."
|
|
1106
|
+
] })
|
|
1107
|
+
]
|
|
1097
1108
|
}
|
|
1098
|
-
)
|
|
1099
|
-
}
|
|
1100
|
-
return /* @__PURE__ */ jsxs("div", { style: panelStyle("accent"), "data-oc-linkprompt": method, children: [
|
|
1101
|
-
/* @__PURE__ */ jsx(SectionLabel, { tone: "success", children: "\xA7 you're signed in" }),
|
|
1102
|
-
/* @__PURE__ */ jsx("p", { style: bodyStyle, children: method === "btc" ? "Optional \u2014 link a Bitcoin address and it becomes a second way to sign in, and unlocks your on-chain footprint. One wallet signature, right here. No pressure: you can always do this later from your account page." : "Optional \u2014 add your email as a backup way to sign in if you ever lose your wallet. One six-digit code, right here. No pressure: you can always do this later from your account page." }),
|
|
1103
|
-
/* @__PURE__ */ jsxs(FormButtons, { children: [
|
|
1104
|
-
/* @__PURE__ */ jsx(
|
|
1105
|
-
"button",
|
|
1106
|
-
{
|
|
1107
|
-
type: "button",
|
|
1108
|
-
onClick: () => setStage("linking"),
|
|
1109
|
-
style: primaryBtnStyle(false),
|
|
1110
|
-
children: method === "btc" ? "link a Bitcoin address" : "link an email"
|
|
1111
|
-
}
|
|
1112
|
-
),
|
|
1113
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: decline, style: ghostBtnStyle(false), children: "not now" })
|
|
1114
|
-
] })
|
|
1109
|
+
)
|
|
1115
1110
|
] });
|
|
1116
1111
|
}
|
|
1117
1112
|
function EmailLinkForm({
|
|
@@ -1633,6 +1628,7 @@ function OcSignIn({
|
|
|
1633
1628
|
const safeReturn = safeReturnTo(returnTo);
|
|
1634
1629
|
const [path, setPath] = React3.useState(initialPath);
|
|
1635
1630
|
const [signedIn, setSignedIn] = React3.useState(null);
|
|
1631
|
+
const [linkAlso, setLinkAlso] = React3.useState(false);
|
|
1636
1632
|
const navigate = React3.useCallback(
|
|
1637
1633
|
async (account) => {
|
|
1638
1634
|
if (resolveReturnTo) {
|
|
@@ -1652,12 +1648,7 @@ function OcSignIn({
|
|
|
1652
1648
|
if (onSuccess) onSuccess(account, token);
|
|
1653
1649
|
else void navigate(account);
|
|
1654
1650
|
};
|
|
1655
|
-
|
|
1656
|
-
try {
|
|
1657
|
-
declined = Boolean(window.localStorage.getItem(LINK_PROMPT_DISMISS_KEY));
|
|
1658
|
-
} catch {
|
|
1659
|
-
}
|
|
1660
|
-
if (!linkPrompt || declined) {
|
|
1651
|
+
if (!linkPrompt || !linkAlso) {
|
|
1661
1652
|
proceed();
|
|
1662
1653
|
return;
|
|
1663
1654
|
}
|
|
@@ -1667,19 +1658,20 @@ function OcSignIn({
|
|
|
1667
1658
|
headers: { Accept: "application/json" }
|
|
1668
1659
|
});
|
|
1669
1660
|
const me = meRes.ok ? await meRes.json() : null;
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1661
|
+
const didOc = me?.account?.did_oc;
|
|
1662
|
+
if (didOc) {
|
|
1663
|
+
setSignedIn({
|
|
1664
|
+
method: via === "email" ? "btc" : "email",
|
|
1665
|
+
didOc,
|
|
1666
|
+
proceed
|
|
1667
|
+
});
|
|
1676
1668
|
return;
|
|
1677
1669
|
}
|
|
1678
1670
|
} catch {
|
|
1679
1671
|
}
|
|
1680
1672
|
proceed();
|
|
1681
1673
|
},
|
|
1682
|
-
[onSuccess, linkPrompt, navigate, authOrigin]
|
|
1674
|
+
[onSuccess, linkPrompt, linkAlso, navigate, authOrigin]
|
|
1683
1675
|
);
|
|
1684
1676
|
if (!walletEnabled && !emailEnabled) {
|
|
1685
1677
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1720,6 +1712,7 @@ function OcSignIn({
|
|
|
1720
1712
|
const showWallet = walletEnabled && (path === "wallet" || !emailEnabled);
|
|
1721
1713
|
const showEmail = emailEnabled && (path === "email" || !walletEnabled);
|
|
1722
1714
|
const bothEnabled = walletEnabled && emailEnabled;
|
|
1715
|
+
const activeMethod = !emailEnabled ? "wallet" : !walletEnabled ? "email" : path;
|
|
1723
1716
|
return /* @__PURE__ */ jsxs("div", { className, "data-oc-signin": "", children: [
|
|
1724
1717
|
bothEnabled && /* @__PURE__ */ jsxs(
|
|
1725
1718
|
"div",
|
|
@@ -1762,6 +1755,24 @@ function OcSignIn({
|
|
|
1762
1755
|
onSuccess: (a, t) => void handleSuccess(a, t, "email")
|
|
1763
1756
|
}
|
|
1764
1757
|
)
|
|
1758
|
+
] }),
|
|
1759
|
+
linkPrompt && /* @__PURE__ */ jsxs("label", { "data-oc-signin-linkalso": "", style: linkAlsoStyle, children: [
|
|
1760
|
+
/* @__PURE__ */ jsx(
|
|
1761
|
+
"input",
|
|
1762
|
+
{
|
|
1763
|
+
type: "checkbox",
|
|
1764
|
+
checked: linkAlso,
|
|
1765
|
+
onChange: (e) => setLinkAlso(e.target.checked),
|
|
1766
|
+
style: { marginTop: 2, accentColor: "var(--primary, #f97316)" }
|
|
1767
|
+
}
|
|
1768
|
+
),
|
|
1769
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1770
|
+
"After signing in, also link",
|
|
1771
|
+
" ",
|
|
1772
|
+
activeMethod === "email" ? "a Bitcoin wallet" : "an email",
|
|
1773
|
+
" ",
|
|
1774
|
+
/* @__PURE__ */ jsx("span", { style: { opacity: 0.65 }, children: "\u2014 optional, one more signature." })
|
|
1775
|
+
] })
|
|
1765
1776
|
] })
|
|
1766
1777
|
] });
|
|
1767
1778
|
}
|
|
@@ -2113,6 +2124,19 @@ var inputStyle2 = {
|
|
|
2113
2124
|
fontSize: 16,
|
|
2114
2125
|
outline: "none"
|
|
2115
2126
|
};
|
|
2127
|
+
var linkAlsoStyle = {
|
|
2128
|
+
display: "flex",
|
|
2129
|
+
alignItems: "flex-start",
|
|
2130
|
+
gap: 8,
|
|
2131
|
+
marginTop: 16,
|
|
2132
|
+
paddingTop: 14,
|
|
2133
|
+
borderTop: "1px solid var(--border, #27272a)",
|
|
2134
|
+
color: "var(--muted-foreground, #a1a1aa)",
|
|
2135
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
2136
|
+
fontSize: 12,
|
|
2137
|
+
lineHeight: 1.5,
|
|
2138
|
+
cursor: "pointer"
|
|
2139
|
+
};
|
|
2116
2140
|
function submitStyle(disabled) {
|
|
2117
2141
|
return {
|
|
2118
2142
|
marginTop: 12,
|