@yieldfabric/wallet 0.2.4 → 0.2.6
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 +786 -775
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +145 -134
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var React55 = require('react');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var avererWebsdk = require('@averer/averer-websdk');
|
|
13
13
|
var sha3 = require('js-sha3');
|
|
@@ -20,7 +20,7 @@ var zod = require('zod');
|
|
|
20
20
|
|
|
21
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var React55__default = /*#__PURE__*/_interopDefault(React55);
|
|
24
24
|
var sha3__default = /*#__PURE__*/_interopDefault(sha3);
|
|
25
25
|
var theme__default = /*#__PURE__*/_interopDefault(theme);
|
|
26
26
|
|
|
@@ -1521,6 +1521,26 @@ var init_tokenStore = __esm({
|
|
|
1521
1521
|
}
|
|
1522
1522
|
});
|
|
1523
1523
|
|
|
1524
|
+
// src/core/crossTabRefresh.ts
|
|
1525
|
+
function withRefreshLock(renew, locks = globalThis.navigator?.locks) {
|
|
1526
|
+
if (!locks?.request) return renew();
|
|
1527
|
+
return locks.request(REFRESH_LOCK, renew);
|
|
1528
|
+
}
|
|
1529
|
+
function renewedElsewhere(spent, stored, chainId, now = Date.now()) {
|
|
1530
|
+
if (!stored.access || !stored.refresh || stored.refresh === spent) return false;
|
|
1531
|
+
const claims = decodeJwtPayload(stored.access);
|
|
1532
|
+
const exp = claims?.exp;
|
|
1533
|
+
return typeof exp === "number" && exp * 1e3 - now > LIVE_FOR_MS && claims?.default_chain_id === chainId;
|
|
1534
|
+
}
|
|
1535
|
+
var REFRESH_LOCK, LIVE_FOR_MS;
|
|
1536
|
+
var init_crossTabRefresh = __esm({
|
|
1537
|
+
"src/core/crossTabRefresh.ts"() {
|
|
1538
|
+
init_jwtPayload();
|
|
1539
|
+
REFRESH_LOCK = "yieldfabric-auth-refresh";
|
|
1540
|
+
LIVE_FOR_MS = 3e4;
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
|
|
1524
1544
|
// src/core/onboardingPlanSelectionStorage.ts
|
|
1525
1545
|
function readOnboardingPlanSelectionHint() {
|
|
1526
1546
|
if (typeof window === "undefined") return null;
|
|
@@ -1600,6 +1620,7 @@ var init_authService = __esm({
|
|
|
1600
1620
|
init_tokenManager();
|
|
1601
1621
|
init_jwtClaims();
|
|
1602
1622
|
init_tokenStore();
|
|
1623
|
+
init_crossTabRefresh();
|
|
1603
1624
|
init_onboardingPlanSelectionStorage();
|
|
1604
1625
|
isRefreshing = false;
|
|
1605
1626
|
refreshPromise = null;
|
|
@@ -1786,19 +1807,23 @@ var init_authService = __esm({
|
|
|
1786
1807
|
error.statusCode = 401;
|
|
1787
1808
|
throw error;
|
|
1788
1809
|
}
|
|
1810
|
+
const spent = this.refreshToken;
|
|
1789
1811
|
isRefreshing = true;
|
|
1790
1812
|
refreshOperation = { kind: "regular", chainId };
|
|
1791
|
-
refreshPromise = this.performRefresh(chainId);
|
|
1813
|
+
refreshPromise = withRefreshLock(async () => this.adoptRenewedSession(chainId, spent) ?? this.performRefresh(chainId));
|
|
1792
1814
|
const activePromise = refreshPromise;
|
|
1793
1815
|
try {
|
|
1794
1816
|
const result = await refreshPromise;
|
|
1795
1817
|
return result;
|
|
1796
1818
|
} catch (error) {
|
|
1797
1819
|
switch (classifyAuthFailure(error)) {
|
|
1798
|
-
case "auth":
|
|
1820
|
+
case "auth": {
|
|
1821
|
+
const adopted = this.adoptRenewedSession(chainId, spent);
|
|
1822
|
+
if (adopted) return adopted;
|
|
1799
1823
|
console.warn("Authentication error during token refresh, clearing tokens");
|
|
1800
1824
|
this.clearTokensFromStorage();
|
|
1801
1825
|
break;
|
|
1826
|
+
}
|
|
1802
1827
|
case "network":
|
|
1803
1828
|
console.warn("Network error during token refresh, preserving tokens for retry");
|
|
1804
1829
|
break;
|
|
@@ -1814,6 +1839,20 @@ var init_authService = __esm({
|
|
|
1814
1839
|
}
|
|
1815
1840
|
}
|
|
1816
1841
|
}
|
|
1842
|
+
/** The session another window renewed since this one read the refresh
|
|
1843
|
+
* token `spent`, taken as this window's own; `null` when there is none. */
|
|
1844
|
+
adoptRenewedSession(chainId, spent) {
|
|
1845
|
+
const stored = { access: exports.defaultTokenStore.getAccessToken(), refresh: exports.defaultTokenStore.getRefreshToken() };
|
|
1846
|
+
if (!stored.access || !stored.refresh || !renewedElsewhere(spent, stored, chainId)) return null;
|
|
1847
|
+
this.saveTokensToStorage(stored.access, stored.refresh);
|
|
1848
|
+
const exp = decodeJwtPayload(stored.access)?.exp;
|
|
1849
|
+
return {
|
|
1850
|
+
access_token: stored.access,
|
|
1851
|
+
refresh_token: stored.refresh,
|
|
1852
|
+
token_type: "Bearer",
|
|
1853
|
+
expires_in: Math.max(0, Math.floor(exp - Date.now() / 1e3))
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1817
1856
|
/**
|
|
1818
1857
|
* Perform the actual token refresh.
|
|
1819
1858
|
*
|
|
@@ -4927,7 +4966,7 @@ function WalletConfigProvider({ config, children }) {
|
|
|
4927
4966
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletConfigContext.Provider, { value: config, children });
|
|
4928
4967
|
}
|
|
4929
4968
|
function useWalletConfig() {
|
|
4930
|
-
return
|
|
4969
|
+
return React55.useContext(WalletConfigContext);
|
|
4931
4970
|
}
|
|
4932
4971
|
function useTokenStore() {
|
|
4933
4972
|
const { tokenStore } = useWalletConfig();
|
|
@@ -4954,19 +4993,19 @@ var WalletConfigContext;
|
|
|
4954
4993
|
var init_WalletConfigContext = __esm({
|
|
4955
4994
|
"src/providers/WalletConfigContext.tsx"() {
|
|
4956
4995
|
init_jwtClaims();
|
|
4957
|
-
WalletConfigContext =
|
|
4996
|
+
WalletConfigContext = React55.createContext({});
|
|
4958
4997
|
}
|
|
4959
4998
|
});
|
|
4960
4999
|
function ProviderConfigProvider({
|
|
4961
5000
|
children,
|
|
4962
5001
|
platform
|
|
4963
5002
|
}) {
|
|
4964
|
-
const [state, setState] =
|
|
5003
|
+
const [state, setState] = React55.useState({
|
|
4965
5004
|
config: null,
|
|
4966
5005
|
isLoading: true,
|
|
4967
5006
|
error: null
|
|
4968
5007
|
});
|
|
4969
|
-
|
|
5008
|
+
React55.useEffect(() => {
|
|
4970
5009
|
let cancelled = false;
|
|
4971
5010
|
(async () => {
|
|
4972
5011
|
try {
|
|
@@ -5007,12 +5046,12 @@ function ProviderConfigProvider({
|
|
|
5007
5046
|
return /* @__PURE__ */ jsxRuntime.jsx(ProviderConfigContext.Provider, { value: state, children });
|
|
5008
5047
|
}
|
|
5009
5048
|
function useProviderConfig() {
|
|
5010
|
-
return
|
|
5049
|
+
return React55.useContext(ProviderConfigContext);
|
|
5011
5050
|
}
|
|
5012
5051
|
var ProviderConfigContext, AUTH_BASE5;
|
|
5013
5052
|
var init_ProviderConfigContext = __esm({
|
|
5014
5053
|
"src/providers/ProviderConfigContext.tsx"() {
|
|
5015
|
-
ProviderConfigContext =
|
|
5054
|
+
ProviderConfigContext = React55.createContext({
|
|
5016
5055
|
config: null,
|
|
5017
5056
|
isLoading: true,
|
|
5018
5057
|
error: null
|
|
@@ -5222,7 +5261,7 @@ __export(SignupFlow_exports, {
|
|
|
5222
5261
|
default: () => SignupFlow_default
|
|
5223
5262
|
});
|
|
5224
5263
|
function useRegisterConflictPatch() {
|
|
5225
|
-
|
|
5264
|
+
React55.useEffect(() => {
|
|
5226
5265
|
const original = window.fetch;
|
|
5227
5266
|
window.fetch = async function patchedFetch(input, init) {
|
|
5228
5267
|
const response = await original.call(window, input, init);
|
|
@@ -5245,7 +5284,7 @@ function useRegisterConflictPatch() {
|
|
|
5245
5284
|
}, []);
|
|
5246
5285
|
}
|
|
5247
5286
|
function useAvererCssVars() {
|
|
5248
|
-
|
|
5287
|
+
React55.useEffect(() => {
|
|
5249
5288
|
const root = document.documentElement;
|
|
5250
5289
|
const prior = [];
|
|
5251
5290
|
for (const [name, value] of Object.entries(AVERER_CSS_VARS)) {
|
|
@@ -5377,12 +5416,12 @@ var init_SignupFlow = __esm({
|
|
|
5377
5416
|
};
|
|
5378
5417
|
AvererSigninConsumer = ({ appName, onComplete, onError, platform }) => {
|
|
5379
5418
|
const wallet = avererWebsdk.useAvererWallet();
|
|
5380
|
-
const walletRef =
|
|
5381
|
-
|
|
5419
|
+
const walletRef = React55.useRef(wallet);
|
|
5420
|
+
React55.useEffect(() => {
|
|
5382
5421
|
walletRef.current = wallet;
|
|
5383
5422
|
}, [wallet]);
|
|
5384
|
-
const widgetWrapRef =
|
|
5385
|
-
|
|
5423
|
+
const widgetWrapRef = React55.useRef(null);
|
|
5424
|
+
React55.useEffect(() => {
|
|
5386
5425
|
const root = widgetWrapRef.current;
|
|
5387
5426
|
if (!root) return;
|
|
5388
5427
|
const OVERRIDE_CSS = `
|
|
@@ -5877,8 +5916,8 @@ function decide(snapshot, ctx) {
|
|
|
5877
5916
|
}
|
|
5878
5917
|
function useOnboardingState(identityRequired = false, planApplicable = false, identityProviders = [], kycVerifiesEmail = false) {
|
|
5879
5918
|
const identityProvidersKey = JSON.stringify(identityProviders);
|
|
5880
|
-
const previousIdentityProvidersKey =
|
|
5881
|
-
const [state, setState] =
|
|
5919
|
+
const previousIdentityProvidersKey = React55.useRef(identityProvidersKey);
|
|
5920
|
+
const [state, setState] = React55.useState(() => {
|
|
5882
5921
|
const cached = cachedSnapshotFor(identityProvidersKey, identityProviders);
|
|
5883
5922
|
if (cached) {
|
|
5884
5923
|
return {
|
|
@@ -5893,7 +5932,7 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
|
|
|
5893
5932
|
}
|
|
5894
5933
|
return { status: "checking", snapshot: null };
|
|
5895
5934
|
});
|
|
5896
|
-
|
|
5935
|
+
React55.useEffect(() => {
|
|
5897
5936
|
if (state.status !== "checking") return;
|
|
5898
5937
|
let cancelled = false;
|
|
5899
5938
|
(async () => {
|
|
@@ -5928,14 +5967,14 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
|
|
|
5928
5967
|
cancelled = true;
|
|
5929
5968
|
};
|
|
5930
5969
|
}, [state.status, identityRequired, identityProvidersKey, planApplicable]);
|
|
5931
|
-
|
|
5970
|
+
React55.useEffect(() => {
|
|
5932
5971
|
const notify = () => setState({ status: "checking", snapshot: null });
|
|
5933
5972
|
subscribers.add(notify);
|
|
5934
5973
|
return () => {
|
|
5935
5974
|
subscribers.delete(notify);
|
|
5936
5975
|
};
|
|
5937
5976
|
}, []);
|
|
5938
|
-
|
|
5977
|
+
React55.useEffect(() => {
|
|
5939
5978
|
if (previousIdentityProvidersKey.current !== identityProvidersKey) {
|
|
5940
5979
|
previousIdentityProvidersKey.current = identityProvidersKey;
|
|
5941
5980
|
setState({ status: "checking", snapshot: null });
|
|
@@ -5979,14 +6018,14 @@ function clearDynamicSession() {
|
|
|
5979
6018
|
|
|
5980
6019
|
// src/react/AuthContext.tsx
|
|
5981
6020
|
init_WalletConfigContext();
|
|
5982
|
-
var WalletAuthContext =
|
|
6021
|
+
var WalletAuthContext = React55.createContext(void 0);
|
|
5983
6022
|
function WalletAuthProvider({ children }) {
|
|
5984
6023
|
const { onSessionBootstrapped, onBeforeLogout } = useWalletConfig();
|
|
5985
|
-
const [user, setUser] =
|
|
5986
|
-
const [isLoading, setIsLoading] =
|
|
5987
|
-
const [error, setError] =
|
|
5988
|
-
const [retryTick, setRetryTick] =
|
|
5989
|
-
const retryWhenOnline =
|
|
6024
|
+
const [user, setUser] = React55.useState(null);
|
|
6025
|
+
const [isLoading, setIsLoading] = React55.useState(true);
|
|
6026
|
+
const [error, setError] = React55.useState(null);
|
|
6027
|
+
const [retryTick, setRetryTick] = React55.useState(0);
|
|
6028
|
+
const retryWhenOnline = React55.useCallback(() => {
|
|
5990
6029
|
if (typeof window === "undefined") return;
|
|
5991
6030
|
const once = () => {
|
|
5992
6031
|
window.removeEventListener("online", once);
|
|
@@ -5995,7 +6034,7 @@ function WalletAuthProvider({ children }) {
|
|
|
5995
6034
|
window.addEventListener("online", once);
|
|
5996
6035
|
}, []);
|
|
5997
6036
|
const isAuthenticated = exports.authService.isAuthenticated();
|
|
5998
|
-
|
|
6037
|
+
React55.useEffect(() => {
|
|
5999
6038
|
const loadUserData = async () => {
|
|
6000
6039
|
if (isAuthenticated) {
|
|
6001
6040
|
try {
|
|
@@ -6025,12 +6064,12 @@ function WalletAuthProvider({ children }) {
|
|
|
6025
6064
|
};
|
|
6026
6065
|
loadUserData();
|
|
6027
6066
|
}, [isAuthenticated, retryTick]);
|
|
6028
|
-
|
|
6067
|
+
React55.useEffect(() => {
|
|
6029
6068
|
if (user?.id) {
|
|
6030
6069
|
invalidateWalletCount();
|
|
6031
6070
|
}
|
|
6032
6071
|
}, [user?.id]);
|
|
6033
|
-
|
|
6072
|
+
React55.useEffect(() => {
|
|
6034
6073
|
return () => {
|
|
6035
6074
|
tokenRenewalService.stopRenewal();
|
|
6036
6075
|
};
|
|
@@ -6127,7 +6166,7 @@ function WalletAuthProvider({ children }) {
|
|
|
6127
6166
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletAuthContext.Provider, { value, children });
|
|
6128
6167
|
}
|
|
6129
6168
|
function useAuth() {
|
|
6130
|
-
const context =
|
|
6169
|
+
const context = React55.useContext(WalletAuthContext);
|
|
6131
6170
|
if (context === void 0) {
|
|
6132
6171
|
throw new Error("useAuth must be used within a <WalletAuthProvider>");
|
|
6133
6172
|
}
|
|
@@ -6430,8 +6469,8 @@ function loadModule() {
|
|
|
6430
6469
|
return inflight;
|
|
6431
6470
|
}
|
|
6432
6471
|
function useAvererModule() {
|
|
6433
|
-
const [mod, setMod] =
|
|
6434
|
-
|
|
6472
|
+
const [mod, setMod] = React55.useState(cachedModule);
|
|
6473
|
+
React55.useEffect(() => {
|
|
6435
6474
|
if (mod) return;
|
|
6436
6475
|
let cancelled = false;
|
|
6437
6476
|
loadModule().then((resolved) => {
|
|
@@ -6450,7 +6489,7 @@ function AvererWalletBridgeInner({
|
|
|
6450
6489
|
children
|
|
6451
6490
|
}) {
|
|
6452
6491
|
const wallet = mod.useAvererWallet();
|
|
6453
|
-
|
|
6492
|
+
React55.useEffect(() => {
|
|
6454
6493
|
walletRef.current = wallet ?? null;
|
|
6455
6494
|
}, [wallet, walletRef]);
|
|
6456
6495
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
@@ -6465,8 +6504,8 @@ function LazyAvererSdkGate({
|
|
|
6465
6504
|
const { AvererSdkProvider: AvererSdkProvider3 } = mod;
|
|
6466
6505
|
return /* @__PURE__ */ jsxRuntime.jsx(AvererSdkProvider3, { configId, children: /* @__PURE__ */ jsxRuntime.jsx(AvererWalletBridgeInner, { mod, walletRef, children }) });
|
|
6467
6506
|
}
|
|
6468
|
-
var WalletSignerContext =
|
|
6469
|
-
var SilentSdkBoundary = class extends
|
|
6507
|
+
var WalletSignerContext = React55.createContext(null);
|
|
6508
|
+
var SilentSdkBoundary = class extends React55.Component {
|
|
6470
6509
|
constructor() {
|
|
6471
6510
|
super(...arguments);
|
|
6472
6511
|
this.state = { hasError: false };
|
|
@@ -6486,10 +6525,10 @@ var SilentSdkBoundary = class extends React54.Component {
|
|
|
6486
6525
|
}
|
|
6487
6526
|
};
|
|
6488
6527
|
function usePathname() {
|
|
6489
|
-
const [path, setPath] =
|
|
6528
|
+
const [path, setPath] = React55.useState(
|
|
6490
6529
|
() => typeof window !== "undefined" ? window.location.pathname : "/"
|
|
6491
6530
|
);
|
|
6492
|
-
|
|
6531
|
+
React55.useEffect(() => {
|
|
6493
6532
|
if (typeof window === "undefined") return;
|
|
6494
6533
|
const onChange = () => setPath(window.location.pathname);
|
|
6495
6534
|
window.addEventListener("popstate", onChange);
|
|
@@ -6535,10 +6574,10 @@ function WalletSignerProvider({ children }) {
|
|
|
6535
6574
|
const { isAuthenticated } = useAuth();
|
|
6536
6575
|
const { disableGlobalSigner } = useWalletConfig();
|
|
6537
6576
|
const configId = config?.auth?.settings?.averer?.config_id ?? "";
|
|
6538
|
-
const walletRef =
|
|
6577
|
+
const walletRef = React55.useRef(null);
|
|
6539
6578
|
const pathname = usePathname();
|
|
6540
6579
|
const skipSdkRoute = pathname === "/login" || pathname === "/mcp/login" || pathname.startsWith("/onboarding");
|
|
6541
|
-
const signMessage =
|
|
6580
|
+
const signMessage = React55.useCallback(
|
|
6542
6581
|
async (messageHex, providerHint, ctxOrAddress) => {
|
|
6543
6582
|
const ctx = typeof ctxOrAddress === "string" ? { address: ctxOrAddress } : ctxOrAddress ?? {};
|
|
6544
6583
|
const hint = (providerHint || "").toLowerCase();
|
|
@@ -6586,7 +6625,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6586
6625
|
},
|
|
6587
6626
|
[]
|
|
6588
6627
|
);
|
|
6589
|
-
const getEoaTransport =
|
|
6628
|
+
const getEoaTransport = React55.useCallback(
|
|
6590
6629
|
async (providerHint) => {
|
|
6591
6630
|
if (providerHint === "passkey") {
|
|
6592
6631
|
throw new Error("EOA operations are not supported for passkey keys.");
|
|
@@ -6614,7 +6653,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6614
6653
|
},
|
|
6615
6654
|
[]
|
|
6616
6655
|
);
|
|
6617
|
-
const sendTransaction =
|
|
6656
|
+
const sendTransaction = React55.useCallback(
|
|
6618
6657
|
async (tx, providerHint) => {
|
|
6619
6658
|
const transport = await getEoaTransport(providerHint);
|
|
6620
6659
|
const txHash = await transport.request("eth_sendTransaction", [tx]);
|
|
@@ -6625,14 +6664,14 @@ function WalletSignerProvider({ children }) {
|
|
|
6625
6664
|
},
|
|
6626
6665
|
[getEoaTransport]
|
|
6627
6666
|
);
|
|
6628
|
-
const request =
|
|
6667
|
+
const request = React55.useCallback(
|
|
6629
6668
|
async (method, params, providerHint) => {
|
|
6630
6669
|
const transport = await getEoaTransport(providerHint);
|
|
6631
6670
|
return transport.request(method, params);
|
|
6632
6671
|
},
|
|
6633
6672
|
[getEoaTransport]
|
|
6634
6673
|
);
|
|
6635
|
-
const value =
|
|
6674
|
+
const value = React55.useMemo(
|
|
6636
6675
|
() => ({ signMessage, sendTransaction, request }),
|
|
6637
6676
|
[signMessage, sendTransaction, request]
|
|
6638
6677
|
);
|
|
@@ -6642,7 +6681,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6642
6681
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletSignerContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(SilentSdkBoundary, { fallback: children, children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSdkGate, { configId, walletRef, children }) }) });
|
|
6643
6682
|
}
|
|
6644
6683
|
function useWalletSigner() {
|
|
6645
|
-
const ctx =
|
|
6684
|
+
const ctx = React55.useContext(WalletSignerContext);
|
|
6646
6685
|
if (!ctx) {
|
|
6647
6686
|
throw new Error("useWalletSigner must be used inside <WalletSignerProvider>");
|
|
6648
6687
|
}
|
|
@@ -7785,13 +7824,13 @@ function getWebSocketChannelManager(url, getAccessToken) {
|
|
|
7785
7824
|
init_config();
|
|
7786
7825
|
init_jwtClaims();
|
|
7787
7826
|
init_WalletConfigContext();
|
|
7788
|
-
var SignatureQueueContext =
|
|
7827
|
+
var SignatureQueueContext = React55.createContext(null);
|
|
7789
7828
|
function SignatureQueueProvider({ children }) {
|
|
7790
7829
|
const value = useSignatureQueueInternal();
|
|
7791
7830
|
return /* @__PURE__ */ jsxRuntime.jsx(SignatureQueueContext.Provider, { value, children });
|
|
7792
7831
|
}
|
|
7793
7832
|
function useSignatureQueue() {
|
|
7794
|
-
const ctx =
|
|
7833
|
+
const ctx = React55.useContext(SignatureQueueContext);
|
|
7795
7834
|
const fallback = useSignatureQueueInternal(ctx !== null);
|
|
7796
7835
|
return ctx ?? fallback;
|
|
7797
7836
|
}
|
|
@@ -7799,12 +7838,12 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7799
7838
|
const { user, isAuthenticated } = useAuth();
|
|
7800
7839
|
const { webSocketUrl } = useWalletConfig();
|
|
7801
7840
|
const tokenStore = useTokenStore();
|
|
7802
|
-
const [pending, setPending] =
|
|
7803
|
-
const [pendingList, setPendingList] =
|
|
7804
|
-
const [currentMessage, setCurrentMessage] =
|
|
7805
|
-
const [drawerOpen, setDrawerOpen] =
|
|
7806
|
-
const surfacedRef =
|
|
7807
|
-
const fetchAndSetPending =
|
|
7841
|
+
const [pending, setPending] = React55.useState(null);
|
|
7842
|
+
const [pendingList, setPendingList] = React55.useState([]);
|
|
7843
|
+
const [currentMessage, setCurrentMessage] = React55.useState(null);
|
|
7844
|
+
const [drawerOpen, setDrawerOpen] = React55.useState(false);
|
|
7845
|
+
const surfacedRef = React55.useRef(/* @__PURE__ */ new Set());
|
|
7846
|
+
const fetchAndSetPending = React55.useCallback(async () => {
|
|
7808
7847
|
if (inert || !user?.id) return;
|
|
7809
7848
|
try {
|
|
7810
7849
|
const awaiting = await messagesService.getMessagesAwaitingSignature(user.id);
|
|
@@ -7826,7 +7865,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7826
7865
|
console.warn("[useSignatureQueue] refresh failed");
|
|
7827
7866
|
}
|
|
7828
7867
|
}, [inert, user?.id]);
|
|
7829
|
-
|
|
7868
|
+
React55.useEffect(() => {
|
|
7830
7869
|
if (inert) return;
|
|
7831
7870
|
if (!isAuthenticated || !user?.id) return;
|
|
7832
7871
|
if (!getActiveChainId()) return;
|
|
@@ -7882,7 +7921,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7882
7921
|
}
|
|
7883
7922
|
};
|
|
7884
7923
|
}, [inert, isAuthenticated, user?.id, webSocketUrl, fetchAndSetPending, tokenStore]);
|
|
7885
|
-
const openSigner =
|
|
7924
|
+
const openSigner = React55.useCallback(
|
|
7886
7925
|
(message) => {
|
|
7887
7926
|
const target = message ?? pending;
|
|
7888
7927
|
if (!target) return;
|
|
@@ -7891,14 +7930,14 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7891
7930
|
},
|
|
7892
7931
|
[pending]
|
|
7893
7932
|
);
|
|
7894
|
-
const closeSigner =
|
|
7933
|
+
const closeSigner = React55.useCallback(() => {
|
|
7895
7934
|
setDrawerOpen(false);
|
|
7896
7935
|
setCurrentMessage(null);
|
|
7897
7936
|
}, []);
|
|
7898
|
-
const dismissPending =
|
|
7937
|
+
const dismissPending = React55.useCallback(() => {
|
|
7899
7938
|
setPending(null);
|
|
7900
7939
|
}, []);
|
|
7901
|
-
|
|
7940
|
+
React55.useEffect(() => {
|
|
7902
7941
|
if (inert) return;
|
|
7903
7942
|
if (!isAuthenticated) {
|
|
7904
7943
|
setDrawerOpen(false);
|
|
@@ -8642,15 +8681,15 @@ init_delegationScopes();
|
|
|
8642
8681
|
init_tokenManager();
|
|
8643
8682
|
init_jwtClaims();
|
|
8644
8683
|
init_jwtPayload();
|
|
8645
|
-
var AppAuthContext =
|
|
8684
|
+
var AppAuthContext = React55.createContext(void 0);
|
|
8646
8685
|
function AppAuthProvider({ children }) {
|
|
8647
8686
|
const walletAuth = useAuth();
|
|
8648
8687
|
const { isAuthenticated, user, isLoading: walletLoading } = walletAuth;
|
|
8649
|
-
const [groups, setGroups] =
|
|
8650
|
-
const [groupsLoaded, setGroupsLoaded] =
|
|
8651
|
-
const [delegationToken, setDelegationToken] =
|
|
8652
|
-
const [delegationSession, setDelegationSession] =
|
|
8653
|
-
|
|
8688
|
+
const [groups, setGroups] = React55.useState([]);
|
|
8689
|
+
const [groupsLoaded, setGroupsLoaded] = React55.useState(false);
|
|
8690
|
+
const [delegationToken, setDelegationToken] = React55.useState(null);
|
|
8691
|
+
const [delegationSession, setDelegationSession] = React55.useState(null);
|
|
8692
|
+
React55.useEffect(() => {
|
|
8654
8693
|
if (!isAuthenticated) {
|
|
8655
8694
|
setGroups([]);
|
|
8656
8695
|
setGroupsLoaded(false);
|
|
@@ -8681,7 +8720,7 @@ function AppAuthProvider({ children }) {
|
|
|
8681
8720
|
cancelled = true;
|
|
8682
8721
|
};
|
|
8683
8722
|
}, [isAuthenticated, walletLoading, user]);
|
|
8684
|
-
|
|
8723
|
+
React55.useEffect(() => {
|
|
8685
8724
|
if (!isAuthenticated) {
|
|
8686
8725
|
setDelegationToken(null);
|
|
8687
8726
|
setDelegationSession(null);
|
|
@@ -8694,7 +8733,7 @@ function AppAuthProvider({ children }) {
|
|
|
8694
8733
|
sync();
|
|
8695
8734
|
return exports.tokenManager.subscribe(sync);
|
|
8696
8735
|
}, [isAuthenticated]);
|
|
8697
|
-
const refreshGroups =
|
|
8736
|
+
const refreshGroups = React55.useCallback(async () => {
|
|
8698
8737
|
if (!isAuthenticated) return;
|
|
8699
8738
|
try {
|
|
8700
8739
|
const userGroups = await groupsService.getUserGroups();
|
|
@@ -8704,7 +8743,7 @@ function AppAuthProvider({ children }) {
|
|
|
8704
8743
|
console.warn("AppAuthContext.refreshGroups failed:", err);
|
|
8705
8744
|
}
|
|
8706
8745
|
}, [isAuthenticated]);
|
|
8707
|
-
const createDelegationToken =
|
|
8746
|
+
const createDelegationToken = React55.useCallback(async (group) => {
|
|
8708
8747
|
const response = await exports.delegationService.createDelegationToken({
|
|
8709
8748
|
group_id: group.id,
|
|
8710
8749
|
delegation_scope: [...exports.DEFAULT_APP_DELEGATION_SCOPE],
|
|
@@ -8721,7 +8760,7 @@ function AppAuthProvider({ children }) {
|
|
|
8721
8760
|
expiresAt: expirationTime
|
|
8722
8761
|
});
|
|
8723
8762
|
}, []);
|
|
8724
|
-
const assumeOwnedGroup =
|
|
8763
|
+
const assumeOwnedGroup = React55.useCallback(async (group, signerKeyId, delegationScope = exports.DEFAULT_OWNED_GROUP_DELEGATION_SCOPE) => {
|
|
8725
8764
|
const parent = exports.tokenManager.getDelegationSessionMetadata();
|
|
8726
8765
|
const parentToken = exports.tokenManager.getDelegationToken();
|
|
8727
8766
|
if (parent?.kind !== "direct" || !parentToken) {
|
|
@@ -8772,11 +8811,11 @@ function AppAuthProvider({ children }) {
|
|
|
8772
8811
|
});
|
|
8773
8812
|
return response;
|
|
8774
8813
|
}, []);
|
|
8775
|
-
const returnToParent =
|
|
8776
|
-
const clearDelegationToken =
|
|
8814
|
+
const returnToParent = React55.useCallback(() => exports.tokenManager.restoreParentDelegationSession(), []);
|
|
8815
|
+
const clearDelegationToken = React55.useCallback(() => {
|
|
8777
8816
|
exports.tokenManager.clearDelegationToken();
|
|
8778
8817
|
}, []);
|
|
8779
|
-
const value =
|
|
8818
|
+
const value = React55.useMemo(
|
|
8780
8819
|
() => ({
|
|
8781
8820
|
...walletAuth,
|
|
8782
8821
|
groups,
|
|
@@ -8805,42 +8844,42 @@ function AppAuthProvider({ children }) {
|
|
|
8805
8844
|
return /* @__PURE__ */ jsxRuntime.jsx(AppAuthContext.Provider, { value, children });
|
|
8806
8845
|
}
|
|
8807
8846
|
function useAuthContext() {
|
|
8808
|
-
const ctx =
|
|
8847
|
+
const ctx = React55.useContext(AppAuthContext);
|
|
8809
8848
|
if (!ctx) {
|
|
8810
8849
|
throw new Error("useAuthContext must be used within an <AppAuthProvider>");
|
|
8811
8850
|
}
|
|
8812
8851
|
return ctx;
|
|
8813
8852
|
}
|
|
8814
|
-
var WalletCenterContext =
|
|
8853
|
+
var WalletCenterContext = React55.createContext(null);
|
|
8815
8854
|
function WalletCenterProvider({ children }) {
|
|
8816
|
-
const [isOpen, setIsOpen] =
|
|
8817
|
-
const [requestedView, setRequestedView] =
|
|
8818
|
-
const [host, setHostElement] =
|
|
8819
|
-
const [hostOptions, setHostOptions] =
|
|
8820
|
-
const [hostTitle, setHostTitle] =
|
|
8821
|
-
const setHost =
|
|
8855
|
+
const [isOpen, setIsOpen] = React55.useState(false);
|
|
8856
|
+
const [requestedView, setRequestedView] = React55.useState("menu");
|
|
8857
|
+
const [host, setHostElement] = React55.useState(null);
|
|
8858
|
+
const [hostOptions, setHostOptions] = React55.useState({});
|
|
8859
|
+
const [hostTitle, setHostTitle] = React55.useState(null);
|
|
8860
|
+
const setHost = React55.useCallback((next) => {
|
|
8822
8861
|
setHostElement((current) => {
|
|
8823
8862
|
if (current === next) return current;
|
|
8824
8863
|
if (!next) setHostTitle(null);
|
|
8825
8864
|
return next;
|
|
8826
8865
|
});
|
|
8827
8866
|
}, []);
|
|
8828
|
-
const openWalletCenter =
|
|
8867
|
+
const openWalletCenter = React55.useCallback((view = "menu") => {
|
|
8829
8868
|
setRequestedView(view);
|
|
8830
8869
|
setIsOpen(true);
|
|
8831
8870
|
}, []);
|
|
8832
|
-
const closeWalletCenter =
|
|
8871
|
+
const closeWalletCenter = React55.useCallback(() => {
|
|
8833
8872
|
setIsOpen(false);
|
|
8834
8873
|
setRequestedView("menu");
|
|
8835
8874
|
}, []);
|
|
8836
|
-
const value =
|
|
8875
|
+
const value = React55.useMemo(
|
|
8837
8876
|
() => ({ isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, setHostOptions, hostTitle, setHostTitle }),
|
|
8838
8877
|
[isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, hostTitle]
|
|
8839
8878
|
);
|
|
8840
8879
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletCenterContext.Provider, { value, children });
|
|
8841
8880
|
}
|
|
8842
8881
|
function useWalletCenter() {
|
|
8843
|
-
const value =
|
|
8882
|
+
const value = React55.useContext(WalletCenterContext);
|
|
8844
8883
|
if (!value) {
|
|
8845
8884
|
throw new Error("useWalletCenter must be used within <WalletProvider>.");
|
|
8846
8885
|
}
|
|
@@ -8857,7 +8896,7 @@ init_WalletConfigContext();
|
|
|
8857
8896
|
init_WalletConfigContext();
|
|
8858
8897
|
function RedirectTo({ href, replace = true }) {
|
|
8859
8898
|
const navigate = useWalletNavigate();
|
|
8860
|
-
|
|
8899
|
+
React55.useEffect(() => {
|
|
8861
8900
|
navigate(href, { replace });
|
|
8862
8901
|
}, []);
|
|
8863
8902
|
return null;
|
|
@@ -9133,14 +9172,14 @@ var _GlobalNotificationService = class _GlobalNotificationService {
|
|
|
9133
9172
|
_GlobalNotificationService.instance = null;
|
|
9134
9173
|
var GlobalNotificationService = _GlobalNotificationService;
|
|
9135
9174
|
var globalNotificationService_default = GlobalNotificationService;
|
|
9136
|
-
var EntitySSEContext =
|
|
9175
|
+
var EntitySSEContext = React55.createContext(void 0);
|
|
9137
9176
|
var EntitySSEProvider = ({ children }) => {
|
|
9138
9177
|
const { user } = useAuthContext();
|
|
9139
|
-
const [connected, setConnected] =
|
|
9140
|
-
const [currentEntityId, setCurrentEntityId] =
|
|
9141
|
-
const unsubRef =
|
|
9142
|
-
const handlersRef =
|
|
9143
|
-
const [activityLog, setActivityLog] =
|
|
9178
|
+
const [connected, setConnected] = React55.useState(false);
|
|
9179
|
+
const [currentEntityId, setCurrentEntityId] = React55.useState(user?.id || null);
|
|
9180
|
+
const unsubRef = React55.useRef(null);
|
|
9181
|
+
const handlersRef = React55.useRef(/* @__PURE__ */ new Map());
|
|
9182
|
+
const [activityLog, setActivityLog] = React55.useState(() => {
|
|
9144
9183
|
try {
|
|
9145
9184
|
const stored = localStorage.getItem("sse_activity_log");
|
|
9146
9185
|
return stored ? JSON.parse(stored) : [];
|
|
@@ -9148,7 +9187,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9148
9187
|
return [];
|
|
9149
9188
|
}
|
|
9150
9189
|
});
|
|
9151
|
-
|
|
9190
|
+
React55.useEffect(() => {
|
|
9152
9191
|
if (user?.id) {
|
|
9153
9192
|
if (!currentEntityId) {
|
|
9154
9193
|
setCurrentEntityId(user.id);
|
|
@@ -9157,7 +9196,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9157
9196
|
setCurrentEntityId(null);
|
|
9158
9197
|
}
|
|
9159
9198
|
}, [user?.id, currentEntityId]);
|
|
9160
|
-
|
|
9199
|
+
React55.useEffect(() => {
|
|
9161
9200
|
const handleEntitySwitch = (event) => {
|
|
9162
9201
|
const { actingAs } = event.detail;
|
|
9163
9202
|
if (!actingAs) return;
|
|
@@ -9182,7 +9221,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9182
9221
|
window.removeEventListener("entitySwitched", handleEntitySwitch);
|
|
9183
9222
|
};
|
|
9184
9223
|
}, [currentEntityId]);
|
|
9185
|
-
|
|
9224
|
+
React55.useEffect(() => {
|
|
9186
9225
|
if (!currentEntityId) return;
|
|
9187
9226
|
unsubRef.current?.();
|
|
9188
9227
|
const unsub = subscribeEntityEvents(
|
|
@@ -9282,7 +9321,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9282
9321
|
setConnected(false);
|
|
9283
9322
|
};
|
|
9284
9323
|
}, [currentEntityId]);
|
|
9285
|
-
const subscribeToEvent =
|
|
9324
|
+
const subscribeToEvent = React55.useCallback(
|
|
9286
9325
|
(eventType, handler) => {
|
|
9287
9326
|
if (!handlersRef.current.has(eventType)) {
|
|
9288
9327
|
handlersRef.current.set(eventType, /* @__PURE__ */ new Set());
|
|
@@ -9308,7 +9347,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9308
9347
|
return /* @__PURE__ */ jsxRuntime.jsx(EntitySSEContext.Provider, { value: contextValue, children });
|
|
9309
9348
|
};
|
|
9310
9349
|
var useEntitySSE = () => {
|
|
9311
|
-
const context =
|
|
9350
|
+
const context = React55.useContext(EntitySSEContext);
|
|
9312
9351
|
if (context === void 0) {
|
|
9313
9352
|
throw new Error("useEntitySSE must be used within an EntitySSEProvider");
|
|
9314
9353
|
}
|
|
@@ -9537,19 +9576,19 @@ var GroupOwnershipPanel = ({
|
|
|
9537
9576
|
onChanged,
|
|
9538
9577
|
className = ""
|
|
9539
9578
|
}) => {
|
|
9540
|
-
const [relationships, setRelationships] =
|
|
9541
|
-
const [parentGroupId, setParentGroupId] =
|
|
9542
|
-
const [loading, setLoading] =
|
|
9543
|
-
const [submittingId, setSubmittingId] =
|
|
9544
|
-
const [error, setError] =
|
|
9579
|
+
const [relationships, setRelationships] = React55.useState([]);
|
|
9580
|
+
const [parentGroupId, setParentGroupId] = React55.useState("");
|
|
9581
|
+
const [loading, setLoading] = React55.useState(false);
|
|
9582
|
+
const [submittingId, setSubmittingId] = React55.useState(null);
|
|
9583
|
+
const [error, setError] = React55.useState(null);
|
|
9545
9584
|
const isOwner = currentRole === "owner";
|
|
9546
9585
|
const isDirectChildContext = activeDirectGroupId === childGroup.id;
|
|
9547
9586
|
const canMutate = isOwner && isDirectChildContext && accountReady && Boolean(chainId);
|
|
9548
|
-
const labelById =
|
|
9587
|
+
const labelById = React55.useMemo(
|
|
9549
9588
|
() => new Map(availableParentGroups.map((group) => [group.id, group.name])),
|
|
9550
9589
|
[availableParentGroups]
|
|
9551
9590
|
);
|
|
9552
|
-
const loadRelationships =
|
|
9591
|
+
const loadRelationships = React55.useCallback(async () => {
|
|
9553
9592
|
if (!chainId) {
|
|
9554
9593
|
setRelationships([]);
|
|
9555
9594
|
return;
|
|
@@ -9569,7 +9608,7 @@ var GroupOwnershipPanel = ({
|
|
|
9569
9608
|
setLoading(false);
|
|
9570
9609
|
}
|
|
9571
9610
|
}, [chainId, childGroup.id]);
|
|
9572
|
-
|
|
9611
|
+
React55.useEffect(() => {
|
|
9573
9612
|
void loadRelationships();
|
|
9574
9613
|
}, [loadRelationships]);
|
|
9575
9614
|
const commit = async (relationship) => {
|
|
@@ -9936,7 +9975,7 @@ function writeStoredPendingSponsorship(pending) {
|
|
|
9936
9975
|
} catch {
|
|
9937
9976
|
}
|
|
9938
9977
|
}
|
|
9939
|
-
var WizardContext =
|
|
9978
|
+
var WizardContext = React55.createContext(null);
|
|
9940
9979
|
function WizardProvider({
|
|
9941
9980
|
initialPathname = "/onboarding",
|
|
9942
9981
|
onComplete,
|
|
@@ -9946,18 +9985,18 @@ function WizardProvider({
|
|
|
9946
9985
|
}) {
|
|
9947
9986
|
const { onNavigate: hostNavigate, ...restConfig } = useWalletConfig();
|
|
9948
9987
|
const { bootstrapSession } = useAuth();
|
|
9949
|
-
const [pendingSponsorship, setPendingSponsorship] =
|
|
9950
|
-
const [pathname, setPathname] =
|
|
9988
|
+
const [pendingSponsorship, setPendingSponsorship] = React55.useState(readStoredPendingSponsorship);
|
|
9989
|
+
const [pathname, setPathname] = React55.useState(
|
|
9951
9990
|
() => pendingSponsorship ? "/onboarding/sponsorship" : initialPathname
|
|
9952
9991
|
);
|
|
9953
|
-
const [state, setStateValue] =
|
|
9954
|
-
const [planSelection, setPlanSelection] =
|
|
9992
|
+
const [state, setStateValue] = React55.useState(void 0);
|
|
9993
|
+
const [planSelection, setPlanSelection] = React55.useState(
|
|
9955
9994
|
readOnboardingPlanSelectionHint
|
|
9956
9995
|
);
|
|
9957
|
-
const pendingSponsorshipRef =
|
|
9996
|
+
const pendingSponsorshipRef = React55__default.default.useRef(
|
|
9958
9997
|
pendingSponsorship
|
|
9959
9998
|
);
|
|
9960
|
-
const stageSponsorship =
|
|
9999
|
+
const stageSponsorship = React55.useCallback((groupId, destination) => {
|
|
9961
10000
|
const normalizedGroupId = canonicalSponsorGroupId(groupId);
|
|
9962
10001
|
const userId = currentRegularUserId();
|
|
9963
10002
|
if (!userId) {
|
|
@@ -9975,7 +10014,7 @@ function WizardProvider({
|
|
|
9975
10014
|
writeStoredPendingSponsorship(next);
|
|
9976
10015
|
return next;
|
|
9977
10016
|
}, []);
|
|
9978
|
-
const selectPlan =
|
|
10017
|
+
const selectPlan = React55.useCallback((plan, catalogVersion) => {
|
|
9979
10018
|
const next = {
|
|
9980
10019
|
planId: plan.id,
|
|
9981
10020
|
ownerType: plan.owner_type,
|
|
@@ -9985,7 +10024,7 @@ function WizardProvider({
|
|
|
9985
10024
|
setPlanSelection(next);
|
|
9986
10025
|
writeOnboardingPlanSelectionHint(next);
|
|
9987
10026
|
}, []);
|
|
9988
|
-
const hydratePlanSelection =
|
|
10027
|
+
const hydratePlanSelection = React55.useCallback(
|
|
9989
10028
|
(plan, catalogVersion, selectedAt = Date.now()) => {
|
|
9990
10029
|
setPlanSelection({
|
|
9991
10030
|
planId: plan.id,
|
|
@@ -9997,11 +10036,11 @@ function WizardProvider({
|
|
|
9997
10036
|
},
|
|
9998
10037
|
[]
|
|
9999
10038
|
);
|
|
10000
|
-
const clearPlanSelection =
|
|
10039
|
+
const clearPlanSelection = React55.useCallback(() => {
|
|
10001
10040
|
setPlanSelection(null);
|
|
10002
10041
|
clearOnboardingPlanSelectionHint();
|
|
10003
10042
|
}, []);
|
|
10004
|
-
const syncPlanIntent =
|
|
10043
|
+
const syncPlanIntent = React55.useCallback(async () => {
|
|
10005
10044
|
if (!planSelection || !exports.authService.isAuthenticated()) return null;
|
|
10006
10045
|
const response = await onboardingPlanService.selectIntent(planSelection.planId);
|
|
10007
10046
|
const current = response.intent?.current_plan;
|
|
@@ -10017,7 +10056,7 @@ function WizardProvider({
|
|
|
10017
10056
|
}
|
|
10018
10057
|
return response;
|
|
10019
10058
|
}, [planSelection]);
|
|
10020
|
-
const navigate =
|
|
10059
|
+
const navigate = React55.useCallback(
|
|
10021
10060
|
(to, opts) => {
|
|
10022
10061
|
if (to.startsWith("/onboarding")) {
|
|
10023
10062
|
setPathname(to);
|
|
@@ -10047,7 +10086,7 @@ function WizardProvider({
|
|
|
10047
10086
|
},
|
|
10048
10087
|
[clearPlanSelection, hostNavigate, onComplete]
|
|
10049
10088
|
);
|
|
10050
|
-
const continueAuthenticated =
|
|
10089
|
+
const continueAuthenticated = React55.useCallback(async (destination, expectedSponsor) => {
|
|
10051
10090
|
await bootstrapSession();
|
|
10052
10091
|
if (expectedSponsor && !exports.authService.hasExactSponsoredSession(expectedSponsor)) {
|
|
10053
10092
|
throw new Error(
|
|
@@ -10062,12 +10101,12 @@ function WizardProvider({
|
|
|
10062
10101
|
}
|
|
10063
10102
|
navigate(destination);
|
|
10064
10103
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10065
|
-
const discardSponsorship =
|
|
10104
|
+
const discardSponsorship = React55.useCallback(() => {
|
|
10066
10105
|
pendingSponsorshipRef.current = null;
|
|
10067
10106
|
setPendingSponsorship(null);
|
|
10068
10107
|
clearStoredPendingSponsorship();
|
|
10069
10108
|
}, []);
|
|
10070
|
-
const finishSponsorship =
|
|
10109
|
+
const finishSponsorship = React55.useCallback(async () => {
|
|
10071
10110
|
const pending = pendingSponsorshipRef.current;
|
|
10072
10111
|
if (!pending) {
|
|
10073
10112
|
throw new Error("No platform sponsorship continuation is awaiting completion.");
|
|
@@ -10093,7 +10132,7 @@ function WizardProvider({
|
|
|
10093
10132
|
clearStoredPendingSponsorship();
|
|
10094
10133
|
navigate(pending.destination);
|
|
10095
10134
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10096
|
-
const completeAuthentication =
|
|
10135
|
+
const completeAuthentication = React55.useCallback(async (result, destination, effectivePlatform) => {
|
|
10097
10136
|
const currentUserId = currentRegularUserId();
|
|
10098
10137
|
if (!currentUserId || currentUserId !== result.user_id) {
|
|
10099
10138
|
throw new Error("The returned authentication session did not match the signed-in user.");
|
|
@@ -10131,11 +10170,11 @@ function WizardProvider({
|
|
|
10131
10170
|
}
|
|
10132
10171
|
await continueAuthenticated(destination);
|
|
10133
10172
|
}, [bootstrapSession, continueAuthenticated, finishSponsorship, stageSponsorship]);
|
|
10134
|
-
const params =
|
|
10173
|
+
const params = React55.useMemo(() => {
|
|
10135
10174
|
const provider = matchProviderParam(pathname);
|
|
10136
10175
|
return provider ? { provider } : {};
|
|
10137
10176
|
}, [pathname]);
|
|
10138
|
-
const wizardValue =
|
|
10177
|
+
const wizardValue = React55.useMemo(
|
|
10139
10178
|
() => ({
|
|
10140
10179
|
pathname,
|
|
10141
10180
|
state,
|
|
@@ -10173,7 +10212,7 @@ function WizardProvider({
|
|
|
10173
10212
|
discardSponsorship
|
|
10174
10213
|
]
|
|
10175
10214
|
);
|
|
10176
|
-
const overriddenConfig =
|
|
10215
|
+
const overriddenConfig = React55.useMemo(
|
|
10177
10216
|
() => ({
|
|
10178
10217
|
...restConfig,
|
|
10179
10218
|
onNavigate: (href, opts) => navigate(href, { replace: opts?.replace })
|
|
@@ -10201,7 +10240,7 @@ function matchProviderParam(pathname) {
|
|
|
10201
10240
|
return match ? match[1] : void 0;
|
|
10202
10241
|
}
|
|
10203
10242
|
function useWizard() {
|
|
10204
|
-
const ctx =
|
|
10243
|
+
const ctx = React55.useContext(WizardContext);
|
|
10205
10244
|
if (!ctx) {
|
|
10206
10245
|
throw new Error(
|
|
10207
10246
|
"Wizard hooks must be used inside <WizardProvider> (mounted by <OnboardingWizard>)."
|
|
@@ -10219,7 +10258,7 @@ function useWizardParams() {
|
|
|
10219
10258
|
}
|
|
10220
10259
|
function WizardRedirect({ to, replace }) {
|
|
10221
10260
|
const navigate = useWizardNavigate();
|
|
10222
|
-
|
|
10261
|
+
React55.useEffect(() => {
|
|
10223
10262
|
navigate(to, { replace });
|
|
10224
10263
|
}, []);
|
|
10225
10264
|
return null;
|
|
@@ -10336,20 +10375,20 @@ var DEFAULT_MESSAGES = {
|
|
|
10336
10375
|
retryButtonText: "Try again"
|
|
10337
10376
|
}
|
|
10338
10377
|
};
|
|
10339
|
-
var BrandingContext =
|
|
10378
|
+
var BrandingContext = React55.createContext(null);
|
|
10340
10379
|
var ROOT_BRANDING = {
|
|
10341
10380
|
logo: DEFAULT_LOGO(),
|
|
10342
10381
|
messages: DEFAULT_MESSAGES
|
|
10343
10382
|
};
|
|
10344
10383
|
function useBranding() {
|
|
10345
|
-
return
|
|
10384
|
+
return React55.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10346
10385
|
}
|
|
10347
10386
|
function BrandingProvider({
|
|
10348
10387
|
branding,
|
|
10349
10388
|
children
|
|
10350
10389
|
}) {
|
|
10351
|
-
const parent =
|
|
10352
|
-
const value =
|
|
10390
|
+
const parent = React55.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10391
|
+
const value = React55.useMemo(() => {
|
|
10353
10392
|
if (!branding) return parent;
|
|
10354
10393
|
const { logo, logoSize, messages } = branding;
|
|
10355
10394
|
return {
|
|
@@ -10497,11 +10536,11 @@ init_ProviderConfigContext();
|
|
|
10497
10536
|
// src/react/useOnboardingRouting.ts
|
|
10498
10537
|
init_authService();
|
|
10499
10538
|
function useOnboardingState2() {
|
|
10500
|
-
const [state, setState] =
|
|
10539
|
+
const [state, setState] = React55.useState({
|
|
10501
10540
|
step: "unknown",
|
|
10502
10541
|
isLoading: true
|
|
10503
10542
|
});
|
|
10504
|
-
|
|
10543
|
+
React55.useEffect(() => {
|
|
10505
10544
|
let cancelled = false;
|
|
10506
10545
|
(async () => {
|
|
10507
10546
|
if (!exports.authService.isAuthenticated()) {
|
|
@@ -10677,11 +10716,11 @@ function SelectPlan({
|
|
|
10677
10716
|
const wizardPlatform = useWizardPlatform();
|
|
10678
10717
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
10679
10718
|
const { isAuthenticated, isLoading: authLoading } = useAuth();
|
|
10680
|
-
const [catalog, setCatalog] =
|
|
10681
|
-
const [error, setError] =
|
|
10682
|
-
const [attempt, setAttempt] =
|
|
10719
|
+
const [catalog, setCatalog] = React55.useState(null);
|
|
10720
|
+
const [error, setError] = React55.useState(null);
|
|
10721
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
10683
10722
|
const platformTagged = !!(wizardPlatform ?? config?.platform?.group_id);
|
|
10684
|
-
|
|
10723
|
+
React55.useEffect(() => {
|
|
10685
10724
|
if (configLoading || authLoading || platformTagged || isAuthenticated) return;
|
|
10686
10725
|
let disposed = false;
|
|
10687
10726
|
setCatalog(null);
|
|
@@ -10697,7 +10736,7 @@ function SelectPlan({
|
|
|
10697
10736
|
disposed = true;
|
|
10698
10737
|
};
|
|
10699
10738
|
}, [attempt, authLoading, configLoading, isAuthenticated, platformTagged]);
|
|
10700
|
-
|
|
10739
|
+
React55.useEffect(() => {
|
|
10701
10740
|
if (platformTagged || catalog && !catalog.prepaid_credits_enabled) {
|
|
10702
10741
|
clearPlanSelection();
|
|
10703
10742
|
}
|
|
@@ -10894,9 +10933,9 @@ async function signInWithPasskey(opts = {}) {
|
|
|
10894
10933
|
return await res.json();
|
|
10895
10934
|
}
|
|
10896
10935
|
function PasskeyMethodButton({ mode, chainId, onSuccess, onError, platform }) {
|
|
10897
|
-
const [supported, setSupported] =
|
|
10898
|
-
const [busy, setBusy] =
|
|
10899
|
-
|
|
10936
|
+
const [supported, setSupported] = React55.useState(true);
|
|
10937
|
+
const [busy, setBusy] = React55.useState(false);
|
|
10938
|
+
React55.useEffect(() => {
|
|
10900
10939
|
const ok = typeof window !== "undefined" && !!window.PublicKeyCredential;
|
|
10901
10940
|
setSupported(ok);
|
|
10902
10941
|
}, []);
|
|
@@ -10987,9 +11026,9 @@ var ChooserCard = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
10987
11026
|
onSelect
|
|
10988
11027
|
}
|
|
10989
11028
|
);
|
|
10990
|
-
var LazyAvererSignupFlow =
|
|
11029
|
+
var LazyAvererSignupFlow = React55.lazy(() => Promise.resolve().then(() => (init_SignupFlow(), SignupFlow_exports)));
|
|
10991
11030
|
var SignupFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10992
|
-
|
|
11031
|
+
React55.Suspense,
|
|
10993
11032
|
{
|
|
10994
11033
|
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-screen flex items-center justify-center bg-background text-text-secondary text-[13px]", children: "Loading Averer\u2026" }),
|
|
10995
11034
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSignupFlow, { ...props })
|
|
@@ -11006,9 +11045,9 @@ var AvererAuth = {
|
|
|
11006
11045
|
// squeezed into LoginLayout's narrow column.
|
|
11007
11046
|
customLayout: true
|
|
11008
11047
|
};
|
|
11009
|
-
var LazyAvererKycFlow =
|
|
11048
|
+
var LazyAvererKycFlow = React55.lazy(() => Promise.resolve().then(() => (init_KycFlow(), KycFlow_exports)));
|
|
11010
11049
|
var KycFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11011
|
-
|
|
11050
|
+
React55.Suspense,
|
|
11012
11051
|
{
|
|
11013
11052
|
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading Averer\u2026" }),
|
|
11014
11053
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererKycFlow, { ...props })
|
|
@@ -11027,8 +11066,8 @@ function SdkGate({
|
|
|
11027
11066
|
hasConfig = true,
|
|
11028
11067
|
configHint
|
|
11029
11068
|
}) {
|
|
11030
|
-
const [state, setState] =
|
|
11031
|
-
|
|
11069
|
+
const [state, setState] = React55.useState({ status: "loading" });
|
|
11070
|
+
React55.useEffect(() => {
|
|
11032
11071
|
let cancelled = false;
|
|
11033
11072
|
(async () => {
|
|
11034
11073
|
try {
|
|
@@ -11168,8 +11207,8 @@ var DynamicCompleter = ({ sdk, action, onError }) => {
|
|
|
11168
11207
|
const ctx = sdk.useDynamicContext();
|
|
11169
11208
|
const wallet = ctx.primaryWallet;
|
|
11170
11209
|
const dynamicUser = ctx.user;
|
|
11171
|
-
const [done, setDone] =
|
|
11172
|
-
|
|
11210
|
+
const [done, setDone] = React55__default.default.useState(false);
|
|
11211
|
+
React55__default.default.useEffect(() => {
|
|
11173
11212
|
if (done || !wallet?.address) return;
|
|
11174
11213
|
setDone(true);
|
|
11175
11214
|
(async () => {
|
|
@@ -11264,9 +11303,9 @@ var ChooserCard3 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11264
11303
|
}
|
|
11265
11304
|
);
|
|
11266
11305
|
var SignupFlow4 = ({ onComplete, onError, platform }) => {
|
|
11267
|
-
const [email, setEmail] =
|
|
11268
|
-
const [password, setPassword] =
|
|
11269
|
-
const [submitting, setSubmitting] =
|
|
11306
|
+
const [email, setEmail] = React55.useState("");
|
|
11307
|
+
const [password, setPassword] = React55.useState("");
|
|
11308
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
11270
11309
|
async function submit(e) {
|
|
11271
11310
|
e.preventDefault();
|
|
11272
11311
|
setSubmitting(true);
|
|
@@ -11422,7 +11461,7 @@ var ChooserCard4 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11422
11461
|
}
|
|
11423
11462
|
);
|
|
11424
11463
|
var SignupFlow5 = ({ onComplete, onError, platform }) => {
|
|
11425
|
-
const [busy, setBusy] =
|
|
11464
|
+
const [busy, setBusy] = React55.useState(false);
|
|
11426
11465
|
async function trigger() {
|
|
11427
11466
|
setBusy(true);
|
|
11428
11467
|
try {
|
|
@@ -11594,8 +11633,8 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11594
11633
|
const settings = config?.kyc.settings[providerId];
|
|
11595
11634
|
const publishableKey = settings?.publishable_key;
|
|
11596
11635
|
const requiredForCompletion = settings?.required_for_completion ?? false;
|
|
11597
|
-
const [stage, setStage] =
|
|
11598
|
-
|
|
11636
|
+
const [stage, setStage] = React55__default.default.useState({ kind: "idle" });
|
|
11637
|
+
React55__default.default.useEffect(() => {
|
|
11599
11638
|
let cancelled = false;
|
|
11600
11639
|
(async () => {
|
|
11601
11640
|
try {
|
|
@@ -11619,7 +11658,7 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11619
11658
|
cancelled = true;
|
|
11620
11659
|
};
|
|
11621
11660
|
}, []);
|
|
11622
|
-
|
|
11661
|
+
React55__default.default.useEffect(() => {
|
|
11623
11662
|
if (stage.kind !== "pending-poll") return;
|
|
11624
11663
|
let cancelled = false;
|
|
11625
11664
|
const pollOnce = async () => {
|
|
@@ -11871,14 +11910,14 @@ function useIdentityStatusPoll(opts) {
|
|
|
11871
11910
|
provider,
|
|
11872
11911
|
credentialType
|
|
11873
11912
|
} = opts;
|
|
11874
|
-
const [stuckHint, setStuckHint] =
|
|
11875
|
-
const onVerifiedRef =
|
|
11876
|
-
const onRejectedRef =
|
|
11877
|
-
|
|
11913
|
+
const [stuckHint, setStuckHint] = React55__default.default.useState(false);
|
|
11914
|
+
const onVerifiedRef = React55__default.default.useRef(onVerified);
|
|
11915
|
+
const onRejectedRef = React55__default.default.useRef(onRejected);
|
|
11916
|
+
React55__default.default.useEffect(() => {
|
|
11878
11917
|
onVerifiedRef.current = onVerified;
|
|
11879
11918
|
onRejectedRef.current = onRejected;
|
|
11880
11919
|
}, [onVerified, onRejected]);
|
|
11881
|
-
|
|
11920
|
+
React55__default.default.useEffect(() => {
|
|
11882
11921
|
if (!active) {
|
|
11883
11922
|
setStuckHint(false);
|
|
11884
11923
|
return;
|
|
@@ -12016,12 +12055,12 @@ var KycFlow4 = ({ onComplete, onError, instanceId, subject }) => {
|
|
|
12016
12055
|
const groupId = subject?.kind === "group" ? subject.id : void 0;
|
|
12017
12056
|
const configuredLevel = config?.kyc.settings[providerId]?.level_name?.trim();
|
|
12018
12057
|
const levelName = configuredLevel || "id-and-liveness";
|
|
12019
|
-
const [token, setToken] =
|
|
12020
|
-
const [stage, setStage] =
|
|
12021
|
-
const [attempt, setAttempt] =
|
|
12022
|
-
const submittedRef =
|
|
12023
|
-
const applicantIdRef =
|
|
12024
|
-
|
|
12058
|
+
const [token, setToken] = React55__default.default.useState(null);
|
|
12059
|
+
const [stage, setStage] = React55__default.default.useState({ kind: "init" });
|
|
12060
|
+
const [attempt, setAttempt] = React55__default.default.useState(0);
|
|
12061
|
+
const submittedRef = React55__default.default.useRef(false);
|
|
12062
|
+
const applicantIdRef = React55__default.default.useRef(void 0);
|
|
12063
|
+
React55__default.default.useEffect(() => {
|
|
12025
12064
|
let cancelled = false;
|
|
12026
12065
|
submittedRef.current = false;
|
|
12027
12066
|
(async () => {
|
|
@@ -12251,8 +12290,8 @@ function OnboardingChooseMethod({ chrome } = {}) {
|
|
|
12251
12290
|
const { config, isLoading, error: configError } = useProviderConfig();
|
|
12252
12291
|
const wizardPlatform = useWizardPlatform();
|
|
12253
12292
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12254
|
-
const [busyId, setBusyId] =
|
|
12255
|
-
const [error, setError] =
|
|
12293
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
12294
|
+
const [error, setError] = React55.useState(null);
|
|
12256
12295
|
if (isLoading) {
|
|
12257
12296
|
return /* @__PURE__ */ jsxRuntime.jsx(StepShell, { chrome, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading sign-up options\u2026" }) });
|
|
12258
12297
|
}
|
|
@@ -12336,6 +12375,47 @@ function OnboardingChooseMethod({ chrome } = {}) {
|
|
|
12336
12375
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] text-text-secondary text-center pt-2", children: messages.legal.agreementText })
|
|
12337
12376
|
] }) });
|
|
12338
12377
|
}
|
|
12378
|
+
function FloatField({
|
|
12379
|
+
label,
|
|
12380
|
+
type,
|
|
12381
|
+
value,
|
|
12382
|
+
onChange,
|
|
12383
|
+
autoComplete,
|
|
12384
|
+
required,
|
|
12385
|
+
minLength,
|
|
12386
|
+
maxLength,
|
|
12387
|
+
adornment,
|
|
12388
|
+
disabled
|
|
12389
|
+
}) {
|
|
12390
|
+
const id = React55.useId();
|
|
12391
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12392
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12393
|
+
"input",
|
|
12394
|
+
{
|
|
12395
|
+
id,
|
|
12396
|
+
type,
|
|
12397
|
+
required,
|
|
12398
|
+
minLength,
|
|
12399
|
+
maxLength,
|
|
12400
|
+
autoComplete,
|
|
12401
|
+
placeholder: " ",
|
|
12402
|
+
value,
|
|
12403
|
+
disabled,
|
|
12404
|
+
onChange: (e) => onChange(e.target.value),
|
|
12405
|
+
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60 disabled:cursor-not-allowed\n "
|
|
12406
|
+
}
|
|
12407
|
+
),
|
|
12408
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12409
|
+
"label",
|
|
12410
|
+
{
|
|
12411
|
+
htmlFor: id,
|
|
12412
|
+
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12413
|
+
children: label
|
|
12414
|
+
}
|
|
12415
|
+
),
|
|
12416
|
+
adornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-0 top-4 pointer-events-none", children: adornment })
|
|
12417
|
+
] });
|
|
12418
|
+
}
|
|
12339
12419
|
init_authService();
|
|
12340
12420
|
init_tokenManager();
|
|
12341
12421
|
init_ProviderConfigContext();
|
|
@@ -12360,16 +12440,16 @@ function OnboardingEmailSignup({ chrome } = {}) {
|
|
|
12360
12440
|
const { config } = useProviderConfig();
|
|
12361
12441
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12362
12442
|
const platform = wizardPlatform ?? config?.platform?.group_id;
|
|
12363
|
-
const [email, setEmail] =
|
|
12364
|
-
const [password, setPassword] =
|
|
12365
|
-
const [confirmPassword, setConfirmPassword] =
|
|
12366
|
-
const [phase, setPhase] =
|
|
12443
|
+
const [email, setEmail] = React55.useState("");
|
|
12444
|
+
const [password, setPassword] = React55.useState("");
|
|
12445
|
+
const [confirmPassword, setConfirmPassword] = React55.useState("");
|
|
12446
|
+
const [phase, setPhase] = React55.useState(null);
|
|
12367
12447
|
const submitting = phase !== null;
|
|
12368
|
-
const [error, setError] =
|
|
12369
|
-
const [emailExists, setEmailExists] =
|
|
12448
|
+
const [error, setError] = React55.useState(null);
|
|
12449
|
+
const [emailExists, setEmailExists] = React55.useState(false);
|
|
12370
12450
|
const invite = useWizardInvite();
|
|
12371
12451
|
const emailLocked = !!invite?.email;
|
|
12372
|
-
|
|
12452
|
+
React55.useEffect(() => {
|
|
12373
12453
|
if (invite?.email) setEmail(invite.email);
|
|
12374
12454
|
}, [invite?.email]);
|
|
12375
12455
|
function validate() {
|
|
@@ -12573,61 +12653,23 @@ function OnboardingEmailSignup({ chrome } = {}) {
|
|
|
12573
12653
|
] })
|
|
12574
12654
|
] }) });
|
|
12575
12655
|
}
|
|
12576
|
-
function FloatField({
|
|
12577
|
-
label,
|
|
12578
|
-
type,
|
|
12579
|
-
value,
|
|
12580
|
-
onChange,
|
|
12581
|
-
autoComplete,
|
|
12582
|
-
required,
|
|
12583
|
-
minLength,
|
|
12584
|
-
maxLength,
|
|
12585
|
-
adornment,
|
|
12586
|
-
disabled
|
|
12587
|
-
}) {
|
|
12588
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12589
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12590
|
-
"input",
|
|
12591
|
-
{
|
|
12592
|
-
type,
|
|
12593
|
-
required,
|
|
12594
|
-
minLength,
|
|
12595
|
-
maxLength,
|
|
12596
|
-
autoComplete,
|
|
12597
|
-
placeholder: " ",
|
|
12598
|
-
value,
|
|
12599
|
-
disabled,
|
|
12600
|
-
onChange: (e) => onChange(e.target.value),
|
|
12601
|
-
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60 disabled:cursor-not-allowed\n "
|
|
12602
|
-
}
|
|
12603
|
-
),
|
|
12604
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12605
|
-
"span",
|
|
12606
|
-
{
|
|
12607
|
-
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12608
|
-
children: label
|
|
12609
|
-
}
|
|
12610
|
-
),
|
|
12611
|
-
adornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-0 top-4 pointer-events-none", children: adornment })
|
|
12612
|
-
] });
|
|
12613
|
-
}
|
|
12614
12656
|
init_authService();
|
|
12615
12657
|
init_onboardingClient();
|
|
12616
12658
|
function EmailVerify({ chrome } = {}) {
|
|
12617
12659
|
const navigate = useWizardNavigate();
|
|
12618
12660
|
const { refreshUser, logout } = useAuth();
|
|
12619
|
-
const [status, setStatus] =
|
|
12620
|
-
const [phase, setPhase] =
|
|
12621
|
-
const [code, setCode] =
|
|
12622
|
-
const [newEmail, setNewEmail] =
|
|
12623
|
-
const [notice, setNotice] =
|
|
12624
|
-
const [error, setError] =
|
|
12625
|
-
const autoStartRef =
|
|
12626
|
-
const completionTimerRef =
|
|
12661
|
+
const [status, setStatus] = React55.useState(null);
|
|
12662
|
+
const [phase, setPhase] = React55.useState("loading");
|
|
12663
|
+
const [code, setCode] = React55.useState("");
|
|
12664
|
+
const [newEmail, setNewEmail] = React55.useState("");
|
|
12665
|
+
const [notice, setNotice] = React55.useState(null);
|
|
12666
|
+
const [error, setError] = React55.useState(null);
|
|
12667
|
+
const autoStartRef = React55.useRef(false);
|
|
12668
|
+
const completionTimerRef = React55.useRef(null);
|
|
12627
12669
|
const email = status?.email ?? "";
|
|
12628
|
-
const maskedEmail =
|
|
12670
|
+
const maskedEmail = React55.useMemo(() => maskEmail(email), [email]);
|
|
12629
12671
|
const busy = phase === "sending" || phase === "checking" || phase === "updating-email";
|
|
12630
|
-
const completeSoon =
|
|
12672
|
+
const completeSoon = React55.useCallback((message) => {
|
|
12631
12673
|
setNotice(message ?? "Email confirmed. Taking you to the next setup step.");
|
|
12632
12674
|
setError(null);
|
|
12633
12675
|
setPhase("success");
|
|
@@ -12637,7 +12679,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12637
12679
|
navigate("/onboarding/wallets");
|
|
12638
12680
|
}, 850);
|
|
12639
12681
|
}, [navigate]);
|
|
12640
|
-
const loadStatus =
|
|
12682
|
+
const loadStatus = React55.useCallback(async () => {
|
|
12641
12683
|
const next = await getMyEmailVerificationStatus();
|
|
12642
12684
|
setStatus(next);
|
|
12643
12685
|
if (next.verified) {
|
|
@@ -12647,7 +12689,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12647
12689
|
setPhase("ready");
|
|
12648
12690
|
return next;
|
|
12649
12691
|
}, [completeSoon]);
|
|
12650
|
-
const sendCode =
|
|
12692
|
+
const sendCode = React55.useCallback(async () => {
|
|
12651
12693
|
setPhase("sending");
|
|
12652
12694
|
setError(null);
|
|
12653
12695
|
try {
|
|
@@ -12673,7 +12715,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12673
12715
|
setPhase("ready");
|
|
12674
12716
|
}
|
|
12675
12717
|
}, []);
|
|
12676
|
-
|
|
12718
|
+
React55.useEffect(() => {
|
|
12677
12719
|
let cancelled = false;
|
|
12678
12720
|
(async () => {
|
|
12679
12721
|
setPhase("loading");
|
|
@@ -12698,7 +12740,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12698
12740
|
if (completionTimerRef.current) window.clearTimeout(completionTimerRef.current);
|
|
12699
12741
|
};
|
|
12700
12742
|
}, [completeSoon]);
|
|
12701
|
-
|
|
12743
|
+
React55.useEffect(() => {
|
|
12702
12744
|
if (!status || status.verified || status.is_synthetic || status.pending || autoStartRef.current) return;
|
|
12703
12745
|
autoStartRef.current = true;
|
|
12704
12746
|
void sendCode();
|
|
@@ -12771,7 +12813,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12771
12813
|
/* @__PURE__ */ jsxRuntime.jsx(ProgressRail, { phase, verified: !!status?.verified || phase === "success" }),
|
|
12772
12814
|
phase === "loading" && !status ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-border-default bg-surface-alt/70 p-4 text-center text-[12px] text-text-secondary", children: "Checking email status..." }) : phase === "success" ? /* @__PURE__ */ jsxRuntime.jsx(SuccessPanel, { notice }) : status?.is_synthetic ? /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submitRealEmail, className: "space-y-4", children: [
|
|
12773
12815
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12774
|
-
|
|
12816
|
+
FloatField,
|
|
12775
12817
|
{
|
|
12776
12818
|
label: "Email",
|
|
12777
12819
|
type: "email",
|
|
@@ -12894,38 +12936,6 @@ function CodeField({
|
|
|
12894
12936
|
}
|
|
12895
12937
|
);
|
|
12896
12938
|
}
|
|
12897
|
-
function FloatField2({
|
|
12898
|
-
label,
|
|
12899
|
-
type,
|
|
12900
|
-
value,
|
|
12901
|
-
onChange,
|
|
12902
|
-
autoComplete,
|
|
12903
|
-
disabled,
|
|
12904
|
-
required
|
|
12905
|
-
}) {
|
|
12906
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12907
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12908
|
-
"input",
|
|
12909
|
-
{
|
|
12910
|
-
type,
|
|
12911
|
-
required,
|
|
12912
|
-
autoComplete,
|
|
12913
|
-
placeholder: " ",
|
|
12914
|
-
value,
|
|
12915
|
-
disabled,
|
|
12916
|
-
onChange: (e) => onChange(e.target.value),
|
|
12917
|
-
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60\n "
|
|
12918
|
-
}
|
|
12919
|
-
),
|
|
12920
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12921
|
-
"span",
|
|
12922
|
-
{
|
|
12923
|
-
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12924
|
-
children: label
|
|
12925
|
-
}
|
|
12926
|
-
)
|
|
12927
|
-
] });
|
|
12928
|
-
}
|
|
12929
12939
|
function friendlyEmailError(err, action) {
|
|
12930
12940
|
const message = err instanceof Error ? err.message : String(err);
|
|
12931
12941
|
if (message.includes("email delivery unavailable") || message.includes("503")) {
|
|
@@ -12975,7 +12985,7 @@ function ProviderSignup({ chrome } = {}) {
|
|
|
12975
12985
|
const { config, isLoading } = useProviderConfig();
|
|
12976
12986
|
const wizardPlatform = useWizardPlatform();
|
|
12977
12987
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12978
|
-
const [error, setError] =
|
|
12988
|
+
const [error, setError] = React55.useState(null);
|
|
12979
12989
|
if (isLoading) {
|
|
12980
12990
|
return /* @__PURE__ */ jsxRuntime.jsx(StepShell, { chrome, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading\u2026" }) });
|
|
12981
12991
|
}
|
|
@@ -13170,8 +13180,8 @@ function AvatarImageUpload({
|
|
|
13170
13180
|
hintClassName = "text-[10px] text-text-secondary",
|
|
13171
13181
|
errorClassName = "text-[11px] text-status-error-text"
|
|
13172
13182
|
}) {
|
|
13173
|
-
const inputRef =
|
|
13174
|
-
const [error, setError] =
|
|
13183
|
+
const inputRef = React55.useRef(null);
|
|
13184
|
+
const [error, setError] = React55.useState(null);
|
|
13175
13185
|
const hasPhoto = !!value;
|
|
13176
13186
|
async function handleRemove() {
|
|
13177
13187
|
setError(null);
|
|
@@ -13246,28 +13256,28 @@ function useTapToCancel({
|
|
|
13246
13256
|
cancellingLabel = "Cancelling\u2026",
|
|
13247
13257
|
onCancel
|
|
13248
13258
|
}) {
|
|
13249
|
-
const [isCancelling, setIsCancelling] =
|
|
13250
|
-
const timeoutRef =
|
|
13251
|
-
const clear =
|
|
13259
|
+
const [isCancelling, setIsCancelling] = React55.useState(false);
|
|
13260
|
+
const timeoutRef = React55.useRef(null);
|
|
13261
|
+
const clear = React55.useCallback(() => {
|
|
13252
13262
|
if (timeoutRef.current !== null) {
|
|
13253
13263
|
window.clearTimeout(timeoutRef.current);
|
|
13254
13264
|
timeoutRef.current = null;
|
|
13255
13265
|
}
|
|
13256
13266
|
}, []);
|
|
13257
|
-
const handlePointerDown =
|
|
13267
|
+
const handlePointerDown = React55.useCallback(() => {
|
|
13258
13268
|
if (!submitting) return;
|
|
13259
13269
|
timeoutRef.current = window.setTimeout(() => {
|
|
13260
13270
|
setIsCancelling(true);
|
|
13261
13271
|
}, LONG_PRESS_MS);
|
|
13262
13272
|
}, [submitting]);
|
|
13263
|
-
const handlePointerUp =
|
|
13273
|
+
const handlePointerUp = React55.useCallback(() => {
|
|
13264
13274
|
clear();
|
|
13265
13275
|
if (isCancelling && onCancel) {
|
|
13266
13276
|
onCancel();
|
|
13267
13277
|
}
|
|
13268
13278
|
setIsCancelling(false);
|
|
13269
13279
|
}, [clear, isCancelling, onCancel]);
|
|
13270
|
-
const handlePointerLeave =
|
|
13280
|
+
const handlePointerLeave = React55.useCallback(() => {
|
|
13271
13281
|
clear();
|
|
13272
13282
|
setIsCancelling(false);
|
|
13273
13283
|
}, [clear]);
|
|
@@ -13298,27 +13308,27 @@ function emailLocalPart(email) {
|
|
|
13298
13308
|
function OnboardingProfile({ chrome } = {}) {
|
|
13299
13309
|
const navigate = useWizardNavigate();
|
|
13300
13310
|
const { refreshUser } = useAuth();
|
|
13301
|
-
const [firstName, setFirstName] =
|
|
13302
|
-
const [lastName, setLastName] =
|
|
13303
|
-
const [dob, setDob] =
|
|
13304
|
-
const [addressLine1, setAddressLine1] =
|
|
13305
|
-
const [addressLine2, setAddressLine2] =
|
|
13306
|
-
const [addressCity, setAddressCity] =
|
|
13307
|
-
const [addressRegion, setAddressRegion] =
|
|
13308
|
-
const [addressPostalCode, setAddressPostalCode] =
|
|
13309
|
-
const [addressCountry, setAddressCountry] =
|
|
13310
|
-
const [displayName, setDisplayName] =
|
|
13311
|
-
const [displayNameEdited, setDisplayNameEdited] =
|
|
13312
|
-
const [submitting, setSubmitting] =
|
|
13313
|
-
const [error, setError] =
|
|
13314
|
-
const [loaded, setLoaded] =
|
|
13315
|
-
const [fallbackName, setFallbackName] =
|
|
13316
|
-
const [avatarChoice, setAvatarChoice] =
|
|
13317
|
-
const [avatarUrl, setAvatarUrl] =
|
|
13318
|
-
const [avatarTouched, setAvatarTouched] =
|
|
13319
|
-
const [avatarUrlTouched, setAvatarUrlTouched] =
|
|
13320
|
-
const [accountEmail, setAccountEmail] =
|
|
13321
|
-
|
|
13311
|
+
const [firstName, setFirstName] = React55.useState(null);
|
|
13312
|
+
const [lastName, setLastName] = React55.useState(null);
|
|
13313
|
+
const [dob, setDob] = React55.useState(null);
|
|
13314
|
+
const [addressLine1, setAddressLine1] = React55.useState(null);
|
|
13315
|
+
const [addressLine2, setAddressLine2] = React55.useState(null);
|
|
13316
|
+
const [addressCity, setAddressCity] = React55.useState(null);
|
|
13317
|
+
const [addressRegion, setAddressRegion] = React55.useState(null);
|
|
13318
|
+
const [addressPostalCode, setAddressPostalCode] = React55.useState(null);
|
|
13319
|
+
const [addressCountry, setAddressCountry] = React55.useState(null);
|
|
13320
|
+
const [displayName, setDisplayName] = React55.useState("");
|
|
13321
|
+
const [displayNameEdited, setDisplayNameEdited] = React55.useState(false);
|
|
13322
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
13323
|
+
const [error, setError] = React55.useState(null);
|
|
13324
|
+
const [loaded, setLoaded] = React55.useState(false);
|
|
13325
|
+
const [fallbackName, setFallbackName] = React55.useState("You");
|
|
13326
|
+
const [avatarChoice, setAvatarChoice] = React55.useState(null);
|
|
13327
|
+
const [avatarUrl, setAvatarUrl] = React55.useState(null);
|
|
13328
|
+
const [avatarTouched, setAvatarTouched] = React55.useState(false);
|
|
13329
|
+
const [avatarUrlTouched, setAvatarUrlTouched] = React55.useState(false);
|
|
13330
|
+
const [accountEmail, setAccountEmail] = React55.useState(null);
|
|
13331
|
+
React55.useEffect(() => {
|
|
13322
13332
|
if (!exports.authService.isAuthenticated()) {
|
|
13323
13333
|
setLoaded(true);
|
|
13324
13334
|
return;
|
|
@@ -13376,7 +13386,7 @@ function OnboardingProfile({ chrome } = {}) {
|
|
|
13376
13386
|
};
|
|
13377
13387
|
}, []);
|
|
13378
13388
|
const autoDerivedDisplayName = [firstName, lastName].map((s) => (s || "").trim()).filter(Boolean).join(" ");
|
|
13379
|
-
|
|
13389
|
+
React55.useEffect(() => {
|
|
13380
13390
|
if (!displayNameEdited) {
|
|
13381
13391
|
setDisplayName(autoDerivedDisplayName);
|
|
13382
13392
|
}
|
|
@@ -13572,7 +13582,7 @@ function IdentityVerify({
|
|
|
13572
13582
|
} = {}) {
|
|
13573
13583
|
const navigate = useWizardNavigate();
|
|
13574
13584
|
const { config, isLoading } = useProviderConfig();
|
|
13575
|
-
const [error, setError] =
|
|
13585
|
+
const [error, setError] = React55.useState(null);
|
|
13576
13586
|
const primaryId = config?.kyc.primary;
|
|
13577
13587
|
const allowedIdentityProviders = userIdentityStatusScopes(config);
|
|
13578
13588
|
const gate = useOnboardingState(
|
|
@@ -15026,20 +15036,20 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15026
15036
|
const navigate = useWizardNavigate();
|
|
15027
15037
|
const { bootstrapSession, user } = useAuth();
|
|
15028
15038
|
const { config } = useProviderConfig();
|
|
15029
|
-
const [keys, setKeys] =
|
|
15030
|
-
const [loading, setLoading] =
|
|
15031
|
-
const [busy, setBusy] =
|
|
15032
|
-
const [error, setError] =
|
|
15033
|
-
const [lastFailedAction, setLastFailedAction] =
|
|
15034
|
-
const [status, setStatus] =
|
|
15035
|
-
const [autoAdvanceArmed, setAutoAdvanceArmed] =
|
|
15036
|
-
const [emailDraft, setEmailDraft] =
|
|
15037
|
-
const [showDynamic, setShowDynamic] =
|
|
15038
|
-
const [walletsOpen, setWalletsOpen] =
|
|
15039
|
+
const [keys, setKeys] = React55.useState([]);
|
|
15040
|
+
const [loading, setLoading] = React55.useState(true);
|
|
15041
|
+
const [busy, setBusy] = React55.useState(null);
|
|
15042
|
+
const [error, setError] = React55.useState(null);
|
|
15043
|
+
const [lastFailedAction, setLastFailedAction] = React55.useState(null);
|
|
15044
|
+
const [status, setStatus] = React55.useState(null);
|
|
15045
|
+
const [autoAdvanceArmed, setAutoAdvanceArmed] = React55.useState(false);
|
|
15046
|
+
const [emailDraft, setEmailDraft] = React55.useState("");
|
|
15047
|
+
const [showDynamic, setShowDynamic] = React55.useState(false);
|
|
15048
|
+
const [walletsOpen, setWalletsOpen] = React55.useState(false);
|
|
15039
15049
|
const hasSyntheticEmail = !!user?.email && user.email.toLowerCase().endsWith("@external.yieldfabric.local");
|
|
15040
15050
|
const { snapshot: gateSnapshot } = useOnboardingState();
|
|
15041
15051
|
const emailOk = !!gateSnapshot && snapshotEmailOk(gateSnapshot);
|
|
15042
|
-
const refresh =
|
|
15052
|
+
const refresh = React55.useCallback(async (opts = {}) => {
|
|
15043
15053
|
try {
|
|
15044
15054
|
if (opts.invalidate ?? !opts.silent) {
|
|
15045
15055
|
invalidateWalletCount();
|
|
@@ -15057,7 +15067,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15057
15067
|
setLoading(false);
|
|
15058
15068
|
}
|
|
15059
15069
|
}, []);
|
|
15060
|
-
|
|
15070
|
+
React55.useEffect(() => {
|
|
15061
15071
|
refresh({ invalidate: true });
|
|
15062
15072
|
}, [refresh]);
|
|
15063
15073
|
const keyCount = keys.length;
|
|
@@ -15192,7 +15202,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15192
15202
|
setBusy(null);
|
|
15193
15203
|
}
|
|
15194
15204
|
}
|
|
15195
|
-
const goOn =
|
|
15205
|
+
const goOn = React55.useCallback(async () => {
|
|
15196
15206
|
setBusy("continue");
|
|
15197
15207
|
setLastFailedAction(null);
|
|
15198
15208
|
try {
|
|
@@ -15220,16 +15230,16 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15220
15230
|
setBusy(null);
|
|
15221
15231
|
}
|
|
15222
15232
|
}, [bootstrapSession, config, navigate, user?.role]);
|
|
15223
|
-
const onContinue =
|
|
15233
|
+
const onContinue = React55.useCallback(async () => {
|
|
15224
15234
|
if (!canContinue) return;
|
|
15225
15235
|
await goOn();
|
|
15226
15236
|
}, [canContinue, goOn]);
|
|
15227
|
-
const onSkip =
|
|
15237
|
+
const onSkip = React55.useCallback(async () => {
|
|
15228
15238
|
if (!user?.id) return;
|
|
15229
15239
|
deferKeyStep(user.id);
|
|
15230
15240
|
await goOn();
|
|
15231
15241
|
}, [goOn, user?.id]);
|
|
15232
|
-
|
|
15242
|
+
React55.useEffect(() => {
|
|
15233
15243
|
if (!autoAdvanceArmed || !canContinue || busy) return;
|
|
15234
15244
|
const timeout = window.setTimeout(() => {
|
|
15235
15245
|
setAutoAdvanceArmed(false);
|
|
@@ -15463,10 +15473,10 @@ var Drawer = ({
|
|
|
15463
15473
|
panelStyle,
|
|
15464
15474
|
contentStyle
|
|
15465
15475
|
}) => {
|
|
15466
|
-
const titleId =
|
|
15467
|
-
const panelRef =
|
|
15468
|
-
const closeButtonRef =
|
|
15469
|
-
|
|
15476
|
+
const titleId = React55.useId();
|
|
15477
|
+
const panelRef = React55.useRef(null);
|
|
15478
|
+
const closeButtonRef = React55.useRef(null);
|
|
15479
|
+
React55.useEffect(() => {
|
|
15470
15480
|
if (!isOpen || typeof document === "undefined") return;
|
|
15471
15481
|
const previouslyFocused = document.activeElement;
|
|
15472
15482
|
const bodyOverflow = document.body.style.overflow;
|
|
@@ -15737,12 +15747,12 @@ var EXPLANATIONS = {
|
|
|
15737
15747
|
manual: "Save a card for this billing profile. It is only charged for metered usage \u2014 nothing is charged now."
|
|
15738
15748
|
};
|
|
15739
15749
|
var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) => {
|
|
15740
|
-
const mountRef =
|
|
15741
|
-
const stripeRef =
|
|
15742
|
-
const elementsRef =
|
|
15743
|
-
const [ready, setReady] =
|
|
15744
|
-
const [submitting, setSubmitting] =
|
|
15745
|
-
|
|
15750
|
+
const mountRef = React55.useRef(null);
|
|
15751
|
+
const stripeRef = React55.useRef(null);
|
|
15752
|
+
const elementsRef = React55.useRef(null);
|
|
15753
|
+
const [ready, setReady] = React55.useState(false);
|
|
15754
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
15755
|
+
React55.useEffect(() => {
|
|
15746
15756
|
let cancelled = false;
|
|
15747
15757
|
let element = null;
|
|
15748
15758
|
(async () => {
|
|
@@ -15772,7 +15782,7 @@ var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) =>
|
|
|
15772
15782
|
}
|
|
15773
15783
|
};
|
|
15774
15784
|
}, [session.client_secret]);
|
|
15775
|
-
const submit =
|
|
15785
|
+
const submit = React55.useCallback(async () => {
|
|
15776
15786
|
const stripe = stripeRef.current;
|
|
15777
15787
|
const elements = elementsRef.current;
|
|
15778
15788
|
if (!stripe || !elements || submitting) return;
|
|
@@ -15827,9 +15837,9 @@ var AddCardDialog = ({
|
|
|
15827
15837
|
groupId,
|
|
15828
15838
|
source = "manual"
|
|
15829
15839
|
}) => {
|
|
15830
|
-
const [stage, setStage] =
|
|
15831
|
-
const [attempt, setAttempt] =
|
|
15832
|
-
|
|
15840
|
+
const [stage, setStage] = React55.useState({ kind: "creating" });
|
|
15841
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
15842
|
+
React55.useEffect(() => {
|
|
15833
15843
|
if (!isOpen) return;
|
|
15834
15844
|
let cancelled = false;
|
|
15835
15845
|
setStage({ kind: "creating" });
|
|
@@ -15858,7 +15868,7 @@ var AddCardDialog = ({
|
|
|
15858
15868
|
cancelled = true;
|
|
15859
15869
|
};
|
|
15860
15870
|
}, [isOpen, groupId, attempt]);
|
|
15861
|
-
const openPortal =
|
|
15871
|
+
const openPortal = React55.useCallback(async () => {
|
|
15862
15872
|
try {
|
|
15863
15873
|
const url = await exports.billingService.createPortalSession(void 0, groupId);
|
|
15864
15874
|
window.location.assign(url);
|
|
@@ -15937,8 +15947,8 @@ var AddCardDialog = ({
|
|
|
15937
15947
|
};
|
|
15938
15948
|
function AddCardStep({ chrome } = {}) {
|
|
15939
15949
|
const navigate = useWizardNavigate();
|
|
15940
|
-
const [dialogOpen, setDialogOpen] =
|
|
15941
|
-
const [saved, setSaved] =
|
|
15950
|
+
const [dialogOpen, setDialogOpen] = React55.useState(true);
|
|
15951
|
+
const [saved, setSaved] = React55.useState(false);
|
|
15942
15952
|
const handleSuccess = () => {
|
|
15943
15953
|
setSaved(true);
|
|
15944
15954
|
setDialogOpen(false);
|
|
@@ -16016,7 +16026,7 @@ function Field({
|
|
|
16016
16026
|
value,
|
|
16017
16027
|
copyable
|
|
16018
16028
|
}) {
|
|
16019
|
-
const [copied, setCopied] =
|
|
16029
|
+
const [copied, setCopied] = React55__default.default.useState(false);
|
|
16020
16030
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
16021
16031
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] uppercase tracking-wider text-text-secondary", children: label }),
|
|
16022
16032
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-0.5 flex items-center gap-2", children: [
|
|
@@ -16080,14 +16090,14 @@ var STAGE_COPY = {
|
|
|
16080
16090
|
not_applicable: { title: "Finishing up", body: "" }
|
|
16081
16091
|
};
|
|
16082
16092
|
var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
16083
|
-
const [status, setStatus] =
|
|
16084
|
-
const [impatient, setImpatient] =
|
|
16085
|
-
const activationStarted =
|
|
16086
|
-
const onContinueRef =
|
|
16087
|
-
|
|
16093
|
+
const [status, setStatus] = React55__default.default.useState(null);
|
|
16094
|
+
const [impatient, setImpatient] = React55__default.default.useState(false);
|
|
16095
|
+
const activationStarted = React55__default.default.useRef(false);
|
|
16096
|
+
const onContinueRef = React55__default.default.useRef(onContinue);
|
|
16097
|
+
React55__default.default.useEffect(() => {
|
|
16088
16098
|
onContinueRef.current = onContinue;
|
|
16089
16099
|
}, [onContinue]);
|
|
16090
|
-
|
|
16100
|
+
React55__default.default.useEffect(() => {
|
|
16091
16101
|
let cancelled = false;
|
|
16092
16102
|
let timer;
|
|
16093
16103
|
const startedAt = Date.now();
|
|
@@ -16186,11 +16196,11 @@ var TOTAL_MS = 3e3;
|
|
|
16186
16196
|
function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
16187
16197
|
const navigate = useWizardNavigate();
|
|
16188
16198
|
const { messages } = useBranding();
|
|
16189
|
-
const [name, setName] =
|
|
16190
|
-
const [walletShort, setWalletShort] =
|
|
16191
|
-
const [phase, setPhase] =
|
|
16192
|
-
const [accountOpened, setAccountOpened] =
|
|
16193
|
-
|
|
16199
|
+
const [name, setName] = React55.useState("");
|
|
16200
|
+
const [walletShort, setWalletShort] = React55.useState(null);
|
|
16201
|
+
const [phase, setPhase] = React55.useState("wallet");
|
|
16202
|
+
const [accountOpened, setAccountOpened] = React55.useState(false);
|
|
16203
|
+
React55.useEffect(() => {
|
|
16194
16204
|
let cancelled = false;
|
|
16195
16205
|
(async () => {
|
|
16196
16206
|
const token = exports.authService.getAccessToken();
|
|
@@ -16223,7 +16233,7 @@ function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
|
16223
16233
|
cancelled = true;
|
|
16224
16234
|
};
|
|
16225
16235
|
}, []);
|
|
16226
|
-
|
|
16236
|
+
React55.useEffect(() => {
|
|
16227
16237
|
if (!accountOpened) return;
|
|
16228
16238
|
const swap = window.setTimeout(() => setPhase("welcome"), WALLET_AWAKENING_MS);
|
|
16229
16239
|
const route = window.setTimeout(() => navigate("/home"), TOTAL_MS);
|
|
@@ -16433,39 +16443,39 @@ function ChoosePlan({
|
|
|
16433
16443
|
hydratePlanSelection,
|
|
16434
16444
|
clearPlanSelection
|
|
16435
16445
|
} = useWizardPlanIntent();
|
|
16436
|
-
const [catalog, setCatalog] =
|
|
16437
|
-
const [selected, setSelected] =
|
|
16438
|
-
const [selectedCatalogVersion, setSelectedCatalogVersion] =
|
|
16439
|
-
const [loading, setLoading] =
|
|
16440
|
-
const [busy, setBusy] =
|
|
16441
|
-
const [error, setError] =
|
|
16442
|
-
const [loadAttempt, setLoadAttempt] =
|
|
16443
|
-
const [completed, setCompleted] =
|
|
16444
|
-
const [leave, setLeave] =
|
|
16445
|
-
const [serverRequired, setServerRequired] =
|
|
16446
|
-
const [returnPending, setReturnPending] =
|
|
16446
|
+
const [catalog, setCatalog] = React55.useState(null);
|
|
16447
|
+
const [selected, setSelected] = React55.useState(null);
|
|
16448
|
+
const [selectedCatalogVersion, setSelectedCatalogVersion] = React55.useState(null);
|
|
16449
|
+
const [loading, setLoading] = React55.useState(true);
|
|
16450
|
+
const [busy, setBusy] = React55.useState(false);
|
|
16451
|
+
const [error, setError] = React55.useState(null);
|
|
16452
|
+
const [loadAttempt, setLoadAttempt] = React55.useState(0);
|
|
16453
|
+
const [completed, setCompleted] = React55.useState(false);
|
|
16454
|
+
const [leave, setLeave] = React55.useState(false);
|
|
16455
|
+
const [serverRequired, setServerRequired] = React55.useState(false);
|
|
16456
|
+
const [returnPending, setReturnPending] = React55.useState(() => {
|
|
16447
16457
|
const marker = readCreditCheckoutReturnMarker();
|
|
16448
16458
|
return marker?.kind === "plan" && !marker.groupId;
|
|
16449
16459
|
});
|
|
16450
|
-
const [returnRetryRequired, setReturnRetryRequired] =
|
|
16451
|
-
const initialAppliedProofRef =
|
|
16452
|
-
const appliedProofRef =
|
|
16453
|
-
const appliedPlanIdRef =
|
|
16460
|
+
const [returnRetryRequired, setReturnRetryRequired] = React55.useState(false);
|
|
16461
|
+
const initialAppliedProofRef = React55.useRef(readAppliedPlanProof());
|
|
16462
|
+
const appliedProofRef = React55.useRef(initialAppliedProofRef.current);
|
|
16463
|
+
const appliedPlanIdRef = React55.useRef(
|
|
16454
16464
|
initialAppliedProofRef.current?.purchasedPlanId ?? null
|
|
16455
16465
|
);
|
|
16456
|
-
const expectedPlanIdRef =
|
|
16466
|
+
const expectedPlanIdRef = React55.useRef(null);
|
|
16457
16467
|
const initialMismatch = initialAppliedProofRef.current?.intendedPlanId && initialAppliedProofRef.current.intendedPlanId !== initialAppliedProofRef.current.purchasedPlanId ? {
|
|
16458
16468
|
purchasedPlanId: initialAppliedProofRef.current.purchasedPlanId,
|
|
16459
16469
|
intendedPlanId: initialAppliedProofRef.current.intendedPlanId
|
|
16460
16470
|
} : null;
|
|
16461
|
-
const [appliedMismatch, setAppliedMismatch] =
|
|
16471
|
+
const [appliedMismatch, setAppliedMismatch] = React55.useState(
|
|
16462
16472
|
initialMismatch
|
|
16463
16473
|
);
|
|
16464
|
-
const appliedMismatchRef =
|
|
16474
|
+
const appliedMismatchRef = React55.useRef(initialMismatch);
|
|
16465
16475
|
expectedPlanIdRef.current = selected?.id ?? planSelection?.planId ?? null;
|
|
16466
16476
|
const directSelfPayApplicable = !(wizardPlatform ?? config?.platform?.group_id) && !personalSessionHasGroupPayer();
|
|
16467
16477
|
const planRequired = required || serverRequired;
|
|
16468
|
-
|
|
16478
|
+
React55.useEffect(() => {
|
|
16469
16479
|
if (!directSelfPayApplicable) return;
|
|
16470
16480
|
let disposed = false;
|
|
16471
16481
|
setLoading(true);
|
|
@@ -16555,7 +16565,7 @@ function ChoosePlan({
|
|
|
16555
16565
|
required,
|
|
16556
16566
|
returnPending
|
|
16557
16567
|
]);
|
|
16558
|
-
|
|
16568
|
+
React55.useEffect(() => {
|
|
16559
16569
|
const handleApplied = (event) => {
|
|
16560
16570
|
const detail = event.detail;
|
|
16561
16571
|
if (detail.kind !== "plan" || detail.groupId || !detail.creditPlanId) return;
|
|
@@ -16589,7 +16599,7 @@ function ChoosePlan({
|
|
|
16589
16599
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16590
16600
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16591
16601
|
}, []);
|
|
16592
|
-
|
|
16602
|
+
React55.useEffect(() => {
|
|
16593
16603
|
const matchesPersonalPlanReturn = (event) => {
|
|
16594
16604
|
const detail = event.detail;
|
|
16595
16605
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -16620,7 +16630,7 @@ function ChoosePlan({
|
|
|
16620
16630
|
);
|
|
16621
16631
|
};
|
|
16622
16632
|
}, []);
|
|
16623
|
-
|
|
16633
|
+
React55.useEffect(() => {
|
|
16624
16634
|
if (!returnPending) return;
|
|
16625
16635
|
const timer = window.setInterval(() => {
|
|
16626
16636
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -17122,20 +17132,20 @@ function SponsorshipConsent({
|
|
|
17122
17132
|
stageSponsorship,
|
|
17123
17133
|
finishSponsorship
|
|
17124
17134
|
} = useWizardAuthentication();
|
|
17125
|
-
const [sponsorship, setSponsorship] =
|
|
17126
|
-
const [exactSession, setExactSession] =
|
|
17127
|
-
const [agreed, setAgreed] =
|
|
17128
|
-
const [loading, setLoading] =
|
|
17129
|
-
const [busy, setBusy] =
|
|
17130
|
-
const [error, setError] =
|
|
17131
|
-
const [loadAttempt, setLoadAttempt] =
|
|
17132
|
-
const destination =
|
|
17135
|
+
const [sponsorship, setSponsorship] = React55.useState(null);
|
|
17136
|
+
const [exactSession, setExactSession] = React55.useState(false);
|
|
17137
|
+
const [agreed, setAgreed] = React55.useState(false);
|
|
17138
|
+
const [loading, setLoading] = React55.useState(true);
|
|
17139
|
+
const [busy, setBusy] = React55.useState(false);
|
|
17140
|
+
const [error, setError] = React55.useState(null);
|
|
17141
|
+
const [loadAttempt, setLoadAttempt] = React55.useState(0);
|
|
17142
|
+
const destination = React55.useMemo(() => {
|
|
17133
17143
|
if (pendingSponsorship?.groupId === groupId) {
|
|
17134
17144
|
return pendingSponsorship.destination;
|
|
17135
17145
|
}
|
|
17136
17146
|
return fallbackDestination;
|
|
17137
17147
|
}, [fallbackDestination, groupId, pendingSponsorship]);
|
|
17138
|
-
const loadCurrent =
|
|
17148
|
+
const loadCurrent = React55.useCallback(async (driftMessage) => {
|
|
17139
17149
|
setLoading(true);
|
|
17140
17150
|
if (!driftMessage) setError(null);
|
|
17141
17151
|
try {
|
|
@@ -17158,7 +17168,7 @@ function SponsorshipConsent({
|
|
|
17158
17168
|
setLoading(false);
|
|
17159
17169
|
}
|
|
17160
17170
|
}, [destination, groupId, stageSponsorship]);
|
|
17161
|
-
|
|
17171
|
+
React55.useEffect(() => {
|
|
17162
17172
|
let cancelled = false;
|
|
17163
17173
|
setLoading(true);
|
|
17164
17174
|
setError(null);
|
|
@@ -17425,7 +17435,7 @@ function WizardRouter({
|
|
|
17425
17435
|
identityRequired && primaryKycVerifiesEmail(config)
|
|
17426
17436
|
);
|
|
17427
17437
|
const hostOwnsSponsorshipConsent = sponsorshipConsent === "host";
|
|
17428
|
-
|
|
17438
|
+
React55__default.default.useEffect(() => {
|
|
17429
17439
|
if (hostOwnsSponsorshipConsent && pendingSponsorship) {
|
|
17430
17440
|
discardSponsorship();
|
|
17431
17441
|
}
|
|
@@ -17641,7 +17651,7 @@ function builtinProviderDisplayName(id) {
|
|
|
17641
17651
|
}
|
|
17642
17652
|
}
|
|
17643
17653
|
function useProviderDisplayName(config) {
|
|
17644
|
-
return
|
|
17654
|
+
return React55__default.default.useCallback(
|
|
17645
17655
|
(id) => {
|
|
17646
17656
|
const labelled = config?.kyc?.settings?.[id]?.label ?? config?.auth?.settings?.[id]?.label;
|
|
17647
17657
|
const trimmed = typeof labelled === "string" ? labelled.trim() : "";
|
|
@@ -17711,26 +17721,26 @@ var OnboardingPolicySection = ({
|
|
|
17711
17721
|
groupId,
|
|
17712
17722
|
sponsorshipEpoch = 0
|
|
17713
17723
|
}) => {
|
|
17714
|
-
const [deployConfig, setDeployConfig] =
|
|
17724
|
+
const [deployConfig, setDeployConfig] = React55.useState(null);
|
|
17715
17725
|
const providerDisplayName = useProviderDisplayName(deployConfig);
|
|
17716
|
-
const [deployLoading, setDeployLoading] =
|
|
17717
|
-
const [profiles, setProfiles] =
|
|
17718
|
-
const [catalogRefreshed, setCatalogRefreshed] =
|
|
17719
|
-
const [loading, setLoading] =
|
|
17720
|
-
const [hidden, setHidden] =
|
|
17721
|
-
const [platformActive, setPlatformActive] =
|
|
17722
|
-
const [loadError, setLoadError] =
|
|
17723
|
-
const [saving, setSaving] =
|
|
17724
|
-
const [saved, setSaved] =
|
|
17725
|
-
const [saveError, setSaveError] =
|
|
17726
|
-
const [profileName, setProfileName] =
|
|
17727
|
-
const [requireEmail, setRequireEmail] =
|
|
17728
|
-
const [customize, setCustomize] =
|
|
17729
|
-
const [selectedProviders, setSelectedProviders] =
|
|
17730
|
-
const [authPrimary, setAuthPrimary] =
|
|
17731
|
-
const [kycPrimary, setKycPrimary] =
|
|
17732
|
-
const [uxSteps, setUxSteps] =
|
|
17733
|
-
|
|
17726
|
+
const [deployLoading, setDeployLoading] = React55.useState(true);
|
|
17727
|
+
const [profiles, setProfiles] = React55.useState([]);
|
|
17728
|
+
const [catalogRefreshed, setCatalogRefreshed] = React55.useState(false);
|
|
17729
|
+
const [loading, setLoading] = React55.useState(true);
|
|
17730
|
+
const [hidden, setHidden] = React55.useState(false);
|
|
17731
|
+
const [platformActive, setPlatformActive] = React55.useState(null);
|
|
17732
|
+
const [loadError, setLoadError] = React55.useState(null);
|
|
17733
|
+
const [saving, setSaving] = React55.useState(false);
|
|
17734
|
+
const [saved, setSaved] = React55.useState(false);
|
|
17735
|
+
const [saveError, setSaveError] = React55.useState(null);
|
|
17736
|
+
const [profileName, setProfileName] = React55.useState("");
|
|
17737
|
+
const [requireEmail, setRequireEmail] = React55.useState(false);
|
|
17738
|
+
const [customize, setCustomize] = React55.useState(false);
|
|
17739
|
+
const [selectedProviders, setSelectedProviders] = React55.useState([]);
|
|
17740
|
+
const [authPrimary, setAuthPrimary] = React55.useState("");
|
|
17741
|
+
const [kycPrimary, setKycPrimary] = React55.useState("");
|
|
17742
|
+
const [uxSteps, setUxSteps] = React55.useState({});
|
|
17743
|
+
React55.useEffect(() => {
|
|
17734
17744
|
let cancelled = false;
|
|
17735
17745
|
(async () => {
|
|
17736
17746
|
try {
|
|
@@ -17749,7 +17759,7 @@ var OnboardingPolicySection = ({
|
|
|
17749
17759
|
cancelled = true;
|
|
17750
17760
|
};
|
|
17751
17761
|
}, []);
|
|
17752
|
-
const applyResponse =
|
|
17762
|
+
const applyResponse = React55.useCallback((p) => {
|
|
17753
17763
|
const pol = p.policy;
|
|
17754
17764
|
setProfileName(p.verification_profile ?? "");
|
|
17755
17765
|
setRequireEmail(pol?.require_email ?? false);
|
|
@@ -17759,8 +17769,8 @@ var OnboardingPolicySection = ({
|
|
|
17759
17769
|
setKycPrimary(pol?.kyc_primary ?? "");
|
|
17760
17770
|
setUxSteps(pol?.ux_steps ?? {});
|
|
17761
17771
|
}, []);
|
|
17762
|
-
const loadGen =
|
|
17763
|
-
const load =
|
|
17772
|
+
const loadGen = React55.useRef(0);
|
|
17773
|
+
const load = React55.useCallback(async () => {
|
|
17764
17774
|
const gen = ++loadGen.current;
|
|
17765
17775
|
setLoading(true);
|
|
17766
17776
|
setLoadError(null);
|
|
@@ -17783,16 +17793,16 @@ var OnboardingPolicySection = ({
|
|
|
17783
17793
|
if (gen === loadGen.current) setLoading(false);
|
|
17784
17794
|
}
|
|
17785
17795
|
}, [groupId, applyResponse]);
|
|
17786
|
-
|
|
17796
|
+
React55.useEffect(() => {
|
|
17787
17797
|
setHidden(false);
|
|
17788
17798
|
setSaved(false);
|
|
17789
17799
|
setSaveError(null);
|
|
17790
17800
|
setCatalogRefreshed(false);
|
|
17791
17801
|
void load();
|
|
17792
17802
|
}, [load]);
|
|
17793
|
-
const [probeRetry, setProbeRetry] =
|
|
17794
|
-
const probedGroupRef =
|
|
17795
|
-
|
|
17803
|
+
const [probeRetry, setProbeRetry] = React55.useState(0);
|
|
17804
|
+
const probedGroupRef = React55.useRef(null);
|
|
17805
|
+
React55.useEffect(() => {
|
|
17796
17806
|
let cancelled = false;
|
|
17797
17807
|
if (probedGroupRef.current !== groupId) {
|
|
17798
17808
|
setPlatformActive(null);
|
|
@@ -17807,7 +17817,7 @@ var OnboardingPolicySection = ({
|
|
|
17807
17817
|
cancelled = true;
|
|
17808
17818
|
};
|
|
17809
17819
|
}, [groupId, sponsorshipEpoch, probeRetry]);
|
|
17810
|
-
const markDirty =
|
|
17820
|
+
const markDirty = React55.useCallback(() => {
|
|
17811
17821
|
setSaved(false);
|
|
17812
17822
|
setSaveError(null);
|
|
17813
17823
|
}, []);
|
|
@@ -17858,7 +17868,7 @@ var OnboardingPolicySection = ({
|
|
|
17858
17868
|
return null;
|
|
17859
17869
|
};
|
|
17860
17870
|
const anyBlockedToggle = !loading && profileGroups.some((g) => groupVendors(g).some((v) => vendorToggleTarget(g, v) === null));
|
|
17861
|
-
|
|
17871
|
+
React55.useEffect(() => {
|
|
17862
17872
|
if (!anyBlockedToggle || catalogRefreshed) return;
|
|
17863
17873
|
setCatalogRefreshed(true);
|
|
17864
17874
|
onboardingPolicyService.listVerificationProfiles().then((v) => setProfiles(v.profiles)).catch(() => {
|
|
@@ -17897,7 +17907,7 @@ var OnboardingPolicySection = ({
|
|
|
17897
17907
|
...requireEmail ? [{ label: "Verify email" }] : [],
|
|
17898
17908
|
...profileName && identityStepLabel ? [{ label: identityStepLabel, detail: identityStepDetail }] : []
|
|
17899
17909
|
];
|
|
17900
|
-
const save =
|
|
17910
|
+
const save = React55.useCallback(async () => {
|
|
17901
17911
|
if (customize && selectedProviders.length === 0) {
|
|
17902
17912
|
setSaveError("Select at least one sign-in method, or turn customization off.");
|
|
17903
17913
|
return;
|
|
@@ -17977,7 +17987,7 @@ var OnboardingPolicySection = ({
|
|
|
17977
17987
|
)
|
|
17978
17988
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
17979
17989
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-2.5 gap-y-1.5 rounded-lg border border-primary/20 bg-primary/[0.04] px-3.5 py-2.5", children: [
|
|
17980
|
-
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17990
|
+
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
17981
17991
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-[12px] text-text-muted/60", children: "\u203A" }),
|
|
17982
17992
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
17983
17993
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-primary/20 text-[9px] font-bold text-primary", children: i + 1 }),
|
|
@@ -18836,7 +18846,7 @@ function formatBigNumberString(value) {
|
|
|
18836
18846
|
return { withSeparators, sci: `~${mantissa}e${exp}` };
|
|
18837
18847
|
}
|
|
18838
18848
|
function ExpandableString({ value }) {
|
|
18839
|
-
const [expanded, setExpanded] =
|
|
18849
|
+
const [expanded, setExpanded] = React55.useState(false);
|
|
18840
18850
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex flex-wrap items-baseline gap-2", children: [
|
|
18841
18851
|
expanded ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-[10px] text-text-secondary break-all", children: value }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-text-muted", children: [
|
|
18842
18852
|
"[",
|
|
@@ -18922,7 +18932,7 @@ function PrettyObject({
|
|
|
18922
18932
|
depth,
|
|
18923
18933
|
keyHint
|
|
18924
18934
|
}) {
|
|
18925
|
-
const [showEmpty, setShowEmpty] =
|
|
18935
|
+
const [showEmpty, setShowEmpty] = React55.useState(false);
|
|
18926
18936
|
const entries = Object.entries(value);
|
|
18927
18937
|
const present = entries.filter(([, v]) => !isEmptyValue(v));
|
|
18928
18938
|
const empty = entries.filter(([, v]) => isEmptyValue(v));
|
|
@@ -19010,24 +19020,24 @@ function PrettyJson({
|
|
|
19010
19020
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary", children: String(value) });
|
|
19011
19021
|
}
|
|
19012
19022
|
function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId, entityType = "user", selectorRegistry, addressLabels, renderSimpleSummary, mode = "sign", onRetry, onSwitchToSign }) {
|
|
19013
|
-
const [unsignedTransaction, setUnsignedTransaction] =
|
|
19014
|
-
const [loading, setLoading] =
|
|
19015
|
-
const [error, setError] =
|
|
19016
|
-
const [reviewWarning, setReviewWarning] =
|
|
19017
|
-
const [signing, setSigning] =
|
|
19018
|
-
const [selectedKey, setSelectedKey] =
|
|
19019
|
-
const [availableKeys, setAvailableKeys] =
|
|
19020
|
-
const [keysLoading, setKeysLoading] =
|
|
19021
|
-
const [keysError, setKeysError] =
|
|
19022
|
-
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] =
|
|
19023
|
-
const [expandedTxData, setExpandedTxData] =
|
|
19024
|
-
const [view, setView] =
|
|
19025
|
-
const [cancelling, setCancelling] =
|
|
19026
|
-
const [cancelError, setCancelError] =
|
|
19023
|
+
const [unsignedTransaction, setUnsignedTransaction] = React55.useState(null);
|
|
19024
|
+
const [loading, setLoading] = React55.useState(true);
|
|
19025
|
+
const [error, setError] = React55.useState(null);
|
|
19026
|
+
const [reviewWarning, setReviewWarning] = React55.useState(null);
|
|
19027
|
+
const [signing, setSigning] = React55.useState(false);
|
|
19028
|
+
const [selectedKey, setSelectedKey] = React55.useState(null);
|
|
19029
|
+
const [availableKeys, setAvailableKeys] = React55.useState([]);
|
|
19030
|
+
const [keysLoading, setKeysLoading] = React55.useState(false);
|
|
19031
|
+
const [keysError, setKeysError] = React55.useState(null);
|
|
19032
|
+
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] = React55.useState([]);
|
|
19033
|
+
const [expandedTxData, setExpandedTxData] = React55.useState(/* @__PURE__ */ new Set());
|
|
19034
|
+
const [view, setView] = React55.useState("simple");
|
|
19035
|
+
const [cancelling, setCancelling] = React55.useState(false);
|
|
19036
|
+
const [cancelError, setCancelError] = React55.useState(null);
|
|
19027
19037
|
const walletSigner = useWalletSigner();
|
|
19028
19038
|
const tokenStore = useTokenStore();
|
|
19029
19039
|
const delegationTokenForSigning = tokenStore.getDelegationToken();
|
|
19030
|
-
const ownedSignerState =
|
|
19040
|
+
const ownedSignerState = React55.useMemo(() => {
|
|
19031
19041
|
try {
|
|
19032
19042
|
return {
|
|
19033
19043
|
binding: nftOwnedSignerBinding(delegationTokenForSigning),
|
|
@@ -19056,7 +19066,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19056
19066
|
setCancelling(false);
|
|
19057
19067
|
}
|
|
19058
19068
|
};
|
|
19059
|
-
|
|
19069
|
+
React55.useEffect(() => {
|
|
19060
19070
|
setError(null);
|
|
19061
19071
|
setReviewWarning(null);
|
|
19062
19072
|
setKeysError(null);
|
|
@@ -19066,7 +19076,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19066
19076
|
setKeysError(null);
|
|
19067
19077
|
};
|
|
19068
19078
|
}, [message.id]);
|
|
19069
|
-
|
|
19079
|
+
React55.useEffect(() => {
|
|
19070
19080
|
const fetchUnsignedTransaction = async () => {
|
|
19071
19081
|
try {
|
|
19072
19082
|
setLoading(true);
|
|
@@ -19189,7 +19199,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19189
19199
|
mode,
|
|
19190
19200
|
delegationTokenForSigning
|
|
19191
19201
|
]);
|
|
19192
|
-
|
|
19202
|
+
React55.useEffect(() => {
|
|
19193
19203
|
if (mode === "inspect") {
|
|
19194
19204
|
setKeysLoading(false);
|
|
19195
19205
|
return;
|
|
@@ -19254,7 +19264,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19254
19264
|
ownedSignerBinding,
|
|
19255
19265
|
ownedSignerState.error
|
|
19256
19266
|
]);
|
|
19257
|
-
|
|
19267
|
+
React55.useEffect(() => {
|
|
19258
19268
|
if (mode === "inspect") {
|
|
19259
19269
|
setPolicyAuthorizedKeyIds([]);
|
|
19260
19270
|
return;
|
|
@@ -19278,7 +19288,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19278
19288
|
cancelled = true;
|
|
19279
19289
|
};
|
|
19280
19290
|
}, [message?.id, mode]);
|
|
19281
|
-
|
|
19291
|
+
React55.useEffect(() => {
|
|
19282
19292
|
if (availableKeys.length === 0) {
|
|
19283
19293
|
if (selectedKey) setSelectedKey(null);
|
|
19284
19294
|
return;
|
|
@@ -20096,8 +20106,8 @@ function InspectFooter({
|
|
|
20096
20106
|
onRetry,
|
|
20097
20107
|
onSwitchToSign
|
|
20098
20108
|
}) {
|
|
20099
|
-
const [retrying, setRetrying] =
|
|
20100
|
-
const [actionError, setActionError] =
|
|
20109
|
+
const [retrying, setRetrying] = React55.useState(false);
|
|
20110
|
+
const [actionError, setActionError] = React55.useState(null);
|
|
20101
20111
|
const status = effectiveStatus(message);
|
|
20102
20112
|
const color = statusToColor(status);
|
|
20103
20113
|
const txHash = message.response?.deployment_tx_hash || message.response?.transaction_hash;
|
|
@@ -20236,8 +20246,8 @@ var GWEI_DISPLAY_THRESHOLD = BigInt("100000000000000");
|
|
|
20236
20246
|
var NATIVE_SYMBOL = "ETH";
|
|
20237
20247
|
var USD_PER_GAS = 0.01 / 21e3;
|
|
20238
20248
|
function useGasPricing() {
|
|
20239
|
-
const [pricing, setPricing] =
|
|
20240
|
-
|
|
20249
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
20250
|
+
React55.useEffect(() => {
|
|
20241
20251
|
let mounted = true;
|
|
20242
20252
|
void exports.billingService.getGasPricing().then((p) => {
|
|
20243
20253
|
if (mounted) setPricing(p);
|
|
@@ -20371,12 +20381,12 @@ var Toast = ({
|
|
|
20371
20381
|
icon,
|
|
20372
20382
|
action
|
|
20373
20383
|
}) => {
|
|
20374
|
-
const [progress, setProgress] =
|
|
20375
|
-
const [isVisible, setIsVisible] =
|
|
20376
|
-
|
|
20384
|
+
const [progress, setProgress] = React55.useState(100);
|
|
20385
|
+
const [isVisible, setIsVisible] = React55.useState(false);
|
|
20386
|
+
React55.useEffect(() => {
|
|
20377
20387
|
requestAnimationFrame(() => setIsVisible(true));
|
|
20378
20388
|
}, []);
|
|
20379
|
-
|
|
20389
|
+
React55.useEffect(() => {
|
|
20380
20390
|
if (duration > 0) {
|
|
20381
20391
|
const interval = setInterval(() => {
|
|
20382
20392
|
setProgress((prev) => {
|
|
@@ -20521,7 +20531,7 @@ function SignatureWorkflow({
|
|
|
20521
20531
|
dismissPending,
|
|
20522
20532
|
refreshPending
|
|
20523
20533
|
} = useSignatureQueue();
|
|
20524
|
-
|
|
20534
|
+
React55.useEffect(() => {
|
|
20525
20535
|
if (!notify || !pending) return;
|
|
20526
20536
|
const cleanup = notify({
|
|
20527
20537
|
id: `signature-${pending.id}`,
|
|
@@ -20671,7 +20681,7 @@ async function resolveKey(userId, selection) {
|
|
|
20671
20681
|
function useGenericSigner() {
|
|
20672
20682
|
const { user } = useAuth();
|
|
20673
20683
|
const { signMessage: signWithWallet } = useWalletSigner();
|
|
20674
|
-
const sign =
|
|
20684
|
+
const sign = React55.useCallback(
|
|
20675
20685
|
async (hash32Hex, opts = {}) => {
|
|
20676
20686
|
if (!user) throw new Error("useGenericSigner: no authenticated user");
|
|
20677
20687
|
const selection = opts.keySelection ?? { mode: "default" };
|
|
@@ -20738,10 +20748,10 @@ function PhoneVerification({
|
|
|
20738
20748
|
readOnly = false,
|
|
20739
20749
|
valueClassName
|
|
20740
20750
|
}) {
|
|
20741
|
-
const [phone, setPhone] =
|
|
20742
|
-
const [editing, setEditing] =
|
|
20743
|
-
const [saving, setSaving] =
|
|
20744
|
-
const [error, setError] =
|
|
20751
|
+
const [phone, setPhone] = React55.useState(profile.phone_e164 ?? "");
|
|
20752
|
+
const [editing, setEditing] = React55.useState(!profile.phone_e164);
|
|
20753
|
+
const [saving, setSaving] = React55.useState(false);
|
|
20754
|
+
const [error, setError] = React55.useState(null);
|
|
20745
20755
|
async function save() {
|
|
20746
20756
|
if (!isValidE164(phone)) {
|
|
20747
20757
|
setError("Please enter a phone number in E.164 format (e.g. +14155550101).");
|
|
@@ -20869,10 +20879,10 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20869
20879
|
...propClassNames ?? {}
|
|
20870
20880
|
});
|
|
20871
20881
|
const { isLoading: configLoading } = useProviderConfig();
|
|
20872
|
-
const [profile, setProfile] =
|
|
20873
|
-
const [loading, setLoading] =
|
|
20874
|
-
const [topError, setTopError] =
|
|
20875
|
-
|
|
20882
|
+
const [profile, setProfile] = React55.useState(null);
|
|
20883
|
+
const [loading, setLoading] = React55.useState(true);
|
|
20884
|
+
const [topError, setTopError] = React55.useState(null);
|
|
20885
|
+
React55.useEffect(() => {
|
|
20876
20886
|
let cancelled = false;
|
|
20877
20887
|
(async () => {
|
|
20878
20888
|
try {
|
|
@@ -20917,13 +20927,13 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20917
20927
|
] });
|
|
20918
20928
|
}
|
|
20919
20929
|
var IdentitySection = ({ profile, onSaved, classNames }) => {
|
|
20920
|
-
const [displayName, setDisplayName] =
|
|
20930
|
+
const [displayName, setDisplayName] = React55.useState(
|
|
20921
20931
|
profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name
|
|
20922
20932
|
);
|
|
20923
|
-
const [avatarChoice, setAvatarChoice] =
|
|
20924
|
-
const [avatarUrl, setAvatarUrl] =
|
|
20925
|
-
const [busy, setBusy] =
|
|
20926
|
-
const [err, setErr] =
|
|
20933
|
+
const [avatarChoice, setAvatarChoice] = React55.useState(profile.avatar_choice);
|
|
20934
|
+
const [avatarUrl, setAvatarUrl] = React55.useState(profile.avatar_url);
|
|
20935
|
+
const [busy, setBusy] = React55.useState(false);
|
|
20936
|
+
const [err, setErr] = React55.useState(null);
|
|
20927
20937
|
const [saved, flashSaved] = useSavedFlash();
|
|
20928
20938
|
const dirty = displayName !== (profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name) || avatarChoice !== profile.avatar_choice || (avatarUrl ?? "") !== (profile.avatar_url ?? "");
|
|
20929
20939
|
async function save() {
|
|
@@ -21164,12 +21174,12 @@ var SaveButton = ({ onClick, busy, disabled, saved = false, classNames }) => /*
|
|
|
21164
21174
|
}
|
|
21165
21175
|
);
|
|
21166
21176
|
function useSavedFlash(ms = 1800) {
|
|
21167
|
-
const [saved, setSaved] =
|
|
21168
|
-
const timer =
|
|
21169
|
-
|
|
21177
|
+
const [saved, setSaved] = React55.useState(false);
|
|
21178
|
+
const timer = React55__default.default.useRef(null);
|
|
21179
|
+
React55.useEffect(() => () => {
|
|
21170
21180
|
if (timer.current) clearTimeout(timer.current);
|
|
21171
21181
|
}, []);
|
|
21172
|
-
const flash =
|
|
21182
|
+
const flash = React55__default.default.useCallback(() => {
|
|
21173
21183
|
setSaved(true);
|
|
21174
21184
|
if (timer.current) clearTimeout(timer.current);
|
|
21175
21185
|
timer.current = setTimeout(() => setSaved(false), ms);
|
|
@@ -21438,14 +21448,14 @@ function isEoaKey(key) {
|
|
|
21438
21448
|
function useKeyBalance(handle, options = {}) {
|
|
21439
21449
|
const { pollIntervalMs = 15e3, enabled = true } = options;
|
|
21440
21450
|
const { request } = useWalletSigner();
|
|
21441
|
-
const [wei, setWei] =
|
|
21442
|
-
const [loading, setLoading] =
|
|
21443
|
-
const [error, setError] =
|
|
21444
|
-
const requestRef =
|
|
21451
|
+
const [wei, setWei] = React55.useState(null);
|
|
21452
|
+
const [loading, setLoading] = React55.useState(false);
|
|
21453
|
+
const [error, setError] = React55.useState(null);
|
|
21454
|
+
const requestRef = React55.useRef(request);
|
|
21445
21455
|
requestRef.current = request;
|
|
21446
|
-
const handleRef =
|
|
21456
|
+
const handleRef = React55.useRef(handle);
|
|
21447
21457
|
handleRef.current = handle;
|
|
21448
|
-
const fetchOnce =
|
|
21458
|
+
const fetchOnce = React55.useCallback(async () => {
|
|
21449
21459
|
const h = handleRef.current;
|
|
21450
21460
|
if (!h) {
|
|
21451
21461
|
setWei(null);
|
|
@@ -21465,7 +21475,7 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21465
21475
|
setLoading(false);
|
|
21466
21476
|
}
|
|
21467
21477
|
}, []);
|
|
21468
|
-
|
|
21478
|
+
React55.useEffect(() => {
|
|
21469
21479
|
if (!enabled || !handle) {
|
|
21470
21480
|
setWei(null);
|
|
21471
21481
|
setError(null);
|
|
@@ -21483,17 +21493,17 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21483
21493
|
function useEoaSend(handle, options = {}) {
|
|
21484
21494
|
const { timeoutMs = 9e4, pollIntervalMs = 3e3, onConfirmed } = options;
|
|
21485
21495
|
const { sendTransaction, request } = useWalletSigner();
|
|
21486
|
-
const [status, setStatus] =
|
|
21487
|
-
const [txHash, setTxHash] =
|
|
21488
|
-
const [error, setError] =
|
|
21489
|
-
const abortRef =
|
|
21490
|
-
const reset =
|
|
21496
|
+
const [status, setStatus] = React55.useState("idle");
|
|
21497
|
+
const [txHash, setTxHash] = React55.useState(null);
|
|
21498
|
+
const [error, setError] = React55.useState(null);
|
|
21499
|
+
const abortRef = React55.useRef(false);
|
|
21500
|
+
const reset = React55.useCallback(() => {
|
|
21491
21501
|
abortRef.current = true;
|
|
21492
21502
|
setStatus("idle");
|
|
21493
21503
|
setTxHash(null);
|
|
21494
21504
|
setError(null);
|
|
21495
21505
|
}, []);
|
|
21496
|
-
const send =
|
|
21506
|
+
const send = React55.useCallback(
|
|
21497
21507
|
async (input) => {
|
|
21498
21508
|
if (!handle) {
|
|
21499
21509
|
setError("No EOA selected.");
|
|
@@ -21584,14 +21594,14 @@ var SendFromKey = ({
|
|
|
21584
21594
|
maxWei,
|
|
21585
21595
|
onClose
|
|
21586
21596
|
}) => {
|
|
21587
|
-
const [to, setTo] =
|
|
21588
|
-
const [amount, setAmount] =
|
|
21597
|
+
const [to, setTo] = React55.useState("");
|
|
21598
|
+
const [amount, setAmount] = React55.useState("");
|
|
21589
21599
|
const { status, txHash, error, send, reset } = useEoaSend(handle, {
|
|
21590
21600
|
onConfirmed: () => {
|
|
21591
21601
|
}
|
|
21592
21602
|
});
|
|
21593
21603
|
const toValid = ADDRESS_RE2.test(to);
|
|
21594
|
-
const amountValid =
|
|
21604
|
+
const amountValid = React55.useMemo(() => {
|
|
21595
21605
|
if (!amount) return false;
|
|
21596
21606
|
if (!/^\d*\.?\d*$/.test(amount.trim())) return false;
|
|
21597
21607
|
return Number(amount) > 0;
|
|
@@ -21816,7 +21826,7 @@ var KeyBalances = ({
|
|
|
21816
21826
|
}) => {
|
|
21817
21827
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
21818
21828
|
const classNames = { ...configuredClassNames ?? {}, ...propClassNames ?? {} };
|
|
21819
|
-
const [sendOpen, setSendOpen] =
|
|
21829
|
+
const [sendOpen, setSendOpen] = React55.useState(false);
|
|
21820
21830
|
const { wei, loading, error } = useKeyBalance(handle);
|
|
21821
21831
|
const formatted = wei === null ? null : formatUnits(wei, 18, 6);
|
|
21822
21832
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -21866,13 +21876,13 @@ var ChangePasswordModal = ({
|
|
|
21866
21876
|
onClose,
|
|
21867
21877
|
onChanged
|
|
21868
21878
|
}) => {
|
|
21869
|
-
const [current, setCurrent] =
|
|
21870
|
-
const [next, setNext] =
|
|
21871
|
-
const [confirm, setConfirm] =
|
|
21872
|
-
const [submitting, setSubmitting] =
|
|
21873
|
-
const [serverError, setServerError] =
|
|
21874
|
-
const [success, setSuccess] =
|
|
21875
|
-
const issues =
|
|
21879
|
+
const [current, setCurrent] = React55.useState("");
|
|
21880
|
+
const [next, setNext] = React55.useState("");
|
|
21881
|
+
const [confirm, setConfirm] = React55.useState("");
|
|
21882
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
21883
|
+
const [serverError, setServerError] = React55.useState(null);
|
|
21884
|
+
const [success, setSuccess] = React55.useState(false);
|
|
21885
|
+
const issues = React55.useMemo(() => {
|
|
21876
21886
|
const out = [];
|
|
21877
21887
|
if (!current) out.push({ field: "current", message: "Required." });
|
|
21878
21888
|
if (!next) {
|
|
@@ -22035,7 +22045,7 @@ function PasswordField({
|
|
|
22035
22045
|
autoComplete,
|
|
22036
22046
|
autoFocus
|
|
22037
22047
|
}) {
|
|
22038
|
-
const [reveal, setReveal] =
|
|
22048
|
+
const [reveal, setReveal] = React55.useState(false);
|
|
22039
22049
|
const touched = value.length > 0;
|
|
22040
22050
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
22041
22051
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-[10px] uppercase tracking-wide text-text-muted", children: label }),
|
|
@@ -22165,32 +22175,32 @@ function SecurityPage() {
|
|
|
22165
22175
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
22166
22176
|
const classNames = resolveSecurityClasses(configuredClassNames);
|
|
22167
22177
|
const navigate = useWalletNavigate();
|
|
22168
|
-
const [keys, setKeys] =
|
|
22169
|
-
const [loading, setLoading] =
|
|
22170
|
-
const [error, setError] =
|
|
22171
|
-
const [info, setInfo] =
|
|
22172
|
-
const [showAdvanced, setShowAdvanced] =
|
|
22173
|
-
const [lockdown, setLockdown] =
|
|
22174
|
-
const [busy, setBusy] =
|
|
22175
|
-
const [rotateTarget, setRotateTarget] =
|
|
22176
|
-
const [rotateNewKind, setRotateNewKind] =
|
|
22177
|
-
const [rotateStep, setRotateStep] =
|
|
22178
|
-
const [rotateNewAddress, setRotateNewAddress] =
|
|
22179
|
-
const [rotateNewKeyId, setRotateNewKeyId] =
|
|
22180
|
-
const [rotateAccount, setRotateAccount] =
|
|
22181
|
-
const [rotateAddStatus, setRotateAddStatus] =
|
|
22182
|
-
const [rotateOperationMessageId, setRotateOperationMessageId] =
|
|
22183
|
-
const [passwordModalOpen, setPasswordModalOpen] =
|
|
22184
|
-
const [editingLabelKeyId, setEditingLabelKeyId] =
|
|
22185
|
-
const [labelDraft, setLabelDraft] =
|
|
22186
|
-
const [apiKeys, setApiKeys] =
|
|
22187
|
-
const [apiKeysLoading, setApiKeysLoading] =
|
|
22188
|
-
const [generateOpen, setGenerateOpen] =
|
|
22189
|
-
const [generateName, setGenerateName] =
|
|
22190
|
-
const [generateDescription, setGenerateDescription] =
|
|
22191
|
-
const [freshApiKey, setFreshApiKey] =
|
|
22192
|
-
const [freshApiKeyCopied, setFreshApiKeyCopied] =
|
|
22193
|
-
const refresh =
|
|
22178
|
+
const [keys, setKeys] = React55.useState([]);
|
|
22179
|
+
const [loading, setLoading] = React55.useState(true);
|
|
22180
|
+
const [error, setError] = React55.useState(null);
|
|
22181
|
+
const [info, setInfo] = React55.useState(null);
|
|
22182
|
+
const [showAdvanced, setShowAdvanced] = React55.useState(false);
|
|
22183
|
+
const [lockdown, setLockdown] = React55.useState(null);
|
|
22184
|
+
const [busy, setBusy] = React55.useState(null);
|
|
22185
|
+
const [rotateTarget, setRotateTarget] = React55.useState(null);
|
|
22186
|
+
const [rotateNewKind, setRotateNewKind] = React55.useState(null);
|
|
22187
|
+
const [rotateStep, setRotateStep] = React55.useState("pick");
|
|
22188
|
+
const [rotateNewAddress, setRotateNewAddress] = React55.useState(null);
|
|
22189
|
+
const [rotateNewKeyId, setRotateNewKeyId] = React55.useState(null);
|
|
22190
|
+
const [rotateAccount, setRotateAccount] = React55.useState(null);
|
|
22191
|
+
const [rotateAddStatus, setRotateAddStatus] = React55.useState(null);
|
|
22192
|
+
const [rotateOperationMessageId, setRotateOperationMessageId] = React55.useState(null);
|
|
22193
|
+
const [passwordModalOpen, setPasswordModalOpen] = React55.useState(false);
|
|
22194
|
+
const [editingLabelKeyId, setEditingLabelKeyId] = React55.useState(null);
|
|
22195
|
+
const [labelDraft, setLabelDraft] = React55.useState("");
|
|
22196
|
+
const [apiKeys, setApiKeys] = React55.useState([]);
|
|
22197
|
+
const [apiKeysLoading, setApiKeysLoading] = React55.useState(true);
|
|
22198
|
+
const [generateOpen, setGenerateOpen] = React55.useState(false);
|
|
22199
|
+
const [generateName, setGenerateName] = React55.useState("");
|
|
22200
|
+
const [generateDescription, setGenerateDescription] = React55.useState("");
|
|
22201
|
+
const [freshApiKey, setFreshApiKey] = React55.useState(null);
|
|
22202
|
+
const [freshApiKeyCopied, setFreshApiKeyCopied] = React55.useState(false);
|
|
22203
|
+
const refresh = React55.useCallback(async (opts) => {
|
|
22194
22204
|
setError(null);
|
|
22195
22205
|
try {
|
|
22196
22206
|
if (opts?.invalidate !== false) invalidateWalletCount();
|
|
@@ -22206,10 +22216,10 @@ function SecurityPage() {
|
|
|
22206
22216
|
setLoading(false);
|
|
22207
22217
|
}
|
|
22208
22218
|
}, []);
|
|
22209
|
-
|
|
22219
|
+
React55.useEffect(() => {
|
|
22210
22220
|
void refresh({ invalidate: false });
|
|
22211
22221
|
}, [refresh]);
|
|
22212
|
-
const refreshApiKeys =
|
|
22222
|
+
const refreshApiKeys = React55.useCallback(async () => {
|
|
22213
22223
|
try {
|
|
22214
22224
|
const list = await apiKeysService.list();
|
|
22215
22225
|
setApiKeys(list);
|
|
@@ -22219,7 +22229,7 @@ function SecurityPage() {
|
|
|
22219
22229
|
setApiKeysLoading(false);
|
|
22220
22230
|
}
|
|
22221
22231
|
}, []);
|
|
22222
|
-
|
|
22232
|
+
React55.useEffect(() => {
|
|
22223
22233
|
refreshApiKeys();
|
|
22224
22234
|
}, [refreshApiKeys]);
|
|
22225
22235
|
const userControlledCount = keys.length;
|
|
@@ -23503,42 +23513,42 @@ var GroupsView = ({
|
|
|
23503
23513
|
clearDelegationToken,
|
|
23504
23514
|
user
|
|
23505
23515
|
} = useAuthContext();
|
|
23506
|
-
const [busyId, setBusyId] =
|
|
23507
|
-
const [error, setError] =
|
|
23508
|
-
const [refreshing, setRefreshing] =
|
|
23509
|
-
const [creating, setCreating] =
|
|
23510
|
-
const [createOpen, setCreateOpen] =
|
|
23511
|
-
const [newGroupName, setNewGroupName] =
|
|
23512
|
-
const [newGroupDescription, setNewGroupDescription] =
|
|
23513
|
-
const [newGroupType, setNewGroupType] =
|
|
23514
|
-
const [newGroupLegalEntity, setNewGroupLegalEntity] =
|
|
23515
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
23516
|
-
const [ownedGroups, setOwnedGroups] =
|
|
23517
|
-
const [ownedGroupsLoading, setOwnedGroupsLoading] =
|
|
23518
|
-
const [ownedGroupsError, setOwnedGroupsError] =
|
|
23519
|
-
const [activeOwnedGroup, setActiveOwnedGroup] =
|
|
23520
|
-
const [operatorKeys, setOperatorKeys] =
|
|
23521
|
-
const [operatorKeysLoading, setOperatorKeysLoading] =
|
|
23522
|
-
const [selectedOperatorKeyId, setSelectedOperatorKeyId] =
|
|
23523
|
-
const [relationshipChildGroupId, setRelationshipChildGroupId] =
|
|
23524
|
-
const [relationshipAdvancing, setRelationshipAdvancing] =
|
|
23525
|
-
const [relationshipProgress, setRelationshipProgress] =
|
|
23516
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
23517
|
+
const [error, setError] = React55.useState(null);
|
|
23518
|
+
const [refreshing, setRefreshing] = React55.useState(false);
|
|
23519
|
+
const [creating, setCreating] = React55.useState(false);
|
|
23520
|
+
const [createOpen, setCreateOpen] = React55.useState(false);
|
|
23521
|
+
const [newGroupName, setNewGroupName] = React55.useState("");
|
|
23522
|
+
const [newGroupDescription, setNewGroupDescription] = React55.useState("");
|
|
23523
|
+
const [newGroupType, setNewGroupType] = React55.useState("Team");
|
|
23524
|
+
const [newGroupLegalEntity, setNewGroupLegalEntity] = React55.useState(false);
|
|
23525
|
+
const [selectedGroupId, setSelectedGroupId] = React55.useState(null);
|
|
23526
|
+
const [ownedGroups, setOwnedGroups] = React55.useState([]);
|
|
23527
|
+
const [ownedGroupsLoading, setOwnedGroupsLoading] = React55.useState(false);
|
|
23528
|
+
const [ownedGroupsError, setOwnedGroupsError] = React55.useState(null);
|
|
23529
|
+
const [activeOwnedGroup, setActiveOwnedGroup] = React55.useState(null);
|
|
23530
|
+
const [operatorKeys, setOperatorKeys] = React55.useState([]);
|
|
23531
|
+
const [operatorKeysLoading, setOperatorKeysLoading] = React55.useState(false);
|
|
23532
|
+
const [selectedOperatorKeyId, setSelectedOperatorKeyId] = React55.useState("");
|
|
23533
|
+
const [relationshipChildGroupId, setRelationshipChildGroupId] = React55.useState("");
|
|
23534
|
+
const [relationshipAdvancing, setRelationshipAdvancing] = React55.useState(false);
|
|
23535
|
+
const [relationshipProgress, setRelationshipProgress] = React55.useState(null);
|
|
23526
23536
|
const actingAsAnyGroup = !!delegationToken;
|
|
23527
|
-
const selectedGroup =
|
|
23537
|
+
const selectedGroup = React55.useMemo(
|
|
23528
23538
|
() => groups.find((group) => group.id === selectedGroupId) ?? null,
|
|
23529
23539
|
[groups, selectedGroupId]
|
|
23530
23540
|
);
|
|
23531
23541
|
const sourceGroupId = delegationSession?.kind === "owned" ? delegationSession.parentGroupId : delegationSession?.currentGroupId ?? null;
|
|
23532
|
-
const sourceGroup =
|
|
23542
|
+
const sourceGroup = React55.useMemo(
|
|
23533
23543
|
() => groups.find((group) => group.id === sourceGroupId) ?? null,
|
|
23534
23544
|
[groups, sourceGroupId]
|
|
23535
23545
|
);
|
|
23536
23546
|
const canAdvanceRelationshipAsParent = sourceGroup?.role === "owner";
|
|
23537
|
-
|
|
23547
|
+
React55.useEffect(() => {
|
|
23538
23548
|
setRelationshipChildGroupId("");
|
|
23539
23549
|
setRelationshipProgress(null);
|
|
23540
23550
|
}, [delegationSession?.kind, delegationSession?.currentGroupId]);
|
|
23541
|
-
|
|
23551
|
+
React55.useEffect(() => {
|
|
23542
23552
|
let cancelled = false;
|
|
23543
23553
|
if (!delegationToken || delegationSession?.kind !== "direct") {
|
|
23544
23554
|
setOwnedGroups([]);
|
|
@@ -23566,7 +23576,7 @@ var GroupsView = ({
|
|
|
23566
23576
|
cancelled = true;
|
|
23567
23577
|
};
|
|
23568
23578
|
}, [delegationSession, delegationToken]);
|
|
23569
|
-
|
|
23579
|
+
React55.useEffect(() => {
|
|
23570
23580
|
let cancelled = false;
|
|
23571
23581
|
if (delegationSession?.kind !== "direct" || !user?.id) {
|
|
23572
23582
|
setOperatorKeys([]);
|
|
@@ -23603,7 +23613,7 @@ var GroupsView = ({
|
|
|
23603
23613
|
cancelled = true;
|
|
23604
23614
|
};
|
|
23605
23615
|
}, [delegationSession, user?.id]);
|
|
23606
|
-
|
|
23616
|
+
React55.useEffect(() => {
|
|
23607
23617
|
let cancelled = false;
|
|
23608
23618
|
if (!delegationToken || delegationSession?.kind !== "owned") {
|
|
23609
23619
|
setActiveOwnedGroup(null);
|
|
@@ -24353,22 +24363,22 @@ function GroupDetailView({
|
|
|
24353
24363
|
onOpenBilling,
|
|
24354
24364
|
onRefreshed
|
|
24355
24365
|
}) {
|
|
24356
|
-
const [details, setDetails] =
|
|
24357
|
-
const [accountStatus, setAccountStatus] =
|
|
24358
|
-
const [members, setMembers] =
|
|
24359
|
-
const [loading, setLoading] =
|
|
24360
|
-
const [membersLoading, setMembersLoading] =
|
|
24361
|
-
const [error, setError] =
|
|
24362
|
-
const [showAddMember, setShowAddMember] =
|
|
24363
|
-
const [newMemberId, setNewMemberId] =
|
|
24364
|
-
const [newMemberRole, setNewMemberRole] =
|
|
24365
|
-
const [editingMemberId, setEditingMemberId] =
|
|
24366
|
-
const [editingRole, setEditingRole] =
|
|
24367
|
-
const [submitting, setSubmitting] =
|
|
24368
|
-
const [deploying, setDeploying] =
|
|
24366
|
+
const [details, setDetails] = React55.useState(group);
|
|
24367
|
+
const [accountStatus, setAccountStatus] = React55.useState(null);
|
|
24368
|
+
const [members, setMembers] = React55.useState([]);
|
|
24369
|
+
const [loading, setLoading] = React55.useState(true);
|
|
24370
|
+
const [membersLoading, setMembersLoading] = React55.useState(true);
|
|
24371
|
+
const [error, setError] = React55.useState(null);
|
|
24372
|
+
const [showAddMember, setShowAddMember] = React55.useState(false);
|
|
24373
|
+
const [newMemberId, setNewMemberId] = React55.useState("");
|
|
24374
|
+
const [newMemberRole, setNewMemberRole] = React55.useState("member");
|
|
24375
|
+
const [editingMemberId, setEditingMemberId] = React55.useState(null);
|
|
24376
|
+
const [editingRole, setEditingRole] = React55.useState("member");
|
|
24377
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
24378
|
+
const [deploying, setDeploying] = React55.useState(false);
|
|
24369
24379
|
const role = details.role ?? group.role ?? "member";
|
|
24370
24380
|
const canManageMembers = role === "owner" || role === "admin";
|
|
24371
|
-
const loadDetails =
|
|
24381
|
+
const loadDetails = React55.useCallback(async () => {
|
|
24372
24382
|
setLoading(true);
|
|
24373
24383
|
setMembersLoading(true);
|
|
24374
24384
|
setError(null);
|
|
@@ -24388,7 +24398,7 @@ function GroupDetailView({
|
|
|
24388
24398
|
setMembersLoading(false);
|
|
24389
24399
|
}
|
|
24390
24400
|
}, [group]);
|
|
24391
|
-
|
|
24401
|
+
React55.useEffect(() => {
|
|
24392
24402
|
setDetails(group);
|
|
24393
24403
|
void loadDetails();
|
|
24394
24404
|
}, [group, loadDetails]);
|
|
@@ -24922,17 +24932,17 @@ function ActiveEnvironmentBadge({
|
|
|
24922
24932
|
configuredTestChains
|
|
24923
24933
|
);
|
|
24924
24934
|
const canChoose = Boolean(activeChainId && options.length > 1);
|
|
24925
|
-
const [busyChainId, setBusyChainId] =
|
|
24926
|
-
const [pendingLiveChainId, setPendingLiveChainId] =
|
|
24927
|
-
const [error, setError] =
|
|
24928
|
-
const switchingRef =
|
|
24929
|
-
const confirmLiveRef =
|
|
24930
|
-
const liveWarningId =
|
|
24935
|
+
const [busyChainId, setBusyChainId] = React55__default.default.useState(null);
|
|
24936
|
+
const [pendingLiveChainId, setPendingLiveChainId] = React55__default.default.useState(null);
|
|
24937
|
+
const [error, setError] = React55__default.default.useState(null);
|
|
24938
|
+
const switchingRef = React55__default.default.useRef(false);
|
|
24939
|
+
const confirmLiveRef = React55__default.default.useRef(null);
|
|
24940
|
+
const liveWarningId = React55__default.default.useId();
|
|
24931
24941
|
const label = modeLabel(environment.mode);
|
|
24932
24942
|
const modeCounts = { test: 0, live: 0, unknown: 0 };
|
|
24933
24943
|
for (const option of options) modeCounts[option.mode] += 1;
|
|
24934
24944
|
const pendingLive = options.find((option) => option.chainId === pendingLiveChainId) ?? null;
|
|
24935
|
-
|
|
24945
|
+
React55__default.default.useEffect(() => {
|
|
24936
24946
|
if (pendingLiveChainId) confirmLiveRef.current?.focus();
|
|
24937
24947
|
}, [pendingLiveChainId]);
|
|
24938
24948
|
async function switchTo(option) {
|
|
@@ -25203,26 +25213,26 @@ var WalletCenterSurface = ({
|
|
|
25203
25213
|
} = useAuthContext();
|
|
25204
25214
|
const walletConfig = useWalletConfig();
|
|
25205
25215
|
const walletCenterUi = walletConfig.ui?.walletCenter;
|
|
25206
|
-
const [section, setSection] =
|
|
25207
|
-
const [historyFilter, setHistoryFilter] =
|
|
25208
|
-
const [historyItems, setHistoryItems] =
|
|
25209
|
-
const [historyOffset, setHistoryOffset] =
|
|
25210
|
-
const [historyHasMore, setHistoryHasMore] =
|
|
25211
|
-
const [historyLoading, setHistoryLoading] =
|
|
25212
|
-
const [historyError, setHistoryError] =
|
|
25213
|
-
const [historyLoadedOnce, setHistoryLoadedOnce] =
|
|
25214
|
-
const [selected, setSelected] =
|
|
25215
|
-
const [selectedSource, setSelectedSource] =
|
|
25216
|
-
const [busyId, setBusyId] =
|
|
25217
|
-
const [actionError, setActionError] =
|
|
25218
|
-
const cancelGuardRef =
|
|
25219
|
-
const wasOpenRef =
|
|
25220
|
-
const walletRootRef =
|
|
25221
|
-
const leaveSection =
|
|
25216
|
+
const [section, setSection] = React55.useState("menu");
|
|
25217
|
+
const [historyFilter, setHistoryFilter] = React55.useState("all");
|
|
25218
|
+
const [historyItems, setHistoryItems] = React55.useState([]);
|
|
25219
|
+
const [historyOffset, setHistoryOffset] = React55.useState(0);
|
|
25220
|
+
const [historyHasMore, setHistoryHasMore] = React55.useState(false);
|
|
25221
|
+
const [historyLoading, setHistoryLoading] = React55.useState(false);
|
|
25222
|
+
const [historyError, setHistoryError] = React55.useState(null);
|
|
25223
|
+
const [historyLoadedOnce, setHistoryLoadedOnce] = React55.useState(false);
|
|
25224
|
+
const [selected, setSelected] = React55.useState(null);
|
|
25225
|
+
const [selectedSource, setSelectedSource] = React55.useState("pending");
|
|
25226
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
25227
|
+
const [actionError, setActionError] = React55.useState(null);
|
|
25228
|
+
const cancelGuardRef = React55.useRef(/* @__PURE__ */ new Map());
|
|
25229
|
+
const wasOpenRef = React55.useRef(false);
|
|
25230
|
+
const walletRootRef = React55.useRef(null);
|
|
25231
|
+
const leaveSection = React55.useCallback(() => {
|
|
25222
25232
|
if (embedded && initialView !== "menu") onClose();
|
|
25223
25233
|
else setSection("menu");
|
|
25224
25234
|
}, [embedded, initialView, onClose]);
|
|
25225
|
-
|
|
25235
|
+
React55.useEffect(() => {
|
|
25226
25236
|
const justOpened = isOpen && !wasOpenRef.current;
|
|
25227
25237
|
wasOpenRef.current = isOpen;
|
|
25228
25238
|
if (!justOpened) return;
|
|
@@ -25236,24 +25246,24 @@ var WalletCenterSurface = ({
|
|
|
25236
25246
|
setHistoryHasMore(false);
|
|
25237
25247
|
setHistoryLoadedOnce(false);
|
|
25238
25248
|
}, [initialView, isOpen, refreshPending]);
|
|
25239
|
-
|
|
25249
|
+
React55.useEffect(() => {
|
|
25240
25250
|
if (!isOpen) return;
|
|
25241
25251
|
if (activeBuiltinFor(section, modules) === "transactions" && pendingList.length === 0) {
|
|
25242
25252
|
leaveSection();
|
|
25243
25253
|
}
|
|
25244
25254
|
}, [isOpen, leaveSection, modules, pendingList.length, section]);
|
|
25245
|
-
const delegatedGroupId =
|
|
25255
|
+
const delegatedGroupId = React55.useMemo(() => {
|
|
25246
25256
|
if (!delegationToken || typeof window === "undefined") return null;
|
|
25247
25257
|
return window.localStorage.getItem("delegation_group_id");
|
|
25248
25258
|
}, [delegationToken]);
|
|
25249
|
-
const configuredModules =
|
|
25259
|
+
const configuredModules = React55.useMemo(() => {
|
|
25250
25260
|
return validateWalletCenterModules(modules ?? defaultWalletCenterModules());
|
|
25251
25261
|
}, [modules]);
|
|
25252
|
-
const runtime =
|
|
25262
|
+
const runtime = React55.useMemo(
|
|
25253
25263
|
() => ({ pendingCount: pendingList.length, isAuthenticated: !!user }),
|
|
25254
25264
|
[pendingList.length, user]
|
|
25255
25265
|
);
|
|
25256
|
-
const visibleModules =
|
|
25266
|
+
const visibleModules = React55.useMemo(
|
|
25257
25267
|
() => configuredModules.filter((module) => {
|
|
25258
25268
|
if (module.kind === "builtin" && module.builtin === "transactions" && pendingList.length === 0) {
|
|
25259
25269
|
return false;
|
|
@@ -25262,16 +25272,16 @@ var WalletCenterSurface = ({
|
|
|
25262
25272
|
}),
|
|
25263
25273
|
[configuredModules, pendingList.length, runtime]
|
|
25264
25274
|
);
|
|
25265
|
-
const activeModule =
|
|
25275
|
+
const activeModule = React55.useMemo(
|
|
25266
25276
|
() => configuredModules.find((module) => module.id === section) ?? null,
|
|
25267
25277
|
[configuredModules, section]
|
|
25268
25278
|
);
|
|
25269
25279
|
const activeBuiltin = activeModule?.kind === "builtin" ? activeModule.builtin : null;
|
|
25270
|
-
const menuItems =
|
|
25280
|
+
const menuItems = React55.useMemo(
|
|
25271
25281
|
() => buildWalletMenuItems(visibleModules, runtime, groups.length),
|
|
25272
25282
|
[groups.length, runtime, visibleModules]
|
|
25273
25283
|
);
|
|
25274
|
-
|
|
25284
|
+
React55.useEffect(() => {
|
|
25275
25285
|
if (!isOpen) return;
|
|
25276
25286
|
const onVis = () => {
|
|
25277
25287
|
if (document.visibilityState === "visible") {
|
|
@@ -25281,11 +25291,11 @@ var WalletCenterSurface = ({
|
|
|
25281
25291
|
document.addEventListener("visibilitychange", onVis);
|
|
25282
25292
|
return () => document.removeEventListener("visibilitychange", onVis);
|
|
25283
25293
|
}, [isOpen, refreshPending]);
|
|
25284
|
-
|
|
25294
|
+
React55.useEffect(() => {
|
|
25285
25295
|
const scrollContainer = walletRootRef.current?.parentElement;
|
|
25286
25296
|
if (scrollContainer) scrollContainer.scrollTop = 0;
|
|
25287
25297
|
}, [section, selected]);
|
|
25288
|
-
const fetchHistory =
|
|
25298
|
+
const fetchHistory = React55.useCallback(
|
|
25289
25299
|
async (offset, append) => {
|
|
25290
25300
|
setHistoryLoading(true);
|
|
25291
25301
|
setHistoryError(null);
|
|
@@ -25308,7 +25318,7 @@ var WalletCenterSurface = ({
|
|
|
25308
25318
|
},
|
|
25309
25319
|
[userId]
|
|
25310
25320
|
);
|
|
25311
|
-
|
|
25321
|
+
React55.useEffect(() => {
|
|
25312
25322
|
if (!isOpen) return;
|
|
25313
25323
|
if (activeBuiltin !== "history") return;
|
|
25314
25324
|
if (historyLoadedOnce) return;
|
|
@@ -25323,7 +25333,7 @@ var WalletCenterSurface = ({
|
|
|
25323
25333
|
if (historyItems.length >= HISTORY_MAX_ITEMS) return;
|
|
25324
25334
|
void fetchHistory(historyOffset, true);
|
|
25325
25335
|
};
|
|
25326
|
-
const filteredHistoryItems =
|
|
25336
|
+
const filteredHistoryItems = React55.useMemo(() => {
|
|
25327
25337
|
if (historyFilter === "all") return historyItems;
|
|
25328
25338
|
const want = historyFilter === "Completed" /* Completed */ ? /* @__PURE__ */ new Set(["completed", "success"]) : historyFilter === "Failed" /* Failed */ ? /* @__PURE__ */ new Set(["failed", "error"]) : /* @__PURE__ */ new Set(["canceled", "cancelled"]);
|
|
25329
25339
|
return historyItems.filter(
|
|
@@ -25396,7 +25406,7 @@ var WalletCenterSurface = ({
|
|
|
25396
25406
|
setActionError(e?.message ?? "Failed to retry message.");
|
|
25397
25407
|
}
|
|
25398
25408
|
};
|
|
25399
|
-
const handleMenuActAsSelf =
|
|
25409
|
+
const handleMenuActAsSelf = React55.useCallback(async () => {
|
|
25400
25410
|
setActionError(null);
|
|
25401
25411
|
try {
|
|
25402
25412
|
clearDelegationToken();
|
|
@@ -25404,7 +25414,7 @@ var WalletCenterSurface = ({
|
|
|
25404
25414
|
setActionError(e?.message ?? "Failed to switch entity.");
|
|
25405
25415
|
}
|
|
25406
25416
|
}, [clearDelegationToken]);
|
|
25407
|
-
const handleMenuActAsGroup =
|
|
25417
|
+
const handleMenuActAsGroup = React55.useCallback(
|
|
25408
25418
|
async (group) => {
|
|
25409
25419
|
setActionError(null);
|
|
25410
25420
|
try {
|
|
@@ -25415,7 +25425,7 @@ var WalletCenterSurface = ({
|
|
|
25415
25425
|
},
|
|
25416
25426
|
[createDelegationToken]
|
|
25417
25427
|
);
|
|
25418
|
-
const handleSignOut =
|
|
25428
|
+
const handleSignOut = React55.useCallback(async () => {
|
|
25419
25429
|
setActionError(null);
|
|
25420
25430
|
try {
|
|
25421
25431
|
await logout();
|
|
@@ -25429,7 +25439,7 @@ var WalletCenterSurface = ({
|
|
|
25429
25439
|
setActionError(e?.message ?? "Failed to sign out.");
|
|
25430
25440
|
}
|
|
25431
25441
|
}, [logout, onClose, walletConfig]);
|
|
25432
|
-
const navigateFromCenter =
|
|
25442
|
+
const navigateFromCenter = React55.useCallback(
|
|
25433
25443
|
(href, options) => {
|
|
25434
25444
|
if (walletConfig.onNavigate) {
|
|
25435
25445
|
walletConfig.onNavigate(href, options);
|
|
@@ -25440,7 +25450,7 @@ var WalletCenterSurface = ({
|
|
|
25440
25450
|
},
|
|
25441
25451
|
[walletConfig]
|
|
25442
25452
|
);
|
|
25443
|
-
const panelContext =
|
|
25453
|
+
const panelContext = React55.useMemo(
|
|
25444
25454
|
() => ({
|
|
25445
25455
|
close: onClose,
|
|
25446
25456
|
back: () => setSection("menu"),
|
|
@@ -25451,7 +25461,7 @@ var WalletCenterSurface = ({
|
|
|
25451
25461
|
}),
|
|
25452
25462
|
[navigateFromCenter, onClose]
|
|
25453
25463
|
);
|
|
25454
|
-
const resolvedActors =
|
|
25464
|
+
const resolvedActors = React55.useMemo(() => {
|
|
25455
25465
|
if (actors) return actors;
|
|
25456
25466
|
return [
|
|
25457
25467
|
{
|
|
@@ -25478,7 +25488,7 @@ var WalletCenterSurface = ({
|
|
|
25478
25488
|
status: identity?.status ?? { label: "Online", color: "#4ade80" },
|
|
25479
25489
|
actions: identity?.actions ?? []
|
|
25480
25490
|
};
|
|
25481
|
-
const handleSelectModule =
|
|
25491
|
+
const handleSelectModule = React55.useCallback(
|
|
25482
25492
|
(module) => {
|
|
25483
25493
|
setActionError(null);
|
|
25484
25494
|
if (module.kind === "route") {
|
|
@@ -25490,7 +25500,7 @@ var WalletCenterSurface = ({
|
|
|
25490
25500
|
},
|
|
25491
25501
|
[navigateFromCenter, onClose]
|
|
25492
25502
|
);
|
|
25493
|
-
const handleSelectActor =
|
|
25503
|
+
const handleSelectActor = React55.useCallback(async (actor) => {
|
|
25494
25504
|
setActionError(null);
|
|
25495
25505
|
try {
|
|
25496
25506
|
await actor.onSelect();
|
|
@@ -25499,7 +25509,7 @@ var WalletCenterSurface = ({
|
|
|
25499
25509
|
setActionError(error?.message ?? "Failed to switch signing context.");
|
|
25500
25510
|
}
|
|
25501
25511
|
}, [leaveSection]);
|
|
25502
|
-
const drawerTitle =
|
|
25512
|
+
const drawerTitle = React55.useMemo(() => {
|
|
25503
25513
|
if (selected) {
|
|
25504
25514
|
const label = humanizeMessageType(selected.data?.message_type);
|
|
25505
25515
|
return selectedSource === "pending" ? `${label} \u2014 Sign` : label;
|
|
@@ -25507,7 +25517,7 @@ var WalletCenterSurface = ({
|
|
|
25507
25517
|
return "Wallet";
|
|
25508
25518
|
}, [selected, selectedSource]);
|
|
25509
25519
|
const hostedTitle = !embedded ? null : selected ? drawerTitle : section === "actors" ? "Signing context" : activeModule?.label ?? null;
|
|
25510
|
-
|
|
25520
|
+
React55.useEffect(() => {
|
|
25511
25521
|
if (!embedded) return void 0;
|
|
25512
25522
|
onTitle?.(hostedTitle);
|
|
25513
25523
|
return () => onTitle?.(null);
|
|
@@ -25692,7 +25702,7 @@ function WalletMenu({
|
|
|
25692
25702
|
const secondaryItems = items.filter((item) => item.placement === "secondary");
|
|
25693
25703
|
const activeActor = actors.find((actor) => actor.active) ?? actors[0];
|
|
25694
25704
|
const userName = identity.name ?? "You";
|
|
25695
|
-
const renderCard = (cardItems) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25705
|
+
const renderCard = (cardItems) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
25696
25706
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25697
25707
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25698
25708
|
WalletMenuRow,
|
|
@@ -25936,13 +25946,13 @@ function ActorsPane({
|
|
|
25936
25946
|
error,
|
|
25937
25947
|
onSelect
|
|
25938
25948
|
}) {
|
|
25939
|
-
const [busyId, setBusyId] =
|
|
25949
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
25940
25950
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [
|
|
25941
25951
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 text-[11px] leading-5 text-text-muted", children: "Choose the identity used for signing and entity-owned actions." }),
|
|
25942
25952
|
error && /* @__PURE__ */ jsxRuntime.jsx(ErrorBanner, { children: error }),
|
|
25943
25953
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[22px] border border-border-light bg-raised", children: actors.map((actor, index) => {
|
|
25944
25954
|
const ActorIcon = actor.icon;
|
|
25945
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25955
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
25946
25956
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25947
25957
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25948
25958
|
"button",
|
|
@@ -25977,10 +25987,10 @@ function DirectoryPane({
|
|
|
25977
25987
|
module,
|
|
25978
25988
|
context
|
|
25979
25989
|
}) {
|
|
25980
|
-
const [query, setQuery] =
|
|
25990
|
+
const [query, setQuery] = React55.useState("");
|
|
25981
25991
|
const isMobile = useWalletCenterMobile();
|
|
25982
25992
|
const normalizedQuery = normalizeSearchText(query);
|
|
25983
|
-
const visibleGroups =
|
|
25993
|
+
const visibleGroups = React55.useMemo(
|
|
25984
25994
|
() => module.groups.filter((group) => {
|
|
25985
25995
|
if (!group.visibility || group.visibility === "always") return true;
|
|
25986
25996
|
return group.visibility === (isMobile ? "mobile" : "desktop");
|
|
@@ -26081,10 +26091,10 @@ function normalizeSearchText(value) {
|
|
|
26081
26091
|
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLocaleLowerCase();
|
|
26082
26092
|
}
|
|
26083
26093
|
function useWalletCenterMobile() {
|
|
26084
|
-
const [isMobile, setIsMobile] =
|
|
26094
|
+
const [isMobile, setIsMobile] = React55.useState(
|
|
26085
26095
|
() => typeof window !== "undefined" && window.matchMedia("(max-width: 639px)").matches
|
|
26086
26096
|
);
|
|
26087
|
-
|
|
26097
|
+
React55.useEffect(() => {
|
|
26088
26098
|
if (typeof window === "undefined") return;
|
|
26089
26099
|
const media = window.matchMedia("(max-width: 639px)");
|
|
26090
26100
|
const update = () => setIsMobile(media.matches);
|
|
@@ -26624,10 +26634,10 @@ function messageText(content) {
|
|
|
26624
26634
|
return JSON.stringify(content, null, 2);
|
|
26625
26635
|
}
|
|
26626
26636
|
var PromptTranscript = ({ usageEventId }) => {
|
|
26627
|
-
const [log, setLog] =
|
|
26628
|
-
const [note, setNote] =
|
|
26629
|
-
const [loading, setLoading] =
|
|
26630
|
-
|
|
26637
|
+
const [log, setLog] = React55.useState(null);
|
|
26638
|
+
const [note, setNote] = React55.useState(null);
|
|
26639
|
+
const [loading, setLoading] = React55.useState(true);
|
|
26640
|
+
React55.useEffect(() => {
|
|
26631
26641
|
let cancelled = false;
|
|
26632
26642
|
const base = getAgentsServiceUrl();
|
|
26633
26643
|
setLoading(true);
|
|
@@ -26792,13 +26802,13 @@ var LineItemsTable = ({
|
|
|
26792
26802
|
caption,
|
|
26793
26803
|
showActor
|
|
26794
26804
|
}) => {
|
|
26795
|
-
const [selected, setSelected] =
|
|
26796
|
-
const [gasPricing, setGasPricing] =
|
|
26805
|
+
const [selected, setSelected] = React55.useState(null);
|
|
26806
|
+
const [gasPricing, setGasPricing] = React55.useState(null);
|
|
26797
26807
|
const minuteRate = gasPricing?.agent_minute_usd ?? 0;
|
|
26798
|
-
|
|
26808
|
+
React55.useEffect(() => {
|
|
26799
26809
|
void exports.billingService.getGasPricing().then(setGasPricing);
|
|
26800
26810
|
}, []);
|
|
26801
|
-
const columns =
|
|
26811
|
+
const columns = React55.useMemo(
|
|
26802
26812
|
() => [
|
|
26803
26813
|
{
|
|
26804
26814
|
header: "When",
|
|
@@ -27057,12 +27067,12 @@ var BuyCreditsDialog = ({
|
|
|
27057
27067
|
source = "manual",
|
|
27058
27068
|
reason
|
|
27059
27069
|
}) => {
|
|
27060
|
-
const [stage, setStage] =
|
|
27061
|
-
const [attempt, setAttempt] =
|
|
27070
|
+
const [stage, setStage] = React55.useState({ kind: "loading" });
|
|
27071
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
27062
27072
|
const activeGate = creditGateInfoForActiveToken();
|
|
27063
27073
|
const effectiveReason = reason ?? activeGate.reason ?? void 0;
|
|
27064
27074
|
const effectiveGroupId = resolveBuyCreditsTargetGroupId(target, activeGate);
|
|
27065
|
-
|
|
27075
|
+
React55.useEffect(() => {
|
|
27066
27076
|
if (!isOpen) return;
|
|
27067
27077
|
let cancelled = false;
|
|
27068
27078
|
setStage({ kind: "loading" });
|
|
@@ -27101,7 +27111,7 @@ var BuyCreditsDialog = ({
|
|
|
27101
27111
|
cancelled = true;
|
|
27102
27112
|
};
|
|
27103
27113
|
}, [isOpen, effectiveGroupId, effectiveReason, target.kind, attempt]);
|
|
27104
|
-
const redirectTo =
|
|
27114
|
+
const redirectTo = React55.useCallback(
|
|
27105
27115
|
async (open) => {
|
|
27106
27116
|
setStage({ kind: "redirecting" });
|
|
27107
27117
|
try {
|
|
@@ -27120,7 +27130,7 @@ var BuyCreditsDialog = ({
|
|
|
27120
27130
|
},
|
|
27121
27131
|
[effectiveGroupId]
|
|
27122
27132
|
);
|
|
27123
|
-
const buyPlan =
|
|
27133
|
+
const buyPlan = React55.useCallback(
|
|
27124
27134
|
(planId) => {
|
|
27125
27135
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27126
27136
|
kind: "plan",
|
|
@@ -27137,7 +27147,7 @@ var BuyCreditsDialog = ({
|
|
|
27137
27147
|
},
|
|
27138
27148
|
[redirectTo, effectiveGroupId]
|
|
27139
27149
|
);
|
|
27140
|
-
const buyTopup =
|
|
27150
|
+
const buyTopup = React55.useCallback(
|
|
27141
27151
|
(topupId) => {
|
|
27142
27152
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27143
27153
|
kind: "topup",
|
|
@@ -27314,11 +27324,11 @@ var shareKindLabel = (share) => {
|
|
|
27314
27324
|
return KIND_LABELS[kind] ?? (share.entry_kind === "clawback" ? "Adjustment" : "Earnings");
|
|
27315
27325
|
};
|
|
27316
27326
|
var EarningsSection = ({ dense = false }) => {
|
|
27317
|
-
const [summary, setSummary] =
|
|
27318
|
-
const [loaded, setLoaded] =
|
|
27319
|
-
const [connectBusy, setConnectBusy] =
|
|
27320
|
-
const [error, setError] =
|
|
27321
|
-
const load =
|
|
27327
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27328
|
+
const [loaded, setLoaded] = React55.useState(false);
|
|
27329
|
+
const [connectBusy, setConnectBusy] = React55.useState(false);
|
|
27330
|
+
const [error, setError] = React55.useState(null);
|
|
27331
|
+
const load = React55.useCallback(async () => {
|
|
27322
27332
|
try {
|
|
27323
27333
|
const s = await exports.billingService.getMyEarnings();
|
|
27324
27334
|
setSummary(s);
|
|
@@ -27328,10 +27338,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27328
27338
|
setLoaded(true);
|
|
27329
27339
|
}
|
|
27330
27340
|
}, []);
|
|
27331
|
-
|
|
27341
|
+
React55.useEffect(() => {
|
|
27332
27342
|
void load();
|
|
27333
27343
|
}, [load]);
|
|
27334
|
-
const openConnectOnboarding =
|
|
27344
|
+
const openConnectOnboarding = React55.useCallback(async () => {
|
|
27335
27345
|
setConnectBusy(true);
|
|
27336
27346
|
setError(null);
|
|
27337
27347
|
try {
|
|
@@ -27443,10 +27453,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27443
27453
|
init_billingService();
|
|
27444
27454
|
init_creditCheckoutReturn();
|
|
27445
27455
|
var GroupBillingSection = ({ groupId }) => {
|
|
27446
|
-
const [summary, setSummary] =
|
|
27447
|
-
const [portalBusy, setPortalBusy] =
|
|
27448
|
-
const [portalError, setPortalError] =
|
|
27449
|
-
const openGroupPortal =
|
|
27456
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27457
|
+
const [portalBusy, setPortalBusy] = React55.useState(false);
|
|
27458
|
+
const [portalError, setPortalError] = React55.useState(null);
|
|
27459
|
+
const openGroupPortal = React55.useCallback(async () => {
|
|
27450
27460
|
setPortalBusy(true);
|
|
27451
27461
|
setPortalError(null);
|
|
27452
27462
|
try {
|
|
@@ -27462,21 +27472,21 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27462
27472
|
setPortalBusy(false);
|
|
27463
27473
|
}
|
|
27464
27474
|
}, [groupId]);
|
|
27465
|
-
const [pricing, setPricing] =
|
|
27466
|
-
const [items, setItems] =
|
|
27467
|
-
const [hasMore, setHasMore] =
|
|
27468
|
-
const [moreBusy, setMoreBusy] =
|
|
27469
|
-
const [loading, setLoading] =
|
|
27470
|
-
const [hidden, setHidden] =
|
|
27471
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27472
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27473
|
-
const [earnings, setEarnings] =
|
|
27474
|
-
const [reactivating, setReactivating] =
|
|
27475
|
-
const [reactivationError, setReactivationError] =
|
|
27476
|
-
|
|
27475
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
27476
|
+
const [items, setItems] = React55.useState([]);
|
|
27477
|
+
const [hasMore, setHasMore] = React55.useState(false);
|
|
27478
|
+
const [moreBusy, setMoreBusy] = React55.useState(false);
|
|
27479
|
+
const [loading, setLoading] = React55.useState(true);
|
|
27480
|
+
const [hidden, setHidden] = React55.useState(false);
|
|
27481
|
+
const [addCardOpen, setAddCardOpen] = React55.useState(false);
|
|
27482
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React55.useState(false);
|
|
27483
|
+
const [earnings, setEarnings] = React55.useState(null);
|
|
27484
|
+
const [reactivating, setReactivating] = React55.useState(false);
|
|
27485
|
+
const [reactivationError, setReactivationError] = React55.useState(null);
|
|
27486
|
+
React55.useEffect(() => {
|
|
27477
27487
|
void exports.billingService.getGasPricing().then(setPricing);
|
|
27478
27488
|
}, []);
|
|
27479
|
-
|
|
27489
|
+
React55.useEffect(() => {
|
|
27480
27490
|
let cancelled = false;
|
|
27481
27491
|
exports.billingService.getGroupEarnings(groupId).then((e) => {
|
|
27482
27492
|
if (!cancelled) setEarnings(e);
|
|
@@ -27486,7 +27496,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27486
27496
|
cancelled = true;
|
|
27487
27497
|
};
|
|
27488
27498
|
}, [groupId]);
|
|
27489
|
-
const load =
|
|
27499
|
+
const load = React55.useCallback(async () => {
|
|
27490
27500
|
setLoading(true);
|
|
27491
27501
|
try {
|
|
27492
27502
|
const s = await exports.billingService.getGroupBilling(groupId);
|
|
@@ -27499,10 +27509,10 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27499
27509
|
setLoading(false);
|
|
27500
27510
|
}
|
|
27501
27511
|
}, [groupId]);
|
|
27502
|
-
|
|
27512
|
+
React55.useEffect(() => {
|
|
27503
27513
|
void load();
|
|
27504
27514
|
}, [load]);
|
|
27505
|
-
|
|
27515
|
+
React55.useEffect(() => {
|
|
27506
27516
|
const reloadMatchingGroup = (event) => {
|
|
27507
27517
|
const detail = event.detail;
|
|
27508
27518
|
if (detail?.groupId === groupId) void load();
|
|
@@ -27510,7 +27520,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27510
27520
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27511
27521
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27512
27522
|
}, [groupId, load]);
|
|
27513
|
-
const loadMore =
|
|
27523
|
+
const loadMore = React55.useCallback(async () => {
|
|
27514
27524
|
const last = items[items.length - 1];
|
|
27515
27525
|
if (!last || moreBusy) return;
|
|
27516
27526
|
setMoreBusy(true);
|
|
@@ -27527,7 +27537,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27527
27537
|
setMoreBusy(false);
|
|
27528
27538
|
}
|
|
27529
27539
|
}, [groupId, items, moreBusy]);
|
|
27530
|
-
const reactivate =
|
|
27540
|
+
const reactivate = React55.useCallback(async () => {
|
|
27531
27541
|
setReactivating(true);
|
|
27532
27542
|
setReactivationError(null);
|
|
27533
27543
|
try {
|
|
@@ -27746,8 +27756,8 @@ var SeriesLine = ({
|
|
|
27746
27756
|
formatUsdMicros(Math.round(usd2 * 1e6))
|
|
27747
27757
|
] });
|
|
27748
27758
|
var DailySpendChart = ({ summary }) => {
|
|
27749
|
-
const [hovered, setHovered] =
|
|
27750
|
-
const rows =
|
|
27759
|
+
const [hovered, setHovered] = React55.useState(null);
|
|
27760
|
+
const rows = React55.useMemo(() => {
|
|
27751
27761
|
const byDay = /* @__PURE__ */ new Map();
|
|
27752
27762
|
for (const p of summary.daily ?? []) {
|
|
27753
27763
|
const parsed = new Date(p.day);
|
|
@@ -27855,7 +27865,7 @@ var BTN = "inline-flex h-8 shrink-0 items-center rounded-md border border-border
|
|
|
27855
27865
|
var BTN_STRONG = "inline-flex h-8 shrink-0 items-center rounded-md border border-border-default bg-surface px-3 text-[12px] font-medium text-text-primary transition-colors hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50";
|
|
27856
27866
|
var METER_TRACK = "h-1 overflow-hidden rounded-full bg-raised";
|
|
27857
27867
|
var BreakdownCard = ({ title, rows, color, minuteRate, labelFor: labelFor2, countNoun }) => {
|
|
27858
|
-
const displayRows =
|
|
27868
|
+
const displayRows = React55.useMemo(() => {
|
|
27859
27869
|
if (!labelFor2) return rows;
|
|
27860
27870
|
const merged = /* @__PURE__ */ new Map();
|
|
27861
27871
|
for (const r of rows) {
|
|
@@ -27918,27 +27928,28 @@ var Banner = ({
|
|
|
27918
27928
|
);
|
|
27919
27929
|
};
|
|
27920
27930
|
var BillingCenter = ({ dense = false }) => {
|
|
27921
|
-
const [summary, setSummary] =
|
|
27922
|
-
const [pricing, setPricing] =
|
|
27923
|
-
const [items, setItems] =
|
|
27924
|
-
const [hasMore, setHasMore] =
|
|
27925
|
-
const [moreBusy, setMoreBusy] =
|
|
27926
|
-
const [expandedGroup, setExpandedGroup] =
|
|
27927
|
-
const [notConfigured, setNotConfigured] =
|
|
27928
|
-
const [loading, setLoading] =
|
|
27929
|
-
const [loadError, setLoadError] =
|
|
27930
|
-
const [portalBusy, setPortalBusy] =
|
|
27931
|
-
const [portalError, setPortalError] =
|
|
27932
|
-
const [reactivating, setReactivating] =
|
|
27933
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27934
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27935
|
-
const load =
|
|
27931
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27932
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
27933
|
+
const [items, setItems] = React55.useState([]);
|
|
27934
|
+
const [hasMore, setHasMore] = React55.useState(false);
|
|
27935
|
+
const [moreBusy, setMoreBusy] = React55.useState(false);
|
|
27936
|
+
const [expandedGroup, setExpandedGroup] = React55.useState(null);
|
|
27937
|
+
const [notConfigured, setNotConfigured] = React55.useState(false);
|
|
27938
|
+
const [loading, setLoading] = React55.useState(true);
|
|
27939
|
+
const [loadError, setLoadError] = React55.useState(null);
|
|
27940
|
+
const [portalBusy, setPortalBusy] = React55.useState(false);
|
|
27941
|
+
const [portalError, setPortalError] = React55.useState(null);
|
|
27942
|
+
const [reactivating, setReactivating] = React55.useState(false);
|
|
27943
|
+
const [addCardOpen, setAddCardOpen] = React55.useState(false);
|
|
27944
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React55.useState(false);
|
|
27945
|
+
const load = React55.useCallback(async () => {
|
|
27936
27946
|
setLoading(true);
|
|
27937
27947
|
setLoadError(null);
|
|
27938
27948
|
try {
|
|
27939
27949
|
const s = await exports.billingService.getMyBilling();
|
|
27950
|
+
setNotConfigured(s === null);
|
|
27940
27951
|
if (s === null) {
|
|
27941
|
-
|
|
27952
|
+
setSummary(null);
|
|
27942
27953
|
} else {
|
|
27943
27954
|
setSummary(s);
|
|
27944
27955
|
setItems(s.recent_line_items);
|
|
@@ -27950,16 +27961,16 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27950
27961
|
setLoading(false);
|
|
27951
27962
|
}
|
|
27952
27963
|
}, []);
|
|
27953
|
-
|
|
27964
|
+
React55.useEffect(() => {
|
|
27954
27965
|
void load();
|
|
27955
|
-
void exports.billingService.getGasPricing().then(setPricing);
|
|
27966
|
+
void exports.billingService.getGasPricing().then(setPricing).catch(() => setPricing(null));
|
|
27956
27967
|
}, [load]);
|
|
27957
|
-
|
|
27968
|
+
React55.useEffect(() => {
|
|
27958
27969
|
const reloadAfterCheckout = () => void load();
|
|
27959
27970
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
27960
27971
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
27961
27972
|
}, [load]);
|
|
27962
|
-
const loadMore =
|
|
27973
|
+
const loadMore = React55.useCallback(async () => {
|
|
27963
27974
|
const last = items[items.length - 1];
|
|
27964
27975
|
if (!last || moreBusy) return;
|
|
27965
27976
|
setMoreBusy(true);
|
|
@@ -27973,7 +27984,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27973
27984
|
setMoreBusy(false);
|
|
27974
27985
|
}
|
|
27975
27986
|
}, [items, moreBusy]);
|
|
27976
|
-
const openPortal =
|
|
27987
|
+
const openPortal = React55.useCallback(async () => {
|
|
27977
27988
|
setPortalBusy(true);
|
|
27978
27989
|
setPortalError(null);
|
|
27979
27990
|
try {
|
|
@@ -27984,7 +27995,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27984
27995
|
setPortalBusy(false);
|
|
27985
27996
|
}
|
|
27986
27997
|
}, []);
|
|
27987
|
-
const reactivate =
|
|
27998
|
+
const reactivate = React55.useCallback(async () => {
|
|
27988
27999
|
setReactivating(true);
|
|
27989
28000
|
setPortalError(null);
|
|
27990
28001
|
try {
|
|
@@ -27997,18 +28008,6 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27997
28008
|
}
|
|
27998
28009
|
}, [load]);
|
|
27999
28010
|
const outerClass = dense ? "px-1 py-2" : "mx-auto max-w-5xl px-4 py-6";
|
|
28000
|
-
if (notConfigured) {
|
|
28001
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28002
|
-
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28003
|
-
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
28004
|
-
"Usage & billing",
|
|
28005
|
-
!isLiveMode() && paymentsUrlMap() && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 align-middle inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wider bg-amber-500/15 text-amber-600 ring-1 ring-amber-500/40", children: "Test mode" })
|
|
28006
|
-
] }),
|
|
28007
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-text-muted", children: "Metered AI and on-chain usage." })
|
|
28008
|
-
] }),
|
|
28009
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${CARD} px-4 py-10 text-center text-[13px] text-text-muted`, children: "Billing is not enabled on this deployment." })
|
|
28010
|
-
] });
|
|
28011
|
-
}
|
|
28012
28011
|
const totals = summary?.period_totals ?? [];
|
|
28013
28012
|
const payableTotal = totals.reduce((acc, t) => acc + t.amount_usd_micros, 0);
|
|
28014
28013
|
const personalTotal = summary?.spend?.period_usd_micros ?? payableTotal;
|
|
@@ -28025,7 +28024,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28025
28024
|
const breakdownCount = [llmBreakdown, gasBreakdown, knowledgeBreakdown].filter(
|
|
28026
28025
|
(rows) => rows.length > 0
|
|
28027
28026
|
).length;
|
|
28028
|
-
const meterKeys =
|
|
28027
|
+
const meterKeys = React55.useMemo(
|
|
28029
28028
|
() => [
|
|
28030
28029
|
"llm_usage_usd",
|
|
28031
28030
|
"gas_usage_usd",
|
|
@@ -28039,10 +28038,10 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28039
28038
|
(g) => g.credit_plan_id && g.status === "active"
|
|
28040
28039
|
) ?? null;
|
|
28041
28040
|
const tokenCardGated = billingGateInfoForActiveToken().cardRequired;
|
|
28042
|
-
const [sponsorBusy, setSponsorBusy] =
|
|
28043
|
-
const [sponsorError, setSponsorError] =
|
|
28044
|
-
const [autoBind, setAutoBind] =
|
|
28045
|
-
|
|
28041
|
+
const [sponsorBusy, setSponsorBusy] = React55.useState(false);
|
|
28042
|
+
const [sponsorError, setSponsorError] = React55.useState(null);
|
|
28043
|
+
const [autoBind, setAutoBind] = React55.useState("idle");
|
|
28044
|
+
React55.useEffect(() => {
|
|
28046
28045
|
if (autoBind !== "idle") return;
|
|
28047
28046
|
if (!summary?.card_required || !tokenCardGated || !platformGroup) return;
|
|
28048
28047
|
setAutoBind("trying");
|
|
@@ -28050,7 +28049,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28050
28049
|
if (bound) await load();
|
|
28051
28050
|
}).finally(() => setAutoBind("settled"));
|
|
28052
28051
|
}, [summary, tokenCardGated, platformGroup, autoBind]);
|
|
28053
|
-
const billViaGroup =
|
|
28052
|
+
const billViaGroup = React55.useCallback(async () => {
|
|
28054
28053
|
if (!platformGroup || sponsorBusy) return;
|
|
28055
28054
|
setSponsorBusy(true);
|
|
28056
28055
|
setSponsorError(null);
|
|
@@ -28084,6 +28083,18 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28084
28083
|
const creditExhausted = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros <= 0;
|
|
28085
28084
|
const creditLow = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros > 0 && creditGrantMicros != null && creditBalanceMicros < creditGrantMicros * 0.15;
|
|
28086
28085
|
const recoveryAction = summary ? billingRecoveryAction(summary) : null;
|
|
28086
|
+
if (notConfigured) {
|
|
28087
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28088
|
+
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
28090
|
+
"Usage & billing",
|
|
28091
|
+
!isLiveMode() && paymentsUrlMap() && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 align-middle inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wider bg-amber-500/15 text-amber-600 ring-1 ring-amber-500/40", children: "Test mode" })
|
|
28092
|
+
] }),
|
|
28093
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-text-muted", children: "Metered AI and on-chain usage." })
|
|
28094
|
+
] }),
|
|
28095
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${CARD} px-4 py-10 text-center text-[13px] text-text-muted`, children: "Billing is not enabled on this deployment." })
|
|
28096
|
+
] });
|
|
28097
|
+
}
|
|
28087
28098
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28088
28099
|
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28089
28100
|
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
@@ -28422,9 +28433,9 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28422
28433
|
init_cardRequired();
|
|
28423
28434
|
init_billingService();
|
|
28424
28435
|
var CardRequiredHost = () => {
|
|
28425
|
-
const [request, setRequest] =
|
|
28426
|
-
|
|
28427
|
-
|
|
28436
|
+
const [request, setRequest] = React55.useState(null);
|
|
28437
|
+
React55.useEffect(() => exports.cardRequiredGate.subscribe(setRequest), []);
|
|
28438
|
+
React55.useEffect(() => {
|
|
28428
28439
|
let inFlight = false;
|
|
28429
28440
|
const heal = async () => {
|
|
28430
28441
|
if (inFlight) return;
|
|
@@ -28508,11 +28519,11 @@ var PENDING_RETURN_NOTICE = {
|
|
|
28508
28519
|
message: "Stripe confirmation is taking longer than usual, so this purchase is not confirmed yet. Check again now or return to this page shortly. To avoid a duplicate charge, don\u2019t purchase again until Billing shows the final result."
|
|
28509
28520
|
};
|
|
28510
28521
|
var CreditExhaustedHost = () => {
|
|
28511
|
-
const [request, setRequest] =
|
|
28512
|
-
const [checkoutNotice, setCheckoutNotice] =
|
|
28513
|
-
const [retryMarker, setRetryMarker] =
|
|
28514
|
-
|
|
28515
|
-
|
|
28522
|
+
const [request, setRequest] = React55.useState(null);
|
|
28523
|
+
const [checkoutNotice, setCheckoutNotice] = React55.useState(null);
|
|
28524
|
+
const [retryMarker, setRetryMarker] = React55.useState(null);
|
|
28525
|
+
React55.useEffect(() => creditRequiredGate.subscribe(setRequest), []);
|
|
28526
|
+
React55.useEffect(() => {
|
|
28516
28527
|
const parsedMarker = readCreditCheckoutReturnMarker();
|
|
28517
28528
|
if (!parsedMarker) return;
|
|
28518
28529
|
const marker = parsedMarker;
|
|
@@ -28718,12 +28729,12 @@ function VerifiedBadge({
|
|
|
28718
28729
|
}
|
|
28719
28730
|
function IdentityCard() {
|
|
28720
28731
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
28721
|
-
const [credentials, setCredentials] =
|
|
28722
|
-
const [profile, setProfile] =
|
|
28723
|
-
const [loading, setLoading] =
|
|
28724
|
-
const [activeKyc, setActiveKyc] =
|
|
28725
|
-
const [error, setError] =
|
|
28726
|
-
|
|
28732
|
+
const [credentials, setCredentials] = React55.useState([]);
|
|
28733
|
+
const [profile, setProfile] = React55.useState(null);
|
|
28734
|
+
const [loading, setLoading] = React55.useState(true);
|
|
28735
|
+
const [activeKyc, setActiveKyc] = React55.useState(null);
|
|
28736
|
+
const [error, setError] = React55.useState(null);
|
|
28737
|
+
React55.useEffect(() => {
|
|
28727
28738
|
let cancelled = false;
|
|
28728
28739
|
(async () => {
|
|
28729
28740
|
try {
|
|
@@ -28860,10 +28871,10 @@ function LoginAltMethods({ exclude, platform, onSuccess } = {}) {
|
|
|
28860
28871
|
const navigate = useWalletNavigate();
|
|
28861
28872
|
const { bootstrapSession } = useAuth();
|
|
28862
28873
|
const { config, isLoading } = useProviderConfig();
|
|
28863
|
-
const [busyId, setBusyId] =
|
|
28864
|
-
const [error, setError] =
|
|
28865
|
-
const [passkeySupported, setPasskeySupported] =
|
|
28866
|
-
|
|
28874
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
28875
|
+
const [error, setError] = React55.useState(null);
|
|
28876
|
+
const [passkeySupported, setPasskeySupported] = React55.useState(false);
|
|
28877
|
+
React55.useEffect(() => {
|
|
28867
28878
|
setPasskeySupported(typeof window !== "undefined" && !!window.PublicKeyCredential);
|
|
28868
28879
|
}, []);
|
|
28869
28880
|
if (isLoading || !config) return null;
|
|
@@ -29029,25 +29040,25 @@ function useForm({
|
|
|
29029
29040
|
schema,
|
|
29030
29041
|
onSubmit
|
|
29031
29042
|
}) {
|
|
29032
|
-
const [state, setState] =
|
|
29043
|
+
const [state, setState] = React55.useState({
|
|
29033
29044
|
values: initialValues,
|
|
29034
29045
|
errors: {},
|
|
29035
29046
|
touched: {}
|
|
29036
29047
|
});
|
|
29037
|
-
const handleChange =
|
|
29048
|
+
const handleChange = React55.useCallback((name, value) => {
|
|
29038
29049
|
setState((prev) => ({
|
|
29039
29050
|
...prev,
|
|
29040
29051
|
values: { ...prev.values, [name]: value },
|
|
29041
29052
|
touched: { ...prev.touched, [name]: true }
|
|
29042
29053
|
}));
|
|
29043
29054
|
}, []);
|
|
29044
|
-
const handleBlur =
|
|
29055
|
+
const handleBlur = React55.useCallback((name) => {
|
|
29045
29056
|
setState((prev) => ({
|
|
29046
29057
|
...prev,
|
|
29047
29058
|
touched: { ...prev.touched, [name]: true }
|
|
29048
29059
|
}));
|
|
29049
29060
|
}, []);
|
|
29050
|
-
const validate =
|
|
29061
|
+
const validate = React55.useCallback(() => {
|
|
29051
29062
|
try {
|
|
29052
29063
|
schema.parse(state.values);
|
|
29053
29064
|
setState((prev) => ({ ...prev, errors: {} }));
|
|
@@ -29063,13 +29074,13 @@ function useForm({
|
|
|
29063
29074
|
return false;
|
|
29064
29075
|
}
|
|
29065
29076
|
}, [schema, state.values]);
|
|
29066
|
-
const handleSubmit =
|
|
29077
|
+
const handleSubmit = React55.useCallback(async (e) => {
|
|
29067
29078
|
e.preventDefault();
|
|
29068
29079
|
if (validate()) {
|
|
29069
29080
|
await onSubmit(state.values);
|
|
29070
29081
|
}
|
|
29071
29082
|
}, [onSubmit, state.values, validate]);
|
|
29072
|
-
const reset =
|
|
29083
|
+
const reset = React55.useCallback(() => {
|
|
29073
29084
|
setState({
|
|
29074
29085
|
values: initialValues,
|
|
29075
29086
|
errors: {},
|
|
@@ -29114,9 +29125,9 @@ var defaultFormConfig = {
|
|
|
29114
29125
|
function useLogin(options = {}) {
|
|
29115
29126
|
const navigate = useWalletNavigate();
|
|
29116
29127
|
const { login: contextLogin, isLoading: contextLoading, error: contextError, clearError: contextClearError, user } = useAuth();
|
|
29117
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29118
|
-
const [error, setError] =
|
|
29119
|
-
const [isAuthenticated, setIsAuthenticated] =
|
|
29128
|
+
const [isSubmitting, setIsSubmitting] = React55.useState(false);
|
|
29129
|
+
const [error, setError] = React55.useState(null);
|
|
29130
|
+
const [isAuthenticated, setIsAuthenticated] = React55.useState(exports.authService.isAuthenticated());
|
|
29120
29131
|
const {
|
|
29121
29132
|
services = ["vault", "payments"],
|
|
29122
29133
|
redirectPath = "/dashboard",
|
|
@@ -29126,11 +29137,11 @@ function useLogin(options = {}) {
|
|
|
29126
29137
|
showErrorMessages = true,
|
|
29127
29138
|
platform: optionsPlatform
|
|
29128
29139
|
} = options;
|
|
29129
|
-
const clearError =
|
|
29140
|
+
const clearError = React55.useCallback(() => {
|
|
29130
29141
|
setError(null);
|
|
29131
29142
|
contextClearError();
|
|
29132
29143
|
}, [contextClearError]);
|
|
29133
|
-
const login =
|
|
29144
|
+
const login = React55.useCallback(async (credentials) => {
|
|
29134
29145
|
try {
|
|
29135
29146
|
setIsSubmitting(true);
|
|
29136
29147
|
setError(null);
|
|
@@ -29384,8 +29395,8 @@ function AccessFlowBody({
|
|
|
29384
29395
|
onSelectPlatform
|
|
29385
29396
|
}) {
|
|
29386
29397
|
const { isAuthenticated } = useAuth();
|
|
29387
|
-
const [mode, setMode] =
|
|
29388
|
-
const handleWizardComplete =
|
|
29398
|
+
const [mode, setMode] = React55.useState(initialMode);
|
|
29399
|
+
const handleWizardComplete = React55.useCallback(
|
|
29389
29400
|
(destination) => {
|
|
29390
29401
|
if (destination === "/login") {
|
|
29391
29402
|
setMode("login");
|
|
@@ -29438,8 +29449,8 @@ init_chainAccountRequired();
|
|
|
29438
29449
|
// src/ui/account/ChainAccountRequiredHost.tsx
|
|
29439
29450
|
init_chainAccountRequired();
|
|
29440
29451
|
var ChainAccountRequiredHost = () => {
|
|
29441
|
-
const [request, setRequest] =
|
|
29442
|
-
|
|
29452
|
+
const [request, setRequest] = React55.useState(null);
|
|
29453
|
+
React55.useEffect(() => exports.chainAccountRequiredGate.subscribe(setRequest), []);
|
|
29443
29454
|
if (!request) return null;
|
|
29444
29455
|
const key = `${request.context.entityKind}:${request.context.entityId}:${request.context.chainId}`;
|
|
29445
29456
|
return /* @__PURE__ */ jsxRuntime.jsx(ChainAccountActivationDialog, { request }, key);
|
|
@@ -29447,10 +29458,10 @@ var ChainAccountRequiredHost = () => {
|
|
|
29447
29458
|
var ChainAccountActivationDialog = ({ request }) => {
|
|
29448
29459
|
const mode = chainAccountMode(request.context);
|
|
29449
29460
|
const label = mode === "test" ? "Test" : "Live";
|
|
29450
|
-
const [started, setStarted] =
|
|
29451
|
-
const [waitingForVerification, setWaitingForVerification] =
|
|
29452
|
-
const [status, setStatus] =
|
|
29453
|
-
const [error, setError] =
|
|
29461
|
+
const [started, setStarted] = React55.useState(false);
|
|
29462
|
+
const [waitingForVerification, setWaitingForVerification] = React55.useState(false);
|
|
29463
|
+
const [status, setStatus] = React55.useState(null);
|
|
29464
|
+
const [error, setError] = React55.useState(null);
|
|
29454
29465
|
async function activate(verificationAttempted = false) {
|
|
29455
29466
|
setStarted(true);
|
|
29456
29467
|
setError(null);
|
|
@@ -29573,8 +29584,8 @@ init_walletIdentity();
|
|
|
29573
29584
|
init_verificationsService();
|
|
29574
29585
|
init_ProviderConfigContext();
|
|
29575
29586
|
var VerificationRequiredHost = () => {
|
|
29576
|
-
const [request, setRequest] =
|
|
29577
|
-
|
|
29587
|
+
const [request, setRequest] = React55.useState(null);
|
|
29588
|
+
React55.useEffect(() => verificationRequiredGate.subscribe(setRequest), []);
|
|
29578
29589
|
if (!request) return null;
|
|
29579
29590
|
return /* @__PURE__ */ jsxRuntime.jsx(VerificationDialog, { request }, request.context.profile ?? "default");
|
|
29580
29591
|
};
|
|
@@ -29583,12 +29594,12 @@ var VerificationDialog = ({
|
|
|
29583
29594
|
}) => {
|
|
29584
29595
|
const { context } = request;
|
|
29585
29596
|
const { config } = useProviderConfig();
|
|
29586
|
-
const [activeProvider, setActiveProvider] =
|
|
29587
|
-
const [checking, setChecking] =
|
|
29588
|
-
const [error, setError] =
|
|
29589
|
-
const [isGroupManager, setIsGroupManager] =
|
|
29597
|
+
const [activeProvider, setActiveProvider] = React55.useState(null);
|
|
29598
|
+
const [checking, setChecking] = React55.useState(false);
|
|
29599
|
+
const [error, setError] = React55.useState(null);
|
|
29600
|
+
const [isGroupManager, setIsGroupManager] = React55.useState(null);
|
|
29590
29601
|
const hasGroupMiss = context.missing.some((m) => m.subject_kind === "group");
|
|
29591
|
-
|
|
29602
|
+
React55.useEffect(() => {
|
|
29592
29603
|
if (!hasGroupMiss || !context.groupId) return;
|
|
29593
29604
|
let cancelled = false;
|
|
29594
29605
|
groupsService.getGroupDetails(context.groupId).then((g) => {
|
|
@@ -29765,25 +29776,25 @@ function BusinessVerificationSection({
|
|
|
29765
29776
|
initialStatus
|
|
29766
29777
|
}) {
|
|
29767
29778
|
const { config } = useProviderConfig();
|
|
29768
|
-
const [status, setStatus] =
|
|
29769
|
-
const [flowInstance, setFlowInstance] =
|
|
29770
|
-
const [error, setError] =
|
|
29771
|
-
const [busy, setBusy] =
|
|
29772
|
-
const kybInstances =
|
|
29779
|
+
const [status, setStatus] = React55__default.default.useState(initialStatus ?? "not_required");
|
|
29780
|
+
const [flowInstance, setFlowInstance] = React55__default.default.useState(null);
|
|
29781
|
+
const [error, setError] = React55__default.default.useState(null);
|
|
29782
|
+
const [busy, setBusy] = React55__default.default.useState(false);
|
|
29783
|
+
const kybInstances = React55__default.default.useMemo(
|
|
29773
29784
|
() => (config?.kyc.enabled ?? []).filter(
|
|
29774
29785
|
(id) => config?.kyc.settings[id]?.subject === "group"
|
|
29775
29786
|
),
|
|
29776
29787
|
[config]
|
|
29777
29788
|
);
|
|
29778
29789
|
const entityDefault = config?.kyc.entity_default_profile ?? null;
|
|
29779
|
-
const refreshStatus =
|
|
29790
|
+
const refreshStatus = React55__default.default.useCallback(async () => {
|
|
29780
29791
|
try {
|
|
29781
29792
|
const s = await getIdentityStatus({ groupId });
|
|
29782
29793
|
setStatus(s.status === "unverified" ? "unverified" : s.status);
|
|
29783
29794
|
} catch {
|
|
29784
29795
|
}
|
|
29785
29796
|
}, [groupId]);
|
|
29786
|
-
|
|
29797
|
+
React55__default.default.useEffect(() => {
|
|
29787
29798
|
if (initialStatus !== void 0) setStatus(initialStatus);
|
|
29788
29799
|
}, [initialStatus]);
|
|
29789
29800
|
const startFlow = async (bindFirst) => {
|
|
@@ -30519,31 +30530,31 @@ function readDelegationGroupId() {
|
|
|
30519
30530
|
function useIncomingPayments(options = {}) {
|
|
30520
30531
|
const { entityId: entityIdOverride, walletId: walletIdOverride, disableLiveRefresh } = options;
|
|
30521
30532
|
const { user, isAuthenticated } = useAuth();
|
|
30522
|
-
const [delegationGroupId, setDelegationGroupId] =
|
|
30533
|
+
const [delegationGroupId, setDelegationGroupId] = React55.useState(
|
|
30523
30534
|
() => readDelegationGroupId()
|
|
30524
30535
|
);
|
|
30525
|
-
|
|
30536
|
+
React55.useEffect(() => {
|
|
30526
30537
|
setDelegationGroupId(readDelegationGroupId());
|
|
30527
30538
|
}, [isAuthenticated, user?.id]);
|
|
30528
|
-
const activeEntityId =
|
|
30539
|
+
const activeEntityId = React55.useMemo(() => {
|
|
30529
30540
|
if (entityIdOverride !== void 0) return entityIdOverride;
|
|
30530
30541
|
if (delegationGroupId) return delegationGroupId;
|
|
30531
30542
|
return user?.id ?? null;
|
|
30532
30543
|
}, [entityIdOverride, delegationGroupId, user?.id]);
|
|
30533
30544
|
const activeWalletId = walletIdOverride ?? user?.default_wallet_id ?? null;
|
|
30534
|
-
const [payments, setPayments] =
|
|
30535
|
-
const [contracts, setContracts] =
|
|
30536
|
-
const [swaps, setSwaps] =
|
|
30537
|
-
const [loading, setLoading] =
|
|
30538
|
-
const [error, setError] =
|
|
30539
|
-
const [acceptState, setAcceptState] =
|
|
30540
|
-
const inflightRef =
|
|
30541
|
-
const activeEntityIdRef =
|
|
30542
|
-
|
|
30545
|
+
const [payments, setPayments] = React55.useState([]);
|
|
30546
|
+
const [contracts, setContracts] = React55.useState([]);
|
|
30547
|
+
const [swaps, setSwaps] = React55.useState([]);
|
|
30548
|
+
const [loading, setLoading] = React55.useState(false);
|
|
30549
|
+
const [error, setError] = React55.useState(null);
|
|
30550
|
+
const [acceptState, setAcceptState] = React55.useState({ itemKey: null, error: null });
|
|
30551
|
+
const inflightRef = React55.useRef(null);
|
|
30552
|
+
const activeEntityIdRef = React55.useRef(activeEntityId);
|
|
30553
|
+
React55.useEffect(() => {
|
|
30543
30554
|
activeEntityIdRef.current = activeEntityId;
|
|
30544
30555
|
setDelegationGroupId(readDelegationGroupId());
|
|
30545
30556
|
});
|
|
30546
|
-
const fetchAll =
|
|
30557
|
+
const fetchAll = React55.useCallback(async () => {
|
|
30547
30558
|
if (!isAuthenticated || !activeEntityId) {
|
|
30548
30559
|
setPayments([]);
|
|
30549
30560
|
setContracts([]);
|
|
@@ -30594,10 +30605,10 @@ function useIncomingPayments(options = {}) {
|
|
|
30594
30605
|
inflightRef.current = work;
|
|
30595
30606
|
return work;
|
|
30596
30607
|
}, [isAuthenticated, activeEntityId, activeWalletId]);
|
|
30597
|
-
|
|
30608
|
+
React55.useEffect(() => {
|
|
30598
30609
|
void fetchAll();
|
|
30599
30610
|
}, [fetchAll]);
|
|
30600
|
-
|
|
30611
|
+
React55.useEffect(() => {
|
|
30601
30612
|
if (disableLiveRefresh) return;
|
|
30602
30613
|
if (!isAuthenticated || !activeEntityId) return;
|
|
30603
30614
|
const unsub = subscribeEntityEvents(activeEntityId, (event) => {
|
|
@@ -30609,12 +30620,12 @@ function useIncomingPayments(options = {}) {
|
|
|
30609
30620
|
unsub();
|
|
30610
30621
|
};
|
|
30611
30622
|
}, [isAuthenticated, activeEntityId, disableLiveRefresh, fetchAll]);
|
|
30612
|
-
const items =
|
|
30623
|
+
const items = React55.useMemo(
|
|
30613
30624
|
() => buildInbox({ payments, contracts, swaps, activeEntityId }),
|
|
30614
30625
|
[payments, contracts, swaps, activeEntityId]
|
|
30615
30626
|
);
|
|
30616
|
-
const groups =
|
|
30617
|
-
const accept =
|
|
30627
|
+
const groups = React55.useMemo(() => groupInbox(items), [items]);
|
|
30628
|
+
const accept = React55.useCallback(
|
|
30618
30629
|
async (item) => {
|
|
30619
30630
|
setAcceptState({ itemKey: item.key, error: null });
|
|
30620
30631
|
try {
|
|
@@ -30639,7 +30650,7 @@ function useIncomingPayments(options = {}) {
|
|
|
30639
30650
|
},
|
|
30640
30651
|
[]
|
|
30641
30652
|
);
|
|
30642
|
-
const cancel =
|
|
30653
|
+
const cancel = React55.useCallback(async (paymentId) => {
|
|
30643
30654
|
try {
|
|
30644
30655
|
await paymentsService.cancelPayment({ paymentId });
|
|
30645
30656
|
setPayments((prev) => prev.filter((p) => p.id !== paymentId));
|
|
@@ -30668,14 +30679,14 @@ function resetDecimalsWarningCache() {
|
|
|
30668
30679
|
warnedTokenIds.clear();
|
|
30669
30680
|
}
|
|
30670
30681
|
function useDecimalsCore(payments, walletAddress) {
|
|
30671
|
-
const [cache2, setCache] =
|
|
30672
|
-
const [cacheErrors, setCacheErrors] =
|
|
30673
|
-
const fetchingRef =
|
|
30674
|
-
const cacheRef =
|
|
30675
|
-
|
|
30682
|
+
const [cache2, setCache] = React55.useState(/* @__PURE__ */ new Map());
|
|
30683
|
+
const [cacheErrors, setCacheErrors] = React55.useState(/* @__PURE__ */ new Map());
|
|
30684
|
+
const fetchingRef = React55.useRef(/* @__PURE__ */ new Set());
|
|
30685
|
+
const cacheRef = React55.useRef(cache2);
|
|
30686
|
+
React55.useEffect(() => {
|
|
30676
30687
|
cacheRef.current = cache2;
|
|
30677
30688
|
}, [cache2]);
|
|
30678
|
-
|
|
30689
|
+
React55.useEffect(() => {
|
|
30679
30690
|
if (!payments || payments.length === 0) return;
|
|
30680
30691
|
const todo = /* @__PURE__ */ new Set();
|
|
30681
30692
|
for (const payment of payments) {
|
|
@@ -30766,7 +30777,7 @@ function useDecimalsCore(payments, walletAddress) {
|
|
|
30766
30777
|
todo.forEach((id) => fetchingRef.current.delete(id));
|
|
30767
30778
|
};
|
|
30768
30779
|
}, [payments, walletAddress]);
|
|
30769
|
-
return
|
|
30780
|
+
return React55.useMemo(() => ({ cache: cache2, cacheErrors }), [cache2, cacheErrors]);
|
|
30770
30781
|
}
|
|
30771
30782
|
function usePaymentDecimals(payments, walletAddress) {
|
|
30772
30783
|
const { cache: cache2 } = useDecimalsCore(payments, walletAddress);
|
|
@@ -30971,7 +30982,7 @@ var IncomingPaymentsInbox = ({
|
|
|
30971
30982
|
...hookOptions
|
|
30972
30983
|
}) => {
|
|
30973
30984
|
const inbox = useIncomingPayments(hookOptions);
|
|
30974
|
-
const allPayments =
|
|
30985
|
+
const allPayments = React55__default.default.useMemo(
|
|
30975
30986
|
() => [
|
|
30976
30987
|
...inbox.payments,
|
|
30977
30988
|
...inbox.contracts.flatMap((c) => c.payments ?? [])
|
|
@@ -31132,7 +31143,7 @@ var IncomingPaymentsLauncher = ({
|
|
|
31132
31143
|
}) => {
|
|
31133
31144
|
const { isAuthenticated } = useAuth();
|
|
31134
31145
|
const inbox = useIncomingPayments(hookOptions);
|
|
31135
|
-
const [open, setOpen] =
|
|
31146
|
+
const [open, setOpen] = React55.useState(false);
|
|
31136
31147
|
if (hideWhenSignedOut && !isAuthenticated) return null;
|
|
31137
31148
|
const handleClick = onClick ?? (() => setOpen(true));
|
|
31138
31149
|
const count = inbox.items.length;
|
|
@@ -31262,11 +31273,11 @@ function SummaryTile({ label, count }) {
|
|
|
31262
31273
|
] });
|
|
31263
31274
|
}
|
|
31264
31275
|
function useSendPayment() {
|
|
31265
|
-
const [sending, setSending] =
|
|
31266
|
-
const [error, setError] =
|
|
31267
|
-
const [lastResponse, setLastResponse] =
|
|
31268
|
-
const inflightRef =
|
|
31269
|
-
const send =
|
|
31276
|
+
const [sending, setSending] = React55.useState(false);
|
|
31277
|
+
const [error, setError] = React55.useState(null);
|
|
31278
|
+
const [lastResponse, setLastResponse] = React55.useState(null);
|
|
31279
|
+
const inflightRef = React55.useRef(null);
|
|
31280
|
+
const send = React55.useCallback(async (args) => {
|
|
31270
31281
|
if (inflightRef.current) {
|
|
31271
31282
|
return inflightRef.current;
|
|
31272
31283
|
}
|
|
@@ -31294,7 +31305,7 @@ function useSendPayment() {
|
|
|
31294
31305
|
inflightRef.current = work;
|
|
31295
31306
|
return work;
|
|
31296
31307
|
}, []);
|
|
31297
|
-
const reset =
|
|
31308
|
+
const reset = React55.useCallback(() => {
|
|
31298
31309
|
setError(null);
|
|
31299
31310
|
setLastResponse(null);
|
|
31300
31311
|
}, []);
|
|
@@ -31312,13 +31323,13 @@ var SendPaymentForm = ({
|
|
|
31312
31323
|
className = ""
|
|
31313
31324
|
}) => {
|
|
31314
31325
|
const initialAssetId = (defaultAssetId && assets.find((a) => a.id === defaultAssetId)?.id) ?? assets[0]?.id ?? "";
|
|
31315
|
-
const [assetId, setAssetId] =
|
|
31316
|
-
const [amount, setAmount] =
|
|
31317
|
-
const [recipient, setRecipient] =
|
|
31318
|
-
const [recipientMode, setRecipientMode] =
|
|
31319
|
-
const [description, setDescription] =
|
|
31320
|
-
const [validationError, setValidationError] =
|
|
31321
|
-
|
|
31326
|
+
const [assetId, setAssetId] = React55.useState(initialAssetId);
|
|
31327
|
+
const [amount, setAmount] = React55.useState(defaultAmount);
|
|
31328
|
+
const [recipient, setRecipient] = React55.useState(defaultRecipient);
|
|
31329
|
+
const [recipientMode, setRecipientMode] = React55.useState("entity");
|
|
31330
|
+
const [description, setDescription] = React55.useState("");
|
|
31331
|
+
const [validationError, setValidationError] = React55.useState(null);
|
|
31332
|
+
React55.useEffect(() => {
|
|
31322
31333
|
if (assetId === "" && assets.length > 0) {
|
|
31323
31334
|
setAssetId(assets[0].id);
|
|
31324
31335
|
} else if (assetId && !assets.find((a) => a.id === assetId)) {
|