@forge-connect/react 1.0.16 → 1.0.17
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.cjs +150 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -982,6 +982,52 @@ async function connectAndPrepareStandardWallet(wallet) {
|
|
|
982
982
|
return { address: account.address, signMessage };
|
|
983
983
|
}
|
|
984
984
|
|
|
985
|
+
// src/lib/seeker-bridge.ts
|
|
986
|
+
function isSeekerApp() {
|
|
987
|
+
return typeof window !== "undefined" && _optionalChain([window, 'access', _15 => _15.nomuSeeker, 'optionalAccess', _16 => _16.isSeeker]) === true;
|
|
988
|
+
}
|
|
989
|
+
function uint8ToBase64(bytes) {
|
|
990
|
+
let bin = "";
|
|
991
|
+
for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]);
|
|
992
|
+
return btoa(bin);
|
|
993
|
+
}
|
|
994
|
+
function base58ToUint8(s) {
|
|
995
|
+
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
996
|
+
const map = /* @__PURE__ */ new Map();
|
|
997
|
+
for (let i = 0; i < ALPHABET.length; i++) map.set(ALPHABET[i], i);
|
|
998
|
+
const bytes = [0];
|
|
999
|
+
for (const ch of s) {
|
|
1000
|
+
const v = map.get(ch);
|
|
1001
|
+
if (v === void 0) throw new Error("Invalid base58 character");
|
|
1002
|
+
let carry = v;
|
|
1003
|
+
for (let j = 0; j < bytes.length; j++) {
|
|
1004
|
+
carry += bytes[j] * 58;
|
|
1005
|
+
bytes[j] = carry & 255;
|
|
1006
|
+
carry >>= 8;
|
|
1007
|
+
}
|
|
1008
|
+
while (carry > 0) {
|
|
1009
|
+
bytes.push(carry & 255);
|
|
1010
|
+
carry >>= 8;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
for (const ch of s) {
|
|
1014
|
+
if (ch !== "1") break;
|
|
1015
|
+
bytes.push(0);
|
|
1016
|
+
}
|
|
1017
|
+
return new Uint8Array(bytes.reverse());
|
|
1018
|
+
}
|
|
1019
|
+
async function connectSeekerBridge() {
|
|
1020
|
+
const bridge = window.nomuSeeker;
|
|
1021
|
+
if (!bridge) throw new Error("NomuSeeker bridge not available");
|
|
1022
|
+
const { publicKey } = await bridge.connect();
|
|
1023
|
+
const signMessage = async (msg) => {
|
|
1024
|
+
const { signature } = await bridge.signMessage(uint8ToBase64(msg));
|
|
1025
|
+
return base58ToUint8(signature);
|
|
1026
|
+
};
|
|
1027
|
+
return { address: publicKey, signMessage };
|
|
1028
|
+
}
|
|
1029
|
+
var SEEKER_ICON = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+PHJlY3Qgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4IiByeD0iMTAiIGZpbGw9IiMwMDAiLz48dGV4dCB4PSI1MCUiIHk9IjU4JSIgZm9udC1zaXplPSIyMCIgZmlsbD0iI2ZmZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InNhbnMtc2VyaWYiIGZvbnQtd2VpZ2h0PSI3MDAiPlM8L3RleHQ+PC9zdmc+";
|
|
1030
|
+
|
|
985
1031
|
// src/components/tabs/wallet-connect.tsx
|
|
986
1032
|
|
|
987
1033
|
function MatricaWalletEntry() {
|
|
@@ -1022,6 +1068,22 @@ function isMobile() {
|
|
|
1022
1068
|
if (typeof navigator === "undefined") return false;
|
|
1023
1069
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
1024
1070
|
}
|
|
1071
|
+
function SeekerWalletEntry({ onError }) {
|
|
1072
|
+
const { loginWithWallet } = useForgeConnect();
|
|
1073
|
+
const handleClick = async () => {
|
|
1074
|
+
try {
|
|
1075
|
+
const { address, signMessage } = await connectSeekerBridge();
|
|
1076
|
+
await loginWithWallet(address, signMessage, "solana");
|
|
1077
|
+
} catch (e) {
|
|
1078
|
+
onError(e instanceof Error ? e.message : "Seeker Wallet connection failed.");
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-wallet", onClick: handleClick, children: [
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { position: "relative", display: "inline-flex" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: SEEKER_ICON, alt: "", className: "fc-wallet-icon" }) }),
|
|
1083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-wallet-name", children: "Seeker Wallet" }),
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-badge-preferred", children: "Detected" })
|
|
1085
|
+
] });
|
|
1086
|
+
}
|
|
1025
1087
|
function WalletConnectForm() {
|
|
1026
1088
|
const { walletAdapter, setModalStep, config } = useForgeConnect();
|
|
1027
1089
|
const methods = resolveLoginMethods(config);
|
|
@@ -1053,8 +1115,8 @@ function MobileWalletFlow() {
|
|
|
1053
1115
|
const methods = resolveLoginMethods(config);
|
|
1054
1116
|
const showBack = methods.length > 1;
|
|
1055
1117
|
const walletConfig = config.walletConfig;
|
|
1056
|
-
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
1057
|
-
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
1118
|
+
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _17 => _17.preferredWallets]), () => ( []));
|
|
1119
|
+
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _18 => _18.onlyPreferred]), () => ( false));
|
|
1058
1120
|
const handleStandardConnect = async (w) => {
|
|
1059
1121
|
setError("");
|
|
1060
1122
|
setLoading(true);
|
|
@@ -1103,6 +1165,10 @@ function MobileWalletFlow() {
|
|
|
1103
1165
|
] })
|
|
1104
1166
|
] }),
|
|
1105
1167
|
!loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-wallet-list", children: [
|
|
1168
|
+
isSeekerApp() && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SeekerWalletEntry, { onError: (m) => {
|
|
1169
|
+
setError(m);
|
|
1170
|
+
setLoading(false);
|
|
1171
|
+
} }),
|
|
1106
1172
|
showMatrica && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MatricaWalletEntry, {}),
|
|
1107
1173
|
standardWallets.map((w) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1108
1174
|
"button",
|
|
@@ -1156,7 +1222,7 @@ function WalletAdapterFlow() {
|
|
|
1156
1222
|
coldWalletRef.current = coldWallet;
|
|
1157
1223
|
const buildSignTxFnForAdapter = _react.useCallback.call(void 0, (adapter) => {
|
|
1158
1224
|
if (!adapter.signTransaction) return void 0;
|
|
1159
|
-
const TxClass = _optionalChain([walletConfig, 'optionalAccess',
|
|
1225
|
+
const TxClass = _optionalChain([walletConfig, 'optionalAccess', _19 => _19.Transaction]);
|
|
1160
1226
|
if (!TxClass) return void 0;
|
|
1161
1227
|
return async (txBase64) => {
|
|
1162
1228
|
const bytes = Uint8Array.from(atob(txBase64), (c) => c.charCodeAt(0));
|
|
@@ -1164,7 +1230,7 @@ function WalletAdapterFlow() {
|
|
|
1164
1230
|
const signedTx = await adapter.signTransaction(tx);
|
|
1165
1231
|
return btoa(String.fromCharCode(...new Uint8Array(signedTx.serialize())));
|
|
1166
1232
|
};
|
|
1167
|
-
}, [_optionalChain([walletConfig, 'optionalAccess',
|
|
1233
|
+
}, [_optionalChain([walletConfig, 'optionalAccess', _20 => _20.Transaction])]);
|
|
1168
1234
|
const handleConnect = async (w) => {
|
|
1169
1235
|
if (w.readyState !== "Installed") {
|
|
1170
1236
|
if (mobile) {
|
|
@@ -1204,10 +1270,10 @@ function WalletAdapterFlow() {
|
|
|
1204
1270
|
const handleMobileOpen = (mw) => {
|
|
1205
1271
|
window.location.href = mw.buildUrl(window.location.href);
|
|
1206
1272
|
};
|
|
1207
|
-
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
1208
|
-
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
1273
|
+
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _21 => _21.preferredWallets]), () => ( []));
|
|
1274
|
+
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _22 => _22.onlyPreferred]), () => ( false));
|
|
1209
1275
|
const preferredSet = new Set(preferred);
|
|
1210
|
-
const connectedWalletName = wallet.publicKey ? _nullishCoalesce(_optionalChain([wallet, 'access',
|
|
1276
|
+
const connectedWalletName = wallet.publicKey ? _nullishCoalesce(_optionalChain([wallet, 'access', _23 => _23.wallets, 'access', _24 => _24.find, 'call', _25 => _25((w) => w.adapter.connected), 'optionalAccess', _26 => _26.adapter, 'access', _27 => _27.name]), () => ( null)) : null;
|
|
1211
1277
|
const { preferredWallets, otherWallets } = _react.useMemo.call(void 0, () => {
|
|
1212
1278
|
const seenNames = /* @__PURE__ */ new Set();
|
|
1213
1279
|
const all = wallet.wallets.filter((w) => {
|
|
@@ -1267,6 +1333,10 @@ function WalletAdapterFlow() {
|
|
|
1267
1333
|
] })
|
|
1268
1334
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1269
1335
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-wallet-list", children: [
|
|
1336
|
+
isSeekerApp() && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SeekerWalletEntry, { onError: (m) => {
|
|
1337
|
+
setError(m);
|
|
1338
|
+
setLoading(false);
|
|
1339
|
+
} }),
|
|
1270
1340
|
methods.includes("matrica") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MatricaWalletEntry, {}),
|
|
1271
1341
|
preferredWallets.map((w) => {
|
|
1272
1342
|
const installed = w.readyState === "Installed";
|
|
@@ -1499,7 +1569,7 @@ function Verify2FAForm() {
|
|
|
1499
1569
|
const inputRef = _react.useRef.call(void 0, null);
|
|
1500
1570
|
const submittingRef = _react.useRef.call(void 0, false);
|
|
1501
1571
|
_react.useEffect.call(void 0, () => {
|
|
1502
|
-
_optionalChain([inputRef, 'access',
|
|
1572
|
+
_optionalChain([inputRef, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.focus, 'call', _30 => _30()]);
|
|
1503
1573
|
}, [useRecovery]);
|
|
1504
1574
|
const submitCode = _react.useCallback.call(void 0, async (codeValue, isRecovery) => {
|
|
1505
1575
|
if (submittingRef.current || !codeValue.trim()) return;
|
|
@@ -1520,7 +1590,7 @@ function Verify2FAForm() {
|
|
|
1520
1590
|
}
|
|
1521
1591
|
}, [verify2FA, verifyRecoveryCode]);
|
|
1522
1592
|
const handleSubmit = async (e) => {
|
|
1523
|
-
_optionalChain([e, 'optionalAccess',
|
|
1593
|
+
_optionalChain([e, 'optionalAccess', _31 => _31.preventDefault, 'call', _32 => _32()]);
|
|
1524
1594
|
await submitCode(code, useRecovery);
|
|
1525
1595
|
};
|
|
1526
1596
|
const handleCodeChange = (value) => {
|
|
@@ -1601,10 +1671,10 @@ function LoginModal() {
|
|
|
1601
1671
|
}
|
|
1602
1672
|
};
|
|
1603
1673
|
const renderLogo = () => {
|
|
1604
|
-
if (_optionalChain([config, 'access',
|
|
1674
|
+
if (_optionalChain([config, 'access', _33 => _33.appearance, 'optionalAccess', _34 => _34.logoNode])) {
|
|
1605
1675
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-logo", children: config.appearance.logoNode });
|
|
1606
1676
|
}
|
|
1607
|
-
if (_optionalChain([config, 'access',
|
|
1677
|
+
if (_optionalChain([config, 'access', _35 => _35.appearance, 'optionalAccess', _36 => _36.logo])) {
|
|
1608
1678
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: config.appearance.logo, alt: "", className: "fc-logo" });
|
|
1609
1679
|
}
|
|
1610
1680
|
return null;
|
|
@@ -1614,14 +1684,14 @@ function LoginModal() {
|
|
|
1614
1684
|
{
|
|
1615
1685
|
className: "fc-modal-content",
|
|
1616
1686
|
style: {
|
|
1617
|
-
"--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
1687
|
+
"--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _37 => _37.appearance, 'optionalAccess', _38 => _38.accentColor]), () => ( "#8b5cf6"))
|
|
1618
1688
|
},
|
|
1619
|
-
"data-theme": _nullishCoalesce(_optionalChain([config, 'access',
|
|
1689
|
+
"data-theme": _nullishCoalesce(_optionalChain([config, 'access', _39 => _39.appearance, 'optionalAccess', _40 => _40.theme]), () => ( "light")),
|
|
1620
1690
|
children: modal.step === "success" || modal.step === "oauth" || modal.step === "matrica-migration" ? renderStep() : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1621
1691
|
renderLogo(),
|
|
1622
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: _nullishCoalesce(_optionalChain([config, 'access',
|
|
1692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: _nullishCoalesce(_optionalChain([config, 'access', _41 => _41.appearance, 'optionalAccess', _42 => _42.title]), () => ( "Log in or sign up")) }),
|
|
1623
1693
|
renderStep(),
|
|
1624
|
-
(_optionalChain([config, 'access',
|
|
1694
|
+
(_optionalChain([config, 'access', _43 => _43.appearance, 'optionalAccess', _44 => _44.termsUrl]) || _optionalChain([config, 'access', _45 => _45.appearance, 'optionalAccess', _46 => _46.privacyUrl])) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "fc-legal", children: [
|
|
1625
1695
|
"By continuing, you agree to our",
|
|
1626
1696
|
" ",
|
|
1627
1697
|
config.appearance.termsUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: config.appearance.termsUrl, target: "_blank", rel: "noopener noreferrer", className: "fc-legal-link", children: "Terms" }),
|
|
@@ -1940,7 +2010,7 @@ function useUser() {
|
|
|
1940
2010
|
_react.useEffect.call(void 0, () => {
|
|
1941
2011
|
const handleMessage = (event) => {
|
|
1942
2012
|
if (event.origin !== window.location.origin) return;
|
|
1943
|
-
if (_optionalChain([event, 'access',
|
|
2013
|
+
if (_optionalChain([event, 'access', _47 => _47.data, 'optionalAccess', _48 => _48.type]) === "fc_oauth_link_success" && pendingRefreshRef.current) {
|
|
1944
2014
|
pendingRefreshRef.current = false;
|
|
1945
2015
|
fetchAuthMethods().catch(() => {
|
|
1946
2016
|
});
|
|
@@ -2112,7 +2182,7 @@ function useSessions() {
|
|
|
2112
2182
|
|
|
2113
2183
|
function TwoFactorModal({ isOpen, onClose, initialEnabled, onStatusChange }) {
|
|
2114
2184
|
const { api, getAccessToken, config } = useForgeConnect();
|
|
2115
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
2185
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _49 => _49.appearance, 'optionalAccess', _50 => _50.theme]), () => ( "light"));
|
|
2116
2186
|
const [step, setStep] = _react.useState.call(void 0, initialEnabled ? "manage" : "setup");
|
|
2117
2187
|
const [setupData, setSetupData] = _react.useState.call(void 0, null);
|
|
2118
2188
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
@@ -2205,7 +2275,7 @@ function TwoFactorModal({ isOpen, onClose, initialEnabled, onStatusChange }) {
|
|
|
2205
2275
|
"div",
|
|
2206
2276
|
{
|
|
2207
2277
|
className: "fc-modal-content",
|
|
2208
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
2278
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _51 => _51.appearance, 'optionalAccess', _52 => _52.accentColor]), () => ( "#8b5cf6")) },
|
|
2209
2279
|
"data-theme": theme,
|
|
2210
2280
|
children: [
|
|
2211
2281
|
step === "setup" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -2413,7 +2483,7 @@ function base64URLStringToBuffer(base64URLString) {
|
|
|
2413
2483
|
|
|
2414
2484
|
// ../../node_modules/.pnpm/@simplewebauthn+browser@13.2.2/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2415
2485
|
function browserSupportsWebAuthn() {
|
|
2416
|
-
return _browserSupportsWebAuthnInternals.stubThis(_optionalChain([globalThis, 'optionalAccess',
|
|
2486
|
+
return _browserSupportsWebAuthnInternals.stubThis(_optionalChain([globalThis, 'optionalAccess', _53 => _53.PublicKeyCredential]) !== void 0 && typeof globalThis.PublicKeyCredential === "function");
|
|
2417
2487
|
}
|
|
2418
2488
|
var _browserSupportsWebAuthnInternals = {
|
|
2419
2489
|
stubThis: (value) => value
|
|
@@ -2472,7 +2542,7 @@ function identifyRegistrationError({ error, options }) {
|
|
|
2472
2542
|
});
|
|
2473
2543
|
}
|
|
2474
2544
|
} else if (error.name === "ConstraintError") {
|
|
2475
|
-
if (_optionalChain([publicKey, 'access',
|
|
2545
|
+
if (_optionalChain([publicKey, 'access', _54 => _54.authenticatorSelection, 'optionalAccess', _55 => _55.requireResidentKey]) === true) {
|
|
2476
2546
|
return new WebAuthnError({
|
|
2477
2547
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
2478
2548
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
@@ -2480,14 +2550,14 @@ function identifyRegistrationError({ error, options }) {
|
|
|
2480
2550
|
});
|
|
2481
2551
|
} else if (
|
|
2482
2552
|
// @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
|
|
2483
|
-
options.mediation === "conditional" && _optionalChain([publicKey, 'access',
|
|
2553
|
+
options.mediation === "conditional" && _optionalChain([publicKey, 'access', _56 => _56.authenticatorSelection, 'optionalAccess', _57 => _57.userVerification]) === "required"
|
|
2484
2554
|
) {
|
|
2485
2555
|
return new WebAuthnError({
|
|
2486
2556
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
2487
2557
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
2488
2558
|
cause: error
|
|
2489
2559
|
});
|
|
2490
|
-
} else if (_optionalChain([publicKey, 'access',
|
|
2560
|
+
} else if (_optionalChain([publicKey, 'access', _58 => _58.authenticatorSelection, 'optionalAccess', _59 => _59.userVerification]) === "required") {
|
|
2491
2561
|
return new WebAuthnError({
|
|
2492
2562
|
message: "User verification was required but no available authenticator supported it",
|
|
2493
2563
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
@@ -2613,7 +2683,7 @@ async function startRegistration(options) {
|
|
|
2613
2683
|
...optionsJSON.user,
|
|
2614
2684
|
id: base64URLStringToBuffer(optionsJSON.user.id)
|
|
2615
2685
|
},
|
|
2616
|
-
excludeCredentials: _optionalChain([optionsJSON, 'access',
|
|
2686
|
+
excludeCredentials: _optionalChain([optionsJSON, 'access', _60 => _60.excludeCredentials, 'optionalAccess', _61 => _61.map, 'call', _62 => _62(toPublicKeyCredentialDescriptor)])
|
|
2617
2687
|
};
|
|
2618
2688
|
const createOptions = {};
|
|
2619
2689
|
if (useAutoRegister) {
|
|
@@ -2689,7 +2759,7 @@ function browserSupportsWebAuthnAutofill() {
|
|
|
2689
2759
|
return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
|
|
2690
2760
|
}
|
|
2691
2761
|
const globalPublicKeyCredential = globalThis.PublicKeyCredential;
|
|
2692
|
-
if (_optionalChain([globalPublicKeyCredential, 'optionalAccess',
|
|
2762
|
+
if (_optionalChain([globalPublicKeyCredential, 'optionalAccess', _63 => _63.isConditionalMediationAvailable]) === void 0) {
|
|
2693
2763
|
return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
|
|
2694
2764
|
}
|
|
2695
2765
|
return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());
|
|
@@ -2754,8 +2824,8 @@ async function startAuthentication(options) {
|
|
|
2754
2824
|
throw new Error("WebAuthn is not supported in this browser");
|
|
2755
2825
|
}
|
|
2756
2826
|
let allowCredentials;
|
|
2757
|
-
if (_optionalChain([optionsJSON, 'access',
|
|
2758
|
-
allowCredentials = _optionalChain([optionsJSON, 'access',
|
|
2827
|
+
if (_optionalChain([optionsJSON, 'access', _64 => _64.allowCredentials, 'optionalAccess', _65 => _65.length]) !== 0) {
|
|
2828
|
+
allowCredentials = _optionalChain([optionsJSON, 'access', _66 => _66.allowCredentials, 'optionalAccess', _67 => _67.map, 'call', _68 => _68(toPublicKeyCredentialDescriptor)]);
|
|
2759
2829
|
}
|
|
2760
2830
|
const publicKey = {
|
|
2761
2831
|
...optionsJSON,
|
|
@@ -2809,7 +2879,7 @@ async function startAuthentication(options) {
|
|
|
2809
2879
|
|
|
2810
2880
|
function PasskeysModal({ isOpen, onClose, onCountChange }) {
|
|
2811
2881
|
const { api, getAccessToken, config } = useForgeConnect();
|
|
2812
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
2882
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _69 => _69.appearance, 'optionalAccess', _70 => _70.theme]), () => ( "light"));
|
|
2813
2883
|
const [passkeys, setPasskeys] = _react.useState.call(void 0, []);
|
|
2814
2884
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
2815
2885
|
const [addLoading, setAddLoading] = _react.useState.call(void 0, false);
|
|
@@ -2869,7 +2939,7 @@ function PasskeysModal({ isOpen, onClose, onCountChange }) {
|
|
|
2869
2939
|
"div",
|
|
2870
2940
|
{
|
|
2871
2941
|
className: "fc-modal-content",
|
|
2872
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
2942
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _71 => _71.appearance, 'optionalAccess', _72 => _72.accentColor]), () => ( "#8b5cf6")) },
|
|
2873
2943
|
"data-theme": theme,
|
|
2874
2944
|
children: [
|
|
2875
2945
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: "Passkeys" }),
|
|
@@ -2943,7 +3013,7 @@ function ErrorView({
|
|
|
2943
3013
|
|
|
2944
3014
|
function PasswordModal({ isOpen, onClose, hasPassword }) {
|
|
2945
3015
|
const { api, getAccessToken, config } = useForgeConnect();
|
|
2946
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
3016
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _73 => _73.appearance, 'optionalAccess', _74 => _74.theme]), () => ( "light"));
|
|
2947
3017
|
const [step, setStep] = _react.useState.call(void 0, "form");
|
|
2948
3018
|
const [currentPassword, setCurrentPassword] = _react.useState.call(void 0, "");
|
|
2949
3019
|
const [newPassword, setNewPassword] = _react.useState.call(void 0, "");
|
|
@@ -2980,7 +3050,7 @@ function PasswordModal({ isOpen, onClose, hasPassword }) {
|
|
|
2980
3050
|
"div",
|
|
2981
3051
|
{
|
|
2982
3052
|
className: "fc-modal-content",
|
|
2983
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
3053
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _75 => _75.appearance, 'optionalAccess', _76 => _76.accentColor]), () => ( "#8b5cf6")) },
|
|
2984
3054
|
"data-theme": theme,
|
|
2985
3055
|
children: step === "done" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-tab", style: { textAlign: "center", padding: "24px 0" }, children: [
|
|
2986
3056
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-success", children: [
|
|
@@ -3049,7 +3119,7 @@ function PasswordModal({ isOpen, onClose, hasPassword }) {
|
|
|
3049
3119
|
|
|
3050
3120
|
function DeleteAccountModal({ isOpen, onClose, onDeleted }) {
|
|
3051
3121
|
const { api, getAccessToken, config, logout } = useForgeConnect();
|
|
3052
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
3122
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _77 => _77.appearance, 'optionalAccess', _78 => _78.theme]), () => ( "light"));
|
|
3053
3123
|
const [step, setStep] = _react.useState.call(void 0, "confirm");
|
|
3054
3124
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
3055
3125
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
@@ -3109,7 +3179,7 @@ function DeleteAccountModal({ isOpen, onClose, onDeleted }) {
|
|
|
3109
3179
|
"div",
|
|
3110
3180
|
{
|
|
3111
3181
|
className: "fc-modal-content",
|
|
3112
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
3182
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _79 => _79.appearance, 'optionalAccess', _80 => _80.accentColor]), () => ( "#8b5cf6")) },
|
|
3113
3183
|
"data-theme": theme,
|
|
3114
3184
|
children: [
|
|
3115
3185
|
step === "confirm" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -3236,20 +3306,20 @@ function AccountModal() {
|
|
|
3236
3306
|
prevLinkOpen.current = linkModal.isOpen;
|
|
3237
3307
|
}, [linkModal.isOpen]);
|
|
3238
3308
|
if (!accountModal.isOpen) return null;
|
|
3239
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
3240
|
-
const initial = (_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3309
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _81 => _81.appearance, 'optionalAccess', _82 => _82.theme]), () => ( "light"));
|
|
3310
|
+
const initial = (_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _83 => _83.displayName]), () => ( _optionalChain([user, 'optionalAccess', _84 => _84.primaryEmail]))), () => ( "?"))).charAt(0).toUpperCase();
|
|
3241
3311
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalOverlay, { isOpen: accountModal.isOpen, onClose: closeAccountModal, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3242
3312
|
"div",
|
|
3243
3313
|
{
|
|
3244
3314
|
className: "fc-modal-content",
|
|
3245
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
3315
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _85 => _85.appearance, 'optionalAccess', _86 => _86.accentColor]), () => ( "#8b5cf6")) },
|
|
3246
3316
|
"data-theme": theme,
|
|
3247
3317
|
children: [
|
|
3248
3318
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-hero", children: [
|
|
3249
|
-
_optionalChain([user, 'optionalAccess',
|
|
3319
|
+
_optionalChain([user, 'optionalAccess', _87 => _87.avatarUrl]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: user.avatarUrl, alt: "", className: "fc-account-hero-avatar" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-avatar fc-account-hero-avatar-placeholder", children: initial }),
|
|
3250
3320
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-hero-info", children: [
|
|
3251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-name", children: _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3252
|
-
_optionalChain([user, 'optionalAccess',
|
|
3321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-name", children: _nullishCoalesce(_optionalChain([user, 'optionalAccess', _88 => _88.displayName]), () => ( "Your account")) }),
|
|
3322
|
+
_optionalChain([user, 'optionalAccess', _89 => _89.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-email", children: user.primaryEmail })
|
|
3253
3323
|
] })
|
|
3254
3324
|
] }),
|
|
3255
3325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-tabs", children: TABS.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3287,13 +3357,13 @@ function AccountModal() {
|
|
|
3287
3357
|
}
|
|
3288
3358
|
function ProfileTab() {
|
|
3289
3359
|
const { user, updateProfile } = useUser();
|
|
3290
|
-
const [displayName, setDisplayName] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3291
|
-
const [avatarUrl, setAvatarUrl] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3360
|
+
const [displayName, setDisplayName] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _90 => _90.displayName]), () => ( "")));
|
|
3361
|
+
const [avatarUrl, setAvatarUrl] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _91 => _91.avatarUrl]), () => ( "")));
|
|
3292
3362
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
3293
3363
|
const [msg, setMsg] = _react.useState.call(void 0, null);
|
|
3294
3364
|
_react.useEffect.call(void 0, () => {
|
|
3295
|
-
setDisplayName(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3296
|
-
setAvatarUrl(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
3365
|
+
setDisplayName(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _92 => _92.displayName]), () => ( "")));
|
|
3366
|
+
setAvatarUrl(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _93 => _93.avatarUrl]), () => ( "")));
|
|
3297
3367
|
}, [user]);
|
|
3298
3368
|
const handleSave = async () => {
|
|
3299
3369
|
setLoading(true);
|
|
@@ -3358,7 +3428,7 @@ function LoginsTab({ onLink, refreshKey }) {
|
|
|
3358
3428
|
msg && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-error", children: msg }),
|
|
3359
3429
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
|
|
3360
3430
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-section-desc", children: "Ways you can sign in to your account." }),
|
|
3361
|
-
_optionalChain([authMethods, 'optionalAccess',
|
|
3431
|
+
_optionalChain([authMethods, 'optionalAccess', _94 => _94.map, 'call', _95 => _95((m) => {
|
|
3362
3432
|
const display = getMethodDisplay(m.provider);
|
|
3363
3433
|
const detail = m.provider === "email" ? m.providerId : m.provider.endsWith("_wallet") ? truncate(m.providerId) : m.providerUsername ? m.provider === "twitter" || m.provider === "telegram" ? `@${m.providerUsername}` : m.providerUsername : truncate(m.providerId);
|
|
3364
3434
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
|
|
@@ -3373,7 +3443,7 @@ function LoginsTab({ onLink, refreshKey }) {
|
|
|
3373
3443
|
] })
|
|
3374
3444
|
] }, m.id);
|
|
3375
3445
|
})]),
|
|
3376
|
-
_optionalChain([authMethods, 'optionalAccess',
|
|
3446
|
+
_optionalChain([authMethods, 'optionalAccess', _96 => _96.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No login methods yet" }),
|
|
3377
3447
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-secondary", onClick: onLink, style: { marginTop: 8 }, children: "+ Add login method" })
|
|
3378
3448
|
] });
|
|
3379
3449
|
}
|
|
@@ -3396,8 +3466,8 @@ function WalletsTab({ onLink, refreshKey }) {
|
|
|
3396
3466
|
msg && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-error", children: msg }),
|
|
3397
3467
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
|
|
3398
3468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-section-desc", children: "Crypto wallets connected to your account." }),
|
|
3399
|
-
_optionalChain([wallets, 'optionalAccess',
|
|
3400
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: _nullishCoalesce(_optionalChain([METHOD_DISPLAY, 'access',
|
|
3469
|
+
_optionalChain([wallets, 'optionalAccess', _97 => _97.map, 'call', _98 => _98((w) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
|
|
3470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: _nullishCoalesce(_optionalChain([METHOD_DISPLAY, 'access', _99 => _99[`${w.chain}_wallet`], 'optionalAccess', _100 => _100.iconHtml]), () => ( "")), className: "fc-account-item-icon" }),
|
|
3401
3471
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item-info", children: [
|
|
3402
3472
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "fc-account-item-label", children: [
|
|
3403
3473
|
w.chain.charAt(0).toUpperCase() + w.chain.slice(1),
|
|
@@ -3407,7 +3477,7 @@ function WalletsTab({ onLink, refreshKey }) {
|
|
|
3407
3477
|
] }),
|
|
3408
3478
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-item-actions", children: !w.isPrimary && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn-primary-sm", onClick: () => handleSetPrimary(w.id), children: "Make primary" }) })
|
|
3409
3479
|
] }, w.id))]),
|
|
3410
|
-
_optionalChain([wallets, 'optionalAccess',
|
|
3480
|
+
_optionalChain([wallets, 'optionalAccess', _101 => _101.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No wallets connected" }),
|
|
3411
3481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-secondary", onClick: onLink, style: { marginTop: 8 }, children: "+ Connect wallet" })
|
|
3412
3482
|
] });
|
|
3413
3483
|
}
|
|
@@ -3442,7 +3512,7 @@ function SecurityTab() {
|
|
|
3442
3512
|
refreshStatus();
|
|
3443
3513
|
refreshPasskeyCount();
|
|
3444
3514
|
}, [fetchSessions, fetchAuthMethods, refreshStatus, refreshPasskeyCount]);
|
|
3445
|
-
const hasPassword = _optionalChain([userAuthMethods, 'optionalAccess',
|
|
3515
|
+
const hasPassword = _optionalChain([userAuthMethods, 'optionalAccess', _102 => _102.some, 'call', _103 => _103((m) => m.provider === "email")]);
|
|
3446
3516
|
const handleRevoke = async (id) => {
|
|
3447
3517
|
setMsg("");
|
|
3448
3518
|
try {
|
|
@@ -3476,7 +3546,7 @@ function SecurityTab() {
|
|
|
3476
3546
|
] }),
|
|
3477
3547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRight, {})
|
|
3478
3548
|
] }),
|
|
3479
|
-
_optionalChain([user, 'optionalAccess',
|
|
3549
|
+
_optionalChain([user, 'optionalAccess', _104 => _104.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3480
3550
|
"button",
|
|
3481
3551
|
{
|
|
3482
3552
|
type: "button",
|
|
@@ -3497,7 +3567,7 @@ function SecurityTab() {
|
|
|
3497
3567
|
),
|
|
3498
3568
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-divider", style: { margin: "16px 0" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "active sessions" }) }),
|
|
3499
3569
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
|
|
3500
|
-
_optionalChain([sessions, 'optionalAccess',
|
|
3570
|
+
_optionalChain([sessions, 'optionalAccess', _105 => _105.map, 'call', _106 => _106((s) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
|
|
3501
3571
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-item-icon", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: [
|
|
3502
3572
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "3", width: "16", height: "11", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
3503
3573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M7 17h6M10 14v3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
@@ -3513,7 +3583,7 @@ function SecurityTab() {
|
|
|
3513
3583
|
] }),
|
|
3514
3584
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-item-actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn-danger-sm", onClick: () => handleRevoke(s.id), children: "Sign out" }) })
|
|
3515
3585
|
] }, s.id))]),
|
|
3516
|
-
_optionalChain([sessions, 'optionalAccess',
|
|
3586
|
+
_optionalChain([sessions, 'optionalAccess', _107 => _107.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No active sessions" }),
|
|
3517
3587
|
sessions && sessions.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3518
3588
|
"button",
|
|
3519
3589
|
{
|
|
@@ -3560,7 +3630,7 @@ function SecurityTab() {
|
|
|
3560
3630
|
onCountChange: (count) => setPasskeyCount(count)
|
|
3561
3631
|
}
|
|
3562
3632
|
),
|
|
3563
|
-
_optionalChain([user, 'optionalAccess',
|
|
3633
|
+
_optionalChain([user, 'optionalAccess', _108 => _108.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3564
3634
|
PasswordModal,
|
|
3565
3635
|
{
|
|
3566
3636
|
isOpen: showPasswordModal,
|
|
@@ -3605,7 +3675,7 @@ function LinkAuthModal() {
|
|
|
3605
3675
|
if (!linkModal.isOpen) return;
|
|
3606
3676
|
const handleMessage = (event) => {
|
|
3607
3677
|
if (event.origin !== window.location.origin) return;
|
|
3608
|
-
if (_optionalChain([event, 'access',
|
|
3678
|
+
if (_optionalChain([event, 'access', _109 => _109.data, 'optionalAccess', _110 => _110.type]) === "fc_oauth_link_success") {
|
|
3609
3679
|
setStep("success");
|
|
3610
3680
|
setTimeout(() => {
|
|
3611
3681
|
handleClose();
|
|
@@ -3616,7 +3686,7 @@ function LinkAuthModal() {
|
|
|
3616
3686
|
return () => window.removeEventListener("message", handleMessage);
|
|
3617
3687
|
}, [linkModal.isOpen]);
|
|
3618
3688
|
if (!linkModal.isOpen) return null;
|
|
3619
|
-
const theme = _nullishCoalesce(_optionalChain([config, 'access',
|
|
3689
|
+
const theme = _nullishCoalesce(_optionalChain([config, 'access', _111 => _111.appearance, 'optionalAccess', _112 => _112.theme]), () => ( "light"));
|
|
3620
3690
|
const handleClose = () => {
|
|
3621
3691
|
setStep("method-select");
|
|
3622
3692
|
closeLinkModal();
|
|
@@ -3639,7 +3709,7 @@ function LinkAuthModal() {
|
|
|
3639
3709
|
"div",
|
|
3640
3710
|
{
|
|
3641
3711
|
className: "fc-modal-content",
|
|
3642
|
-
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access',
|
|
3712
|
+
style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _113 => _113.appearance, 'optionalAccess', _114 => _114.accentColor]), () => ( "#8b5cf6")) },
|
|
3643
3713
|
"data-theme": theme,
|
|
3644
3714
|
children: step === "success" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SuccessView2, {}) : step === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3645
3715
|
ErrorView,
|
|
@@ -3655,7 +3725,7 @@ function LinkAuthModal() {
|
|
|
3655
3725
|
AuthMethodSelectStep,
|
|
3656
3726
|
{
|
|
3657
3727
|
config,
|
|
3658
|
-
connectedProviders: _nullishCoalesce(_optionalChain([authMethods, 'optionalAccess',
|
|
3728
|
+
connectedProviders: _nullishCoalesce(_optionalChain([authMethods, 'optionalAccess', _115 => _115.map, 'call', _116 => _116((m) => m.provider)]), () => ( [])),
|
|
3659
3729
|
onSelectEmail: () => setStep("email"),
|
|
3660
3730
|
onSelectOtp: () => setStep("otp"),
|
|
3661
3731
|
onOAuth: handleOAuthDirect
|
|
@@ -3874,13 +3944,13 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
|
|
|
3874
3944
|
const [coldWallet, setColdWallet] = _react.useState.call(void 0, false);
|
|
3875
3945
|
const mobile = _react.useMemo.call(void 0, () => isMobile(), []);
|
|
3876
3946
|
const walletConfig = config.walletConfig;
|
|
3877
|
-
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
3878
|
-
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess',
|
|
3947
|
+
const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _117 => _117.preferredWallets]), () => ( []));
|
|
3948
|
+
const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _118 => _118.onlyPreferred]), () => ( false));
|
|
3879
3949
|
const coldWalletRef = _react.useRef.call(void 0, coldWallet);
|
|
3880
3950
|
coldWalletRef.current = coldWallet;
|
|
3881
3951
|
const buildSignTxFnForAdapter = _react.useCallback.call(void 0, (adapter) => {
|
|
3882
3952
|
if (!adapter.signTransaction) return void 0;
|
|
3883
|
-
const TxClass = _optionalChain([walletConfig, 'optionalAccess',
|
|
3953
|
+
const TxClass = _optionalChain([walletConfig, 'optionalAccess', _119 => _119.Transaction]);
|
|
3884
3954
|
if (!TxClass) return void 0;
|
|
3885
3955
|
return async (txBase64) => {
|
|
3886
3956
|
const bytes = Uint8Array.from(atob(txBase64), (c) => c.charCodeAt(0));
|
|
@@ -3888,7 +3958,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
|
|
|
3888
3958
|
const signedTx = await adapter.signTransaction(tx);
|
|
3889
3959
|
return btoa(String.fromCharCode(...new Uint8Array(signedTx.serialize())));
|
|
3890
3960
|
};
|
|
3891
|
-
}, [_optionalChain([walletConfig, 'optionalAccess',
|
|
3961
|
+
}, [_optionalChain([walletConfig, 'optionalAccess', _120 => _120.Transaction])]);
|
|
3892
3962
|
const wallet = walletAdapter;
|
|
3893
3963
|
const handleConnect = async (w) => {
|
|
3894
3964
|
if (w.readyState !== "Installed") {
|
|
@@ -3931,12 +4001,12 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
|
|
|
3931
4001
|
const prefSet = new Set(preferred);
|
|
3932
4002
|
const others = all.filter((w) => !prefSet.has(w.adapter.name) && w.readyState === "Installed");
|
|
3933
4003
|
return { preferredWallets: prefList, otherWallets: others };
|
|
3934
|
-
}, [_optionalChain([walletAdapter, 'optionalAccess',
|
|
4004
|
+
}, [_optionalChain([walletAdapter, 'optionalAccess', _121 => _121.wallets]), walletConfig]);
|
|
3935
4005
|
const mobileExtraWallets = _react.useMemo.call(void 0, () => {
|
|
3936
4006
|
if (!mobile || !walletAdapter) return [];
|
|
3937
4007
|
const adapterNames = new Set(walletAdapter.wallets.map((w) => w.adapter.name));
|
|
3938
4008
|
return MOBILE_WALLETS.filter((mw) => !adapterNames.has(mw.name));
|
|
3939
|
-
}, [mobile, _optionalChain([walletAdapter, 'optionalAccess',
|
|
4009
|
+
}, [mobile, _optionalChain([walletAdapter, 'optionalAccess', _122 => _122.wallets])]);
|
|
3940
4010
|
if (!walletAdapter && mobile) {
|
|
3941
4011
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-tab", children: [
|
|
3942
4012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-wallet-list", children: MOBILE_WALLETS.map((mw) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -4032,7 +4102,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
|
|
|
4032
4102
|
] }, w.adapter.name))
|
|
4033
4103
|
] }),
|
|
4034
4104
|
preferredWallets.length === 0 && otherWallets.length === 0 && mobileExtraWallets.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "No wallet found. Please install a Solana wallet (like Phantom) to continue." }),
|
|
4035
|
-
_optionalChain([walletConfig, 'optionalAccess',
|
|
4105
|
+
_optionalChain([walletConfig, 'optionalAccess', _123 => _123.Transaction]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "fc-cold-wallet-toggle", children: [
|
|
4036
4106
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4037
4107
|
"input",
|
|
4038
4108
|
{
|
|
@@ -4067,7 +4137,7 @@ var registered = false;
|
|
|
4067
4137
|
async function registerMwaIfAvailable(config, opts) {
|
|
4068
4138
|
if (typeof window === "undefined") return;
|
|
4069
4139
|
if (registered) return;
|
|
4070
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
4140
|
+
if (_optionalChain([opts, 'optionalAccess', _124 => _124.enabled]) === false) return;
|
|
4071
4141
|
let mod;
|
|
4072
4142
|
try {
|
|
4073
4143
|
mod = await Promise.resolve().then(() => _interopRequireWildcard(require("@solana-mobile/wallet-standard-mobile")));
|
|
@@ -4082,8 +4152,8 @@ async function registerMwaIfAvailable(config, opts) {
|
|
|
4082
4152
|
createDefaultWalletNotFoundHandler
|
|
4083
4153
|
} = mod;
|
|
4084
4154
|
const origin = window.location.origin;
|
|
4085
|
-
const identity = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
4086
|
-
const appName = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(identity.name, () => ( _optionalChain([config, 'access',
|
|
4155
|
+
const identity = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _125 => _125.appIdentity]), () => ( {}));
|
|
4156
|
+
const appName = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(identity.name, () => ( _optionalChain([config, 'access', _126 => _126.appearance, 'optionalAccess', _127 => _127.title]))), () => ( (typeof document !== "undefined" ? document.title : ""))), () => ( "App"));
|
|
4087
4157
|
registered = true;
|
|
4088
4158
|
try {
|
|
4089
4159
|
registerMwa({
|
|
@@ -4093,7 +4163,7 @@ async function registerMwaIfAvailable(config, opts) {
|
|
|
4093
4163
|
icon: identity.icon
|
|
4094
4164
|
},
|
|
4095
4165
|
authorizationCache: createDefaultAuthorizationCache(),
|
|
4096
|
-
chains: _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
4166
|
+
chains: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _128 => _128.chains]), () => ( ["solana:mainnet"])),
|
|
4097
4167
|
chainSelector: createDefaultChainSelector(),
|
|
4098
4168
|
onWalletNotFound: createDefaultWalletNotFoundHandler()
|
|
4099
4169
|
});
|
|
@@ -4236,7 +4306,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
|
|
|
4236
4306
|
setModal({ isOpen: true, step: "success" });
|
|
4237
4307
|
setAuth({ status: "authenticated", user: outcome.user, accessToken: outcome.accessToken });
|
|
4238
4308
|
scheduleRefresh(outcome.accessToken);
|
|
4239
|
-
_optionalChain([onLogin, 'optionalCall',
|
|
4309
|
+
_optionalChain([onLogin, 'optionalCall', _129 => _129(outcome.user)]);
|
|
4240
4310
|
setTimeout(() => {
|
|
4241
4311
|
setModal({ isOpen: false, step: "method-select" });
|
|
4242
4312
|
}, 1500);
|
|
@@ -4256,12 +4326,12 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
|
|
|
4256
4326
|
};
|
|
4257
4327
|
const handleMessage = (event) => {
|
|
4258
4328
|
if (event.origin !== window.location.origin) return;
|
|
4259
|
-
if (_optionalChain([event, 'access',
|
|
4329
|
+
if (_optionalChain([event, 'access', _130 => _130.data, 'optionalAccess', _131 => _131.type]) === "fc_oauth_code") {
|
|
4260
4330
|
const code = event.data.code;
|
|
4261
4331
|
if (code) void handleCode(code);
|
|
4262
4332
|
return;
|
|
4263
4333
|
}
|
|
4264
|
-
if (_optionalChain([event, 'access',
|
|
4334
|
+
if (_optionalChain([event, 'access', _132 => _132.data, 'optionalAccess', _133 => _133.type]) === "fc_matrica_migration") {
|
|
4265
4335
|
const token = event.data.token;
|
|
4266
4336
|
if (token) void handleMigrationToken(token);
|
|
4267
4337
|
}
|
|
@@ -4310,7 +4380,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
|
|
|
4310
4380
|
setAuth({ status: "authenticated", user, accessToken: token });
|
|
4311
4381
|
scheduleRefresh(token);
|
|
4312
4382
|
setModal({ isOpen: true, step: "success" });
|
|
4313
|
-
_optionalChain([onLogin, 'optionalCall',
|
|
4383
|
+
_optionalChain([onLogin, 'optionalCall', _134 => _134(user)]);
|
|
4314
4384
|
setTimeout(() => {
|
|
4315
4385
|
setModal({ isOpen: false, step: "method-select" });
|
|
4316
4386
|
}, 1500);
|
|
@@ -4410,7 +4480,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
|
|
|
4410
4480
|
const token = auth.accessToken;
|
|
4411
4481
|
if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
|
|
4412
4482
|
setAuth({ status: "unauthenticated", user: null, accessToken: null });
|
|
4413
|
-
_optionalChain([onLogout, 'optionalCall',
|
|
4483
|
+
_optionalChain([onLogout, 'optionalCall', _135 => _135()]);
|
|
4414
4484
|
if (token) {
|
|
4415
4485
|
try {
|
|
4416
4486
|
await api.logout(token);
|
|
@@ -4464,7 +4534,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
|
|
|
4464
4534
|
const token = auth.accessToken;
|
|
4465
4535
|
if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
|
|
4466
4536
|
setAuth({ status: "unauthenticated", user: null, accessToken: null });
|
|
4467
|
-
_optionalChain([onLogout, 'optionalCall',
|
|
4537
|
+
_optionalChain([onLogout, 'optionalCall', _136 => _136()]);
|
|
4468
4538
|
if (token) {
|
|
4469
4539
|
try {
|
|
4470
4540
|
await api.logoutAll(token);
|
|
@@ -4675,11 +4745,11 @@ function useAdmin() {
|
|
|
4675
4745
|
const token = getAccessToken();
|
|
4676
4746
|
if (!token) throw new Error("Please sign in to continue.");
|
|
4677
4747
|
await api.adminUpdateUserStatus(token, id, status);
|
|
4678
|
-
if (_optionalChain([selectedUser, 'optionalAccess',
|
|
4748
|
+
if (_optionalChain([selectedUser, 'optionalAccess', _137 => _137.id]) === id) {
|
|
4679
4749
|
await getUser(id);
|
|
4680
4750
|
}
|
|
4681
4751
|
},
|
|
4682
|
-
[api, getAccessToken, _optionalChain([selectedUser, 'optionalAccess',
|
|
4752
|
+
[api, getAccessToken, _optionalChain([selectedUser, 'optionalAccess', _138 => _138.id]), getUser]
|
|
4683
4753
|
);
|
|
4684
4754
|
const getUserSessions = _react.useCallback.call(void 0,
|
|
4685
4755
|
async (id) => {
|
|
@@ -4796,9 +4866,9 @@ function useRoles() {
|
|
|
4796
4866
|
const token = getAccessToken();
|
|
4797
4867
|
if (!token) throw new Error("Please sign in to continue.");
|
|
4798
4868
|
await api.adminDeleteRole(token, id);
|
|
4799
|
-
if (_optionalChain([selectedRole, 'optionalAccess',
|
|
4869
|
+
if (_optionalChain([selectedRole, 'optionalAccess', _139 => _139.id]) === id) setSelectedRole(null);
|
|
4800
4870
|
},
|
|
4801
|
-
[api, getAccessToken, _optionalChain([selectedRole, 'optionalAccess',
|
|
4871
|
+
[api, getAccessToken, _optionalChain([selectedRole, 'optionalAccess', _140 => _140.id])]
|
|
4802
4872
|
);
|
|
4803
4873
|
const getPermissions = _react.useCallback.call(void 0,
|
|
4804
4874
|
async () => {
|
|
@@ -4925,5 +4995,7 @@ function hasAnyPermission(required, granted) {
|
|
|
4925
4995
|
|
|
4926
4996
|
|
|
4927
4997
|
|
|
4928
|
-
|
|
4998
|
+
|
|
4999
|
+
|
|
5000
|
+
exports.AccountButton = AccountButton; exports.AccountModal = AccountModal; exports.DeleteAccountModal = DeleteAccountModal; exports.ErrorView = ErrorView; exports.ForgeConnectApiError = ForgeConnectApiError; exports.ForgeConnectContext = ForgeConnectContext; exports.ForgeConnectProvider = ForgeConnectProvider; exports.LinkAuthModal = LinkAuthModal; exports.LoginButton = LoginButton; exports.LoginModal = LoginModal; exports.ModalOverlay = ModalOverlay; exports.PasskeysModal = PasskeysModal; exports.TwoFactorModal = TwoFactorModal; exports.connectSeekerBridge = connectSeekerBridge; exports.createApiClient = createApiClient; exports.hasAllPermissions = hasAllPermissions; exports.hasAnyPermission = hasAnyPermission; exports.hasPermission = hasPermission; exports.isOAuthMethod = isOAuthMethod; exports.isSeekerApp = isSeekerApp; exports.registerMwaIfAvailable = registerMwaIfAvailable; exports.resolveLoginMethods = resolveLoginMethods; exports.useAdmin = useAdmin; exports.useForgeConnect = useForgeConnect; exports.useRoles = useRoles; exports.useSessions = useSessions; exports.useUser = useUser; exports.useWallets = useWallets;
|
|
4929
5001
|
//# sourceMappingURL=index.cjs.map
|