@yieldfabric/wallet 0.2.6 → 0.2.8
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 +736 -712
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +95 -71
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var React39 = 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 React39__default = /*#__PURE__*/_interopDefault(React39);
|
|
24
24
|
var sha3__default = /*#__PURE__*/_interopDefault(sha3);
|
|
25
25
|
var theme__default = /*#__PURE__*/_interopDefault(theme);
|
|
26
26
|
|
|
@@ -4966,7 +4966,7 @@ function WalletConfigProvider({ config, children }) {
|
|
|
4966
4966
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletConfigContext.Provider, { value: config, children });
|
|
4967
4967
|
}
|
|
4968
4968
|
function useWalletConfig() {
|
|
4969
|
-
return
|
|
4969
|
+
return React39.useContext(WalletConfigContext);
|
|
4970
4970
|
}
|
|
4971
4971
|
function useTokenStore() {
|
|
4972
4972
|
const { tokenStore } = useWalletConfig();
|
|
@@ -4993,19 +4993,19 @@ var WalletConfigContext;
|
|
|
4993
4993
|
var init_WalletConfigContext = __esm({
|
|
4994
4994
|
"src/providers/WalletConfigContext.tsx"() {
|
|
4995
4995
|
init_jwtClaims();
|
|
4996
|
-
WalletConfigContext =
|
|
4996
|
+
WalletConfigContext = React39.createContext({});
|
|
4997
4997
|
}
|
|
4998
4998
|
});
|
|
4999
4999
|
function ProviderConfigProvider({
|
|
5000
5000
|
children,
|
|
5001
5001
|
platform
|
|
5002
5002
|
}) {
|
|
5003
|
-
const [state, setState] =
|
|
5003
|
+
const [state, setState] = React39.useState({
|
|
5004
5004
|
config: null,
|
|
5005
5005
|
isLoading: true,
|
|
5006
5006
|
error: null
|
|
5007
5007
|
});
|
|
5008
|
-
|
|
5008
|
+
React39.useEffect(() => {
|
|
5009
5009
|
let cancelled = false;
|
|
5010
5010
|
(async () => {
|
|
5011
5011
|
try {
|
|
@@ -5046,12 +5046,12 @@ function ProviderConfigProvider({
|
|
|
5046
5046
|
return /* @__PURE__ */ jsxRuntime.jsx(ProviderConfigContext.Provider, { value: state, children });
|
|
5047
5047
|
}
|
|
5048
5048
|
function useProviderConfig() {
|
|
5049
|
-
return
|
|
5049
|
+
return React39.useContext(ProviderConfigContext);
|
|
5050
5050
|
}
|
|
5051
5051
|
var ProviderConfigContext, AUTH_BASE5;
|
|
5052
5052
|
var init_ProviderConfigContext = __esm({
|
|
5053
5053
|
"src/providers/ProviderConfigContext.tsx"() {
|
|
5054
|
-
ProviderConfigContext =
|
|
5054
|
+
ProviderConfigContext = React39.createContext({
|
|
5055
5055
|
config: null,
|
|
5056
5056
|
isLoading: true,
|
|
5057
5057
|
error: null
|
|
@@ -5261,7 +5261,7 @@ __export(SignupFlow_exports, {
|
|
|
5261
5261
|
default: () => SignupFlow_default
|
|
5262
5262
|
});
|
|
5263
5263
|
function useRegisterConflictPatch() {
|
|
5264
|
-
|
|
5264
|
+
React39.useEffect(() => {
|
|
5265
5265
|
const original = window.fetch;
|
|
5266
5266
|
window.fetch = async function patchedFetch(input, init) {
|
|
5267
5267
|
const response = await original.call(window, input, init);
|
|
@@ -5284,7 +5284,7 @@ function useRegisterConflictPatch() {
|
|
|
5284
5284
|
}, []);
|
|
5285
5285
|
}
|
|
5286
5286
|
function useAvererCssVars() {
|
|
5287
|
-
|
|
5287
|
+
React39.useEffect(() => {
|
|
5288
5288
|
const root = document.documentElement;
|
|
5289
5289
|
const prior = [];
|
|
5290
5290
|
for (const [name, value] of Object.entries(AVERER_CSS_VARS)) {
|
|
@@ -5416,12 +5416,12 @@ var init_SignupFlow = __esm({
|
|
|
5416
5416
|
};
|
|
5417
5417
|
AvererSigninConsumer = ({ appName, onComplete, onError, platform }) => {
|
|
5418
5418
|
const wallet = avererWebsdk.useAvererWallet();
|
|
5419
|
-
const walletRef =
|
|
5420
|
-
|
|
5419
|
+
const walletRef = React39.useRef(wallet);
|
|
5420
|
+
React39.useEffect(() => {
|
|
5421
5421
|
walletRef.current = wallet;
|
|
5422
5422
|
}, [wallet]);
|
|
5423
|
-
const widgetWrapRef =
|
|
5424
|
-
|
|
5423
|
+
const widgetWrapRef = React39.useRef(null);
|
|
5424
|
+
React39.useEffect(() => {
|
|
5425
5425
|
const root = widgetWrapRef.current;
|
|
5426
5426
|
if (!root) return;
|
|
5427
5427
|
const OVERRIDE_CSS = `
|
|
@@ -5916,8 +5916,8 @@ function decide(snapshot, ctx) {
|
|
|
5916
5916
|
}
|
|
5917
5917
|
function useOnboardingState(identityRequired = false, planApplicable = false, identityProviders = [], kycVerifiesEmail = false) {
|
|
5918
5918
|
const identityProvidersKey = JSON.stringify(identityProviders);
|
|
5919
|
-
const previousIdentityProvidersKey =
|
|
5920
|
-
const [state, setState] =
|
|
5919
|
+
const previousIdentityProvidersKey = React39.useRef(identityProvidersKey);
|
|
5920
|
+
const [state, setState] = React39.useState(() => {
|
|
5921
5921
|
const cached = cachedSnapshotFor(identityProvidersKey, identityProviders);
|
|
5922
5922
|
if (cached) {
|
|
5923
5923
|
return {
|
|
@@ -5932,7 +5932,7 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
|
|
|
5932
5932
|
}
|
|
5933
5933
|
return { status: "checking", snapshot: null };
|
|
5934
5934
|
});
|
|
5935
|
-
|
|
5935
|
+
React39.useEffect(() => {
|
|
5936
5936
|
if (state.status !== "checking") return;
|
|
5937
5937
|
let cancelled = false;
|
|
5938
5938
|
(async () => {
|
|
@@ -5967,14 +5967,14 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
|
|
|
5967
5967
|
cancelled = true;
|
|
5968
5968
|
};
|
|
5969
5969
|
}, [state.status, identityRequired, identityProvidersKey, planApplicable]);
|
|
5970
|
-
|
|
5970
|
+
React39.useEffect(() => {
|
|
5971
5971
|
const notify = () => setState({ status: "checking", snapshot: null });
|
|
5972
5972
|
subscribers.add(notify);
|
|
5973
5973
|
return () => {
|
|
5974
5974
|
subscribers.delete(notify);
|
|
5975
5975
|
};
|
|
5976
5976
|
}, []);
|
|
5977
|
-
|
|
5977
|
+
React39.useEffect(() => {
|
|
5978
5978
|
if (previousIdentityProvidersKey.current !== identityProvidersKey) {
|
|
5979
5979
|
previousIdentityProvidersKey.current = identityProvidersKey;
|
|
5980
5980
|
setState({ status: "checking", snapshot: null });
|
|
@@ -6018,14 +6018,14 @@ function clearDynamicSession() {
|
|
|
6018
6018
|
|
|
6019
6019
|
// src/react/AuthContext.tsx
|
|
6020
6020
|
init_WalletConfigContext();
|
|
6021
|
-
var WalletAuthContext =
|
|
6021
|
+
var WalletAuthContext = React39.createContext(void 0);
|
|
6022
6022
|
function WalletAuthProvider({ children }) {
|
|
6023
6023
|
const { onSessionBootstrapped, onBeforeLogout } = useWalletConfig();
|
|
6024
|
-
const [user, setUser] =
|
|
6025
|
-
const [isLoading, setIsLoading] =
|
|
6026
|
-
const [error, setError] =
|
|
6027
|
-
const [retryTick, setRetryTick] =
|
|
6028
|
-
const retryWhenOnline =
|
|
6024
|
+
const [user, setUser] = React39.useState(null);
|
|
6025
|
+
const [isLoading, setIsLoading] = React39.useState(true);
|
|
6026
|
+
const [error, setError] = React39.useState(null);
|
|
6027
|
+
const [retryTick, setRetryTick] = React39.useState(0);
|
|
6028
|
+
const retryWhenOnline = React39.useCallback(() => {
|
|
6029
6029
|
if (typeof window === "undefined") return;
|
|
6030
6030
|
const once = () => {
|
|
6031
6031
|
window.removeEventListener("online", once);
|
|
@@ -6034,7 +6034,7 @@ function WalletAuthProvider({ children }) {
|
|
|
6034
6034
|
window.addEventListener("online", once);
|
|
6035
6035
|
}, []);
|
|
6036
6036
|
const isAuthenticated = exports.authService.isAuthenticated();
|
|
6037
|
-
|
|
6037
|
+
React39.useEffect(() => {
|
|
6038
6038
|
const loadUserData = async () => {
|
|
6039
6039
|
if (isAuthenticated) {
|
|
6040
6040
|
try {
|
|
@@ -6064,12 +6064,12 @@ function WalletAuthProvider({ children }) {
|
|
|
6064
6064
|
};
|
|
6065
6065
|
loadUserData();
|
|
6066
6066
|
}, [isAuthenticated, retryTick]);
|
|
6067
|
-
|
|
6067
|
+
React39.useEffect(() => {
|
|
6068
6068
|
if (user?.id) {
|
|
6069
6069
|
invalidateWalletCount();
|
|
6070
6070
|
}
|
|
6071
6071
|
}, [user?.id]);
|
|
6072
|
-
|
|
6072
|
+
React39.useEffect(() => {
|
|
6073
6073
|
return () => {
|
|
6074
6074
|
tokenRenewalService.stopRenewal();
|
|
6075
6075
|
};
|
|
@@ -6166,7 +6166,7 @@ function WalletAuthProvider({ children }) {
|
|
|
6166
6166
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletAuthContext.Provider, { value, children });
|
|
6167
6167
|
}
|
|
6168
6168
|
function useAuth() {
|
|
6169
|
-
const context =
|
|
6169
|
+
const context = React39.useContext(WalletAuthContext);
|
|
6170
6170
|
if (context === void 0) {
|
|
6171
6171
|
throw new Error("useAuth must be used within a <WalletAuthProvider>");
|
|
6172
6172
|
}
|
|
@@ -6469,8 +6469,8 @@ function loadModule() {
|
|
|
6469
6469
|
return inflight;
|
|
6470
6470
|
}
|
|
6471
6471
|
function useAvererModule() {
|
|
6472
|
-
const [mod, setMod] =
|
|
6473
|
-
|
|
6472
|
+
const [mod, setMod] = React39.useState(cachedModule);
|
|
6473
|
+
React39.useEffect(() => {
|
|
6474
6474
|
if (mod) return;
|
|
6475
6475
|
let cancelled = false;
|
|
6476
6476
|
loadModule().then((resolved) => {
|
|
@@ -6489,7 +6489,7 @@ function AvererWalletBridgeInner({
|
|
|
6489
6489
|
children
|
|
6490
6490
|
}) {
|
|
6491
6491
|
const wallet = mod.useAvererWallet();
|
|
6492
|
-
|
|
6492
|
+
React39.useEffect(() => {
|
|
6493
6493
|
walletRef.current = wallet ?? null;
|
|
6494
6494
|
}, [wallet, walletRef]);
|
|
6495
6495
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
@@ -6504,8 +6504,8 @@ function LazyAvererSdkGate({
|
|
|
6504
6504
|
const { AvererSdkProvider: AvererSdkProvider3 } = mod;
|
|
6505
6505
|
return /* @__PURE__ */ jsxRuntime.jsx(AvererSdkProvider3, { configId, children: /* @__PURE__ */ jsxRuntime.jsx(AvererWalletBridgeInner, { mod, walletRef, children }) });
|
|
6506
6506
|
}
|
|
6507
|
-
var WalletSignerContext =
|
|
6508
|
-
var SilentSdkBoundary = class extends
|
|
6507
|
+
var WalletSignerContext = React39.createContext(null);
|
|
6508
|
+
var SilentSdkBoundary = class extends React39.Component {
|
|
6509
6509
|
constructor() {
|
|
6510
6510
|
super(...arguments);
|
|
6511
6511
|
this.state = { hasError: false };
|
|
@@ -6525,10 +6525,10 @@ var SilentSdkBoundary = class extends React55.Component {
|
|
|
6525
6525
|
}
|
|
6526
6526
|
};
|
|
6527
6527
|
function usePathname() {
|
|
6528
|
-
const [path, setPath] =
|
|
6528
|
+
const [path, setPath] = React39.useState(
|
|
6529
6529
|
() => typeof window !== "undefined" ? window.location.pathname : "/"
|
|
6530
6530
|
);
|
|
6531
|
-
|
|
6531
|
+
React39.useEffect(() => {
|
|
6532
6532
|
if (typeof window === "undefined") return;
|
|
6533
6533
|
const onChange = () => setPath(window.location.pathname);
|
|
6534
6534
|
window.addEventListener("popstate", onChange);
|
|
@@ -6574,10 +6574,10 @@ function WalletSignerProvider({ children }) {
|
|
|
6574
6574
|
const { isAuthenticated } = useAuth();
|
|
6575
6575
|
const { disableGlobalSigner } = useWalletConfig();
|
|
6576
6576
|
const configId = config?.auth?.settings?.averer?.config_id ?? "";
|
|
6577
|
-
const walletRef =
|
|
6577
|
+
const walletRef = React39.useRef(null);
|
|
6578
6578
|
const pathname = usePathname();
|
|
6579
6579
|
const skipSdkRoute = pathname === "/login" || pathname === "/mcp/login" || pathname.startsWith("/onboarding");
|
|
6580
|
-
const signMessage =
|
|
6580
|
+
const signMessage = React39.useCallback(
|
|
6581
6581
|
async (messageHex, providerHint, ctxOrAddress) => {
|
|
6582
6582
|
const ctx = typeof ctxOrAddress === "string" ? { address: ctxOrAddress } : ctxOrAddress ?? {};
|
|
6583
6583
|
const hint = (providerHint || "").toLowerCase();
|
|
@@ -6625,7 +6625,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6625
6625
|
},
|
|
6626
6626
|
[]
|
|
6627
6627
|
);
|
|
6628
|
-
const getEoaTransport =
|
|
6628
|
+
const getEoaTransport = React39.useCallback(
|
|
6629
6629
|
async (providerHint) => {
|
|
6630
6630
|
if (providerHint === "passkey") {
|
|
6631
6631
|
throw new Error("EOA operations are not supported for passkey keys.");
|
|
@@ -6653,7 +6653,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6653
6653
|
},
|
|
6654
6654
|
[]
|
|
6655
6655
|
);
|
|
6656
|
-
const sendTransaction =
|
|
6656
|
+
const sendTransaction = React39.useCallback(
|
|
6657
6657
|
async (tx, providerHint) => {
|
|
6658
6658
|
const transport = await getEoaTransport(providerHint);
|
|
6659
6659
|
const txHash = await transport.request("eth_sendTransaction", [tx]);
|
|
@@ -6664,14 +6664,14 @@ function WalletSignerProvider({ children }) {
|
|
|
6664
6664
|
},
|
|
6665
6665
|
[getEoaTransport]
|
|
6666
6666
|
);
|
|
6667
|
-
const request =
|
|
6667
|
+
const request = React39.useCallback(
|
|
6668
6668
|
async (method, params, providerHint) => {
|
|
6669
6669
|
const transport = await getEoaTransport(providerHint);
|
|
6670
6670
|
return transport.request(method, params);
|
|
6671
6671
|
},
|
|
6672
6672
|
[getEoaTransport]
|
|
6673
6673
|
);
|
|
6674
|
-
const value =
|
|
6674
|
+
const value = React39.useMemo(
|
|
6675
6675
|
() => ({ signMessage, sendTransaction, request }),
|
|
6676
6676
|
[signMessage, sendTransaction, request]
|
|
6677
6677
|
);
|
|
@@ -6681,7 +6681,7 @@ function WalletSignerProvider({ children }) {
|
|
|
6681
6681
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletSignerContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(SilentSdkBoundary, { fallback: children, children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSdkGate, { configId, walletRef, children }) }) });
|
|
6682
6682
|
}
|
|
6683
6683
|
function useWalletSigner() {
|
|
6684
|
-
const ctx =
|
|
6684
|
+
const ctx = React39.useContext(WalletSignerContext);
|
|
6685
6685
|
if (!ctx) {
|
|
6686
6686
|
throw new Error("useWalletSigner must be used inside <WalletSignerProvider>");
|
|
6687
6687
|
}
|
|
@@ -7527,6 +7527,7 @@ var messagesService = new MessagesService();
|
|
|
7527
7527
|
// src/core/websocketChannelManager.ts
|
|
7528
7528
|
init_jwtPayload();
|
|
7529
7529
|
init_tokenStore();
|
|
7530
|
+
init_tokenRenewal();
|
|
7530
7531
|
var WebSocketChannelManager = class {
|
|
7531
7532
|
constructor(url, getAccessToken = () => exports.defaultTokenStore.getCurrentToken()) {
|
|
7532
7533
|
this.ws = null;
|
|
@@ -7535,6 +7536,9 @@ var WebSocketChannelManager = class {
|
|
|
7535
7536
|
this.reconnectAttempts = 0;
|
|
7536
7537
|
this.reconnectDelay = 1e3;
|
|
7537
7538
|
this.reconnectTimeout = null;
|
|
7539
|
+
/** The server closed us over the token (expired or missing): renew it
|
|
7540
|
+
* before reconnecting, or the next attempt is refused the same way. */
|
|
7541
|
+
this.renewBeforeReconnect = false;
|
|
7538
7542
|
// Channel management
|
|
7539
7543
|
this.channels = /* @__PURE__ */ new Map();
|
|
7540
7544
|
// entityId -> messageTypes
|
|
@@ -7599,6 +7603,12 @@ var WebSocketChannelManager = class {
|
|
|
7599
7603
|
try {
|
|
7600
7604
|
const message = JSON.parse(event.data);
|
|
7601
7605
|
console.log("\u{1F50C} WebSocket message received:", message);
|
|
7606
|
+
if (message.type === "Error") {
|
|
7607
|
+
const reason = String(message.message ?? message.error_message ?? "");
|
|
7608
|
+
console.warn("\u{1F50C} Live updates refused the connection:", reason);
|
|
7609
|
+
if (/token/i.test(reason)) this.renewBeforeReconnect = true;
|
|
7610
|
+
return;
|
|
7611
|
+
}
|
|
7602
7612
|
this.routeMessage(message);
|
|
7603
7613
|
} catch (error) {
|
|
7604
7614
|
console.error("Failed to parse WebSocket message:", error);
|
|
@@ -7769,7 +7779,11 @@ var WebSocketChannelManager = class {
|
|
|
7769
7779
|
this.reconnectAttempts++;
|
|
7770
7780
|
const delay2 = Math.min(this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1), 3e4);
|
|
7771
7781
|
console.log(`Reconnecting in ${delay2}ms (attempt ${this.reconnectAttempts})`);
|
|
7772
|
-
this.reconnectTimeout = setTimeout(() => {
|
|
7782
|
+
this.reconnectTimeout = setTimeout(async () => {
|
|
7783
|
+
if (this.renewBeforeReconnect) {
|
|
7784
|
+
this.renewBeforeReconnect = false;
|
|
7785
|
+
await tokenRenewalService.refreshToken().catch((error) => console.warn("\u{1F50C} Token renewal before reconnecting failed:", error));
|
|
7786
|
+
}
|
|
7773
7787
|
this.connect().catch((error) => {
|
|
7774
7788
|
console.error("Reconnection failed:", error);
|
|
7775
7789
|
});
|
|
@@ -7824,13 +7838,13 @@ function getWebSocketChannelManager(url, getAccessToken) {
|
|
|
7824
7838
|
init_config();
|
|
7825
7839
|
init_jwtClaims();
|
|
7826
7840
|
init_WalletConfigContext();
|
|
7827
|
-
var SignatureQueueContext =
|
|
7841
|
+
var SignatureQueueContext = React39.createContext(null);
|
|
7828
7842
|
function SignatureQueueProvider({ children }) {
|
|
7829
7843
|
const value = useSignatureQueueInternal();
|
|
7830
7844
|
return /* @__PURE__ */ jsxRuntime.jsx(SignatureQueueContext.Provider, { value, children });
|
|
7831
7845
|
}
|
|
7832
7846
|
function useSignatureQueue() {
|
|
7833
|
-
const ctx =
|
|
7847
|
+
const ctx = React39.useContext(SignatureQueueContext);
|
|
7834
7848
|
const fallback = useSignatureQueueInternal(ctx !== null);
|
|
7835
7849
|
return ctx ?? fallback;
|
|
7836
7850
|
}
|
|
@@ -7838,12 +7852,12 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7838
7852
|
const { user, isAuthenticated } = useAuth();
|
|
7839
7853
|
const { webSocketUrl } = useWalletConfig();
|
|
7840
7854
|
const tokenStore = useTokenStore();
|
|
7841
|
-
const [pending, setPending] =
|
|
7842
|
-
const [pendingList, setPendingList] =
|
|
7843
|
-
const [currentMessage, setCurrentMessage] =
|
|
7844
|
-
const [drawerOpen, setDrawerOpen] =
|
|
7845
|
-
const surfacedRef =
|
|
7846
|
-
const fetchAndSetPending =
|
|
7855
|
+
const [pending, setPending] = React39.useState(null);
|
|
7856
|
+
const [pendingList, setPendingList] = React39.useState([]);
|
|
7857
|
+
const [currentMessage, setCurrentMessage] = React39.useState(null);
|
|
7858
|
+
const [drawerOpen, setDrawerOpen] = React39.useState(false);
|
|
7859
|
+
const surfacedRef = React39.useRef(/* @__PURE__ */ new Set());
|
|
7860
|
+
const fetchAndSetPending = React39.useCallback(async () => {
|
|
7847
7861
|
if (inert || !user?.id) return;
|
|
7848
7862
|
try {
|
|
7849
7863
|
const awaiting = await messagesService.getMessagesAwaitingSignature(user.id);
|
|
@@ -7865,7 +7879,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7865
7879
|
console.warn("[useSignatureQueue] refresh failed");
|
|
7866
7880
|
}
|
|
7867
7881
|
}, [inert, user?.id]);
|
|
7868
|
-
|
|
7882
|
+
React39.useEffect(() => {
|
|
7869
7883
|
if (inert) return;
|
|
7870
7884
|
if (!isAuthenticated || !user?.id) return;
|
|
7871
7885
|
if (!getActiveChainId()) return;
|
|
@@ -7921,7 +7935,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7921
7935
|
}
|
|
7922
7936
|
};
|
|
7923
7937
|
}, [inert, isAuthenticated, user?.id, webSocketUrl, fetchAndSetPending, tokenStore]);
|
|
7924
|
-
const openSigner =
|
|
7938
|
+
const openSigner = React39.useCallback(
|
|
7925
7939
|
(message) => {
|
|
7926
7940
|
const target = message ?? pending;
|
|
7927
7941
|
if (!target) return;
|
|
@@ -7930,14 +7944,14 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7930
7944
|
},
|
|
7931
7945
|
[pending]
|
|
7932
7946
|
);
|
|
7933
|
-
const closeSigner =
|
|
7947
|
+
const closeSigner = React39.useCallback(() => {
|
|
7934
7948
|
setDrawerOpen(false);
|
|
7935
7949
|
setCurrentMessage(null);
|
|
7936
7950
|
}, []);
|
|
7937
|
-
const dismissPending =
|
|
7951
|
+
const dismissPending = React39.useCallback(() => {
|
|
7938
7952
|
setPending(null);
|
|
7939
7953
|
}, []);
|
|
7940
|
-
|
|
7954
|
+
React39.useEffect(() => {
|
|
7941
7955
|
if (inert) return;
|
|
7942
7956
|
if (!isAuthenticated) {
|
|
7943
7957
|
setDrawerOpen(false);
|
|
@@ -8681,15 +8695,15 @@ init_delegationScopes();
|
|
|
8681
8695
|
init_tokenManager();
|
|
8682
8696
|
init_jwtClaims();
|
|
8683
8697
|
init_jwtPayload();
|
|
8684
|
-
var AppAuthContext =
|
|
8698
|
+
var AppAuthContext = React39.createContext(void 0);
|
|
8685
8699
|
function AppAuthProvider({ children }) {
|
|
8686
8700
|
const walletAuth = useAuth();
|
|
8687
8701
|
const { isAuthenticated, user, isLoading: walletLoading } = walletAuth;
|
|
8688
|
-
const [groups, setGroups] =
|
|
8689
|
-
const [groupsLoaded, setGroupsLoaded] =
|
|
8690
|
-
const [delegationToken, setDelegationToken] =
|
|
8691
|
-
const [delegationSession, setDelegationSession] =
|
|
8692
|
-
|
|
8702
|
+
const [groups, setGroups] = React39.useState([]);
|
|
8703
|
+
const [groupsLoaded, setGroupsLoaded] = React39.useState(false);
|
|
8704
|
+
const [delegationToken, setDelegationToken] = React39.useState(null);
|
|
8705
|
+
const [delegationSession, setDelegationSession] = React39.useState(null);
|
|
8706
|
+
React39.useEffect(() => {
|
|
8693
8707
|
if (!isAuthenticated) {
|
|
8694
8708
|
setGroups([]);
|
|
8695
8709
|
setGroupsLoaded(false);
|
|
@@ -8720,7 +8734,7 @@ function AppAuthProvider({ children }) {
|
|
|
8720
8734
|
cancelled = true;
|
|
8721
8735
|
};
|
|
8722
8736
|
}, [isAuthenticated, walletLoading, user]);
|
|
8723
|
-
|
|
8737
|
+
React39.useEffect(() => {
|
|
8724
8738
|
if (!isAuthenticated) {
|
|
8725
8739
|
setDelegationToken(null);
|
|
8726
8740
|
setDelegationSession(null);
|
|
@@ -8733,7 +8747,7 @@ function AppAuthProvider({ children }) {
|
|
|
8733
8747
|
sync();
|
|
8734
8748
|
return exports.tokenManager.subscribe(sync);
|
|
8735
8749
|
}, [isAuthenticated]);
|
|
8736
|
-
const refreshGroups =
|
|
8750
|
+
const refreshGroups = React39.useCallback(async () => {
|
|
8737
8751
|
if (!isAuthenticated) return;
|
|
8738
8752
|
try {
|
|
8739
8753
|
const userGroups = await groupsService.getUserGroups();
|
|
@@ -8743,7 +8757,7 @@ function AppAuthProvider({ children }) {
|
|
|
8743
8757
|
console.warn("AppAuthContext.refreshGroups failed:", err);
|
|
8744
8758
|
}
|
|
8745
8759
|
}, [isAuthenticated]);
|
|
8746
|
-
const createDelegationToken =
|
|
8760
|
+
const createDelegationToken = React39.useCallback(async (group) => {
|
|
8747
8761
|
const response = await exports.delegationService.createDelegationToken({
|
|
8748
8762
|
group_id: group.id,
|
|
8749
8763
|
delegation_scope: [...exports.DEFAULT_APP_DELEGATION_SCOPE],
|
|
@@ -8760,7 +8774,7 @@ function AppAuthProvider({ children }) {
|
|
|
8760
8774
|
expiresAt: expirationTime
|
|
8761
8775
|
});
|
|
8762
8776
|
}, []);
|
|
8763
|
-
const assumeOwnedGroup =
|
|
8777
|
+
const assumeOwnedGroup = React39.useCallback(async (group, signerKeyId, delegationScope = exports.DEFAULT_OWNED_GROUP_DELEGATION_SCOPE) => {
|
|
8764
8778
|
const parent = exports.tokenManager.getDelegationSessionMetadata();
|
|
8765
8779
|
const parentToken = exports.tokenManager.getDelegationToken();
|
|
8766
8780
|
if (parent?.kind !== "direct" || !parentToken) {
|
|
@@ -8811,11 +8825,11 @@ function AppAuthProvider({ children }) {
|
|
|
8811
8825
|
});
|
|
8812
8826
|
return response;
|
|
8813
8827
|
}, []);
|
|
8814
|
-
const returnToParent =
|
|
8815
|
-
const clearDelegationToken =
|
|
8828
|
+
const returnToParent = React39.useCallback(() => exports.tokenManager.restoreParentDelegationSession(), []);
|
|
8829
|
+
const clearDelegationToken = React39.useCallback(() => {
|
|
8816
8830
|
exports.tokenManager.clearDelegationToken();
|
|
8817
8831
|
}, []);
|
|
8818
|
-
const value =
|
|
8832
|
+
const value = React39.useMemo(
|
|
8819
8833
|
() => ({
|
|
8820
8834
|
...walletAuth,
|
|
8821
8835
|
groups,
|
|
@@ -8844,42 +8858,42 @@ function AppAuthProvider({ children }) {
|
|
|
8844
8858
|
return /* @__PURE__ */ jsxRuntime.jsx(AppAuthContext.Provider, { value, children });
|
|
8845
8859
|
}
|
|
8846
8860
|
function useAuthContext() {
|
|
8847
|
-
const ctx =
|
|
8861
|
+
const ctx = React39.useContext(AppAuthContext);
|
|
8848
8862
|
if (!ctx) {
|
|
8849
8863
|
throw new Error("useAuthContext must be used within an <AppAuthProvider>");
|
|
8850
8864
|
}
|
|
8851
8865
|
return ctx;
|
|
8852
8866
|
}
|
|
8853
|
-
var WalletCenterContext =
|
|
8867
|
+
var WalletCenterContext = React39.createContext(null);
|
|
8854
8868
|
function WalletCenterProvider({ children }) {
|
|
8855
|
-
const [isOpen, setIsOpen] =
|
|
8856
|
-
const [requestedView, setRequestedView] =
|
|
8857
|
-
const [host, setHostElement] =
|
|
8858
|
-
const [hostOptions, setHostOptions] =
|
|
8859
|
-
const [hostTitle, setHostTitle] =
|
|
8860
|
-
const setHost =
|
|
8869
|
+
const [isOpen, setIsOpen] = React39.useState(false);
|
|
8870
|
+
const [requestedView, setRequestedView] = React39.useState("menu");
|
|
8871
|
+
const [host, setHostElement] = React39.useState(null);
|
|
8872
|
+
const [hostOptions, setHostOptions] = React39.useState({});
|
|
8873
|
+
const [hostTitle, setHostTitle] = React39.useState(null);
|
|
8874
|
+
const setHost = React39.useCallback((next) => {
|
|
8861
8875
|
setHostElement((current) => {
|
|
8862
8876
|
if (current === next) return current;
|
|
8863
8877
|
if (!next) setHostTitle(null);
|
|
8864
8878
|
return next;
|
|
8865
8879
|
});
|
|
8866
8880
|
}, []);
|
|
8867
|
-
const openWalletCenter =
|
|
8881
|
+
const openWalletCenter = React39.useCallback((view = "menu") => {
|
|
8868
8882
|
setRequestedView(view);
|
|
8869
8883
|
setIsOpen(true);
|
|
8870
8884
|
}, []);
|
|
8871
|
-
const closeWalletCenter =
|
|
8885
|
+
const closeWalletCenter = React39.useCallback(() => {
|
|
8872
8886
|
setIsOpen(false);
|
|
8873
8887
|
setRequestedView("menu");
|
|
8874
8888
|
}, []);
|
|
8875
|
-
const value =
|
|
8889
|
+
const value = React39.useMemo(
|
|
8876
8890
|
() => ({ isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, setHostOptions, hostTitle, setHostTitle }),
|
|
8877
8891
|
[isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, hostTitle]
|
|
8878
8892
|
);
|
|
8879
8893
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletCenterContext.Provider, { value, children });
|
|
8880
8894
|
}
|
|
8881
8895
|
function useWalletCenter() {
|
|
8882
|
-
const value =
|
|
8896
|
+
const value = React39.useContext(WalletCenterContext);
|
|
8883
8897
|
if (!value) {
|
|
8884
8898
|
throw new Error("useWalletCenter must be used within <WalletProvider>.");
|
|
8885
8899
|
}
|
|
@@ -8896,7 +8910,7 @@ init_WalletConfigContext();
|
|
|
8896
8910
|
init_WalletConfigContext();
|
|
8897
8911
|
function RedirectTo({ href, replace = true }) {
|
|
8898
8912
|
const navigate = useWalletNavigate();
|
|
8899
|
-
|
|
8913
|
+
React39.useEffect(() => {
|
|
8900
8914
|
navigate(href, { replace });
|
|
8901
8915
|
}, []);
|
|
8902
8916
|
return null;
|
|
@@ -9065,9 +9079,6 @@ var _GlobalNotificationService = class _GlobalNotificationService {
|
|
|
9065
9079
|
case "MessageStatusChange":
|
|
9066
9080
|
this.handleMessageStatusChange(message);
|
|
9067
9081
|
break;
|
|
9068
|
-
case "Error":
|
|
9069
|
-
this.handleError(message);
|
|
9070
|
-
break;
|
|
9071
9082
|
default:
|
|
9072
9083
|
console.log("Unhandled message type:", message.type);
|
|
9073
9084
|
}
|
|
@@ -9127,16 +9138,6 @@ var _GlobalNotificationService = class _GlobalNotificationService {
|
|
|
9127
9138
|
});
|
|
9128
9139
|
}
|
|
9129
9140
|
}
|
|
9130
|
-
handleError(message) {
|
|
9131
|
-
const notification = {
|
|
9132
|
-
id: `error-${Date.now()}`,
|
|
9133
|
-
type: "error",
|
|
9134
|
-
title: "Error",
|
|
9135
|
-
message: message.error_message || "An error occurred",
|
|
9136
|
-
duration: 6e3
|
|
9137
|
-
};
|
|
9138
|
-
this.callbacks.onNotification(notification);
|
|
9139
|
-
}
|
|
9140
9141
|
processSystemNotification(type, title, message, options) {
|
|
9141
9142
|
const notification = {
|
|
9142
9143
|
id: `system-${type}-${Date.now()}`,
|
|
@@ -9172,14 +9173,14 @@ var _GlobalNotificationService = class _GlobalNotificationService {
|
|
|
9172
9173
|
_GlobalNotificationService.instance = null;
|
|
9173
9174
|
var GlobalNotificationService = _GlobalNotificationService;
|
|
9174
9175
|
var globalNotificationService_default = GlobalNotificationService;
|
|
9175
|
-
var EntitySSEContext =
|
|
9176
|
+
var EntitySSEContext = React39.createContext(void 0);
|
|
9176
9177
|
var EntitySSEProvider = ({ children }) => {
|
|
9177
9178
|
const { user } = useAuthContext();
|
|
9178
|
-
const [connected, setConnected] =
|
|
9179
|
-
const [currentEntityId, setCurrentEntityId] =
|
|
9180
|
-
const unsubRef =
|
|
9181
|
-
const handlersRef =
|
|
9182
|
-
const [activityLog, setActivityLog] =
|
|
9179
|
+
const [connected, setConnected] = React39.useState(false);
|
|
9180
|
+
const [currentEntityId, setCurrentEntityId] = React39.useState(user?.id || null);
|
|
9181
|
+
const unsubRef = React39.useRef(null);
|
|
9182
|
+
const handlersRef = React39.useRef(/* @__PURE__ */ new Map());
|
|
9183
|
+
const [activityLog, setActivityLog] = React39.useState(() => {
|
|
9183
9184
|
try {
|
|
9184
9185
|
const stored = localStorage.getItem("sse_activity_log");
|
|
9185
9186
|
return stored ? JSON.parse(stored) : [];
|
|
@@ -9187,7 +9188,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9187
9188
|
return [];
|
|
9188
9189
|
}
|
|
9189
9190
|
});
|
|
9190
|
-
|
|
9191
|
+
React39.useEffect(() => {
|
|
9191
9192
|
if (user?.id) {
|
|
9192
9193
|
if (!currentEntityId) {
|
|
9193
9194
|
setCurrentEntityId(user.id);
|
|
@@ -9196,7 +9197,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9196
9197
|
setCurrentEntityId(null);
|
|
9197
9198
|
}
|
|
9198
9199
|
}, [user?.id, currentEntityId]);
|
|
9199
|
-
|
|
9200
|
+
React39.useEffect(() => {
|
|
9200
9201
|
const handleEntitySwitch = (event) => {
|
|
9201
9202
|
const { actingAs } = event.detail;
|
|
9202
9203
|
if (!actingAs) return;
|
|
@@ -9221,7 +9222,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9221
9222
|
window.removeEventListener("entitySwitched", handleEntitySwitch);
|
|
9222
9223
|
};
|
|
9223
9224
|
}, [currentEntityId]);
|
|
9224
|
-
|
|
9225
|
+
React39.useEffect(() => {
|
|
9225
9226
|
if (!currentEntityId) return;
|
|
9226
9227
|
unsubRef.current?.();
|
|
9227
9228
|
const unsub = subscribeEntityEvents(
|
|
@@ -9321,7 +9322,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9321
9322
|
setConnected(false);
|
|
9322
9323
|
};
|
|
9323
9324
|
}, [currentEntityId]);
|
|
9324
|
-
const subscribeToEvent =
|
|
9325
|
+
const subscribeToEvent = React39.useCallback(
|
|
9325
9326
|
(eventType, handler) => {
|
|
9326
9327
|
if (!handlersRef.current.has(eventType)) {
|
|
9327
9328
|
handlersRef.current.set(eventType, /* @__PURE__ */ new Set());
|
|
@@ -9347,7 +9348,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9347
9348
|
return /* @__PURE__ */ jsxRuntime.jsx(EntitySSEContext.Provider, { value: contextValue, children });
|
|
9348
9349
|
};
|
|
9349
9350
|
var useEntitySSE = () => {
|
|
9350
|
-
const context =
|
|
9351
|
+
const context = React39.useContext(EntitySSEContext);
|
|
9351
9352
|
if (context === void 0) {
|
|
9352
9353
|
throw new Error("useEntitySSE must be used within an EntitySSEProvider");
|
|
9353
9354
|
}
|
|
@@ -9576,19 +9577,19 @@ var GroupOwnershipPanel = ({
|
|
|
9576
9577
|
onChanged,
|
|
9577
9578
|
className = ""
|
|
9578
9579
|
}) => {
|
|
9579
|
-
const [relationships, setRelationships] =
|
|
9580
|
-
const [parentGroupId, setParentGroupId] =
|
|
9581
|
-
const [loading, setLoading] =
|
|
9582
|
-
const [submittingId, setSubmittingId] =
|
|
9583
|
-
const [error, setError] =
|
|
9580
|
+
const [relationships, setRelationships] = React39.useState([]);
|
|
9581
|
+
const [parentGroupId, setParentGroupId] = React39.useState("");
|
|
9582
|
+
const [loading, setLoading] = React39.useState(false);
|
|
9583
|
+
const [submittingId, setSubmittingId] = React39.useState(null);
|
|
9584
|
+
const [error, setError] = React39.useState(null);
|
|
9584
9585
|
const isOwner = currentRole === "owner";
|
|
9585
9586
|
const isDirectChildContext = activeDirectGroupId === childGroup.id;
|
|
9586
9587
|
const canMutate = isOwner && isDirectChildContext && accountReady && Boolean(chainId);
|
|
9587
|
-
const labelById =
|
|
9588
|
+
const labelById = React39.useMemo(
|
|
9588
9589
|
() => new Map(availableParentGroups.map((group) => [group.id, group.name])),
|
|
9589
9590
|
[availableParentGroups]
|
|
9590
9591
|
);
|
|
9591
|
-
const loadRelationships =
|
|
9592
|
+
const loadRelationships = React39.useCallback(async () => {
|
|
9592
9593
|
if (!chainId) {
|
|
9593
9594
|
setRelationships([]);
|
|
9594
9595
|
return;
|
|
@@ -9608,7 +9609,7 @@ var GroupOwnershipPanel = ({
|
|
|
9608
9609
|
setLoading(false);
|
|
9609
9610
|
}
|
|
9610
9611
|
}, [chainId, childGroup.id]);
|
|
9611
|
-
|
|
9612
|
+
React39.useEffect(() => {
|
|
9612
9613
|
void loadRelationships();
|
|
9613
9614
|
}, [loadRelationships]);
|
|
9614
9615
|
const commit = async (relationship) => {
|
|
@@ -9975,7 +9976,7 @@ function writeStoredPendingSponsorship(pending) {
|
|
|
9975
9976
|
} catch {
|
|
9976
9977
|
}
|
|
9977
9978
|
}
|
|
9978
|
-
var WizardContext =
|
|
9979
|
+
var WizardContext = React39.createContext(null);
|
|
9979
9980
|
function WizardProvider({
|
|
9980
9981
|
initialPathname = "/onboarding",
|
|
9981
9982
|
onComplete,
|
|
@@ -9985,18 +9986,18 @@ function WizardProvider({
|
|
|
9985
9986
|
}) {
|
|
9986
9987
|
const { onNavigate: hostNavigate, ...restConfig } = useWalletConfig();
|
|
9987
9988
|
const { bootstrapSession } = useAuth();
|
|
9988
|
-
const [pendingSponsorship, setPendingSponsorship] =
|
|
9989
|
-
const [pathname, setPathname] =
|
|
9989
|
+
const [pendingSponsorship, setPendingSponsorship] = React39.useState(readStoredPendingSponsorship);
|
|
9990
|
+
const [pathname, setPathname] = React39.useState(
|
|
9990
9991
|
() => pendingSponsorship ? "/onboarding/sponsorship" : initialPathname
|
|
9991
9992
|
);
|
|
9992
|
-
const [state, setStateValue] =
|
|
9993
|
-
const [planSelection, setPlanSelection] =
|
|
9993
|
+
const [state, setStateValue] = React39.useState(void 0);
|
|
9994
|
+
const [planSelection, setPlanSelection] = React39.useState(
|
|
9994
9995
|
readOnboardingPlanSelectionHint
|
|
9995
9996
|
);
|
|
9996
|
-
const pendingSponsorshipRef =
|
|
9997
|
+
const pendingSponsorshipRef = React39__default.default.useRef(
|
|
9997
9998
|
pendingSponsorship
|
|
9998
9999
|
);
|
|
9999
|
-
const stageSponsorship =
|
|
10000
|
+
const stageSponsorship = React39.useCallback((groupId, destination) => {
|
|
10000
10001
|
const normalizedGroupId = canonicalSponsorGroupId(groupId);
|
|
10001
10002
|
const userId = currentRegularUserId();
|
|
10002
10003
|
if (!userId) {
|
|
@@ -10014,7 +10015,7 @@ function WizardProvider({
|
|
|
10014
10015
|
writeStoredPendingSponsorship(next);
|
|
10015
10016
|
return next;
|
|
10016
10017
|
}, []);
|
|
10017
|
-
const selectPlan =
|
|
10018
|
+
const selectPlan = React39.useCallback((plan, catalogVersion) => {
|
|
10018
10019
|
const next = {
|
|
10019
10020
|
planId: plan.id,
|
|
10020
10021
|
ownerType: plan.owner_type,
|
|
@@ -10024,7 +10025,7 @@ function WizardProvider({
|
|
|
10024
10025
|
setPlanSelection(next);
|
|
10025
10026
|
writeOnboardingPlanSelectionHint(next);
|
|
10026
10027
|
}, []);
|
|
10027
|
-
const hydratePlanSelection =
|
|
10028
|
+
const hydratePlanSelection = React39.useCallback(
|
|
10028
10029
|
(plan, catalogVersion, selectedAt = Date.now()) => {
|
|
10029
10030
|
setPlanSelection({
|
|
10030
10031
|
planId: plan.id,
|
|
@@ -10036,11 +10037,11 @@ function WizardProvider({
|
|
|
10036
10037
|
},
|
|
10037
10038
|
[]
|
|
10038
10039
|
);
|
|
10039
|
-
const clearPlanSelection =
|
|
10040
|
+
const clearPlanSelection = React39.useCallback(() => {
|
|
10040
10041
|
setPlanSelection(null);
|
|
10041
10042
|
clearOnboardingPlanSelectionHint();
|
|
10042
10043
|
}, []);
|
|
10043
|
-
const syncPlanIntent =
|
|
10044
|
+
const syncPlanIntent = React39.useCallback(async () => {
|
|
10044
10045
|
if (!planSelection || !exports.authService.isAuthenticated()) return null;
|
|
10045
10046
|
const response = await onboardingPlanService.selectIntent(planSelection.planId);
|
|
10046
10047
|
const current = response.intent?.current_plan;
|
|
@@ -10056,7 +10057,7 @@ function WizardProvider({
|
|
|
10056
10057
|
}
|
|
10057
10058
|
return response;
|
|
10058
10059
|
}, [planSelection]);
|
|
10059
|
-
const navigate =
|
|
10060
|
+
const navigate = React39.useCallback(
|
|
10060
10061
|
(to, opts) => {
|
|
10061
10062
|
if (to.startsWith("/onboarding")) {
|
|
10062
10063
|
setPathname(to);
|
|
@@ -10086,7 +10087,7 @@ function WizardProvider({
|
|
|
10086
10087
|
},
|
|
10087
10088
|
[clearPlanSelection, hostNavigate, onComplete]
|
|
10088
10089
|
);
|
|
10089
|
-
const continueAuthenticated =
|
|
10090
|
+
const continueAuthenticated = React39.useCallback(async (destination, expectedSponsor) => {
|
|
10090
10091
|
await bootstrapSession();
|
|
10091
10092
|
if (expectedSponsor && !exports.authService.hasExactSponsoredSession(expectedSponsor)) {
|
|
10092
10093
|
throw new Error(
|
|
@@ -10101,12 +10102,12 @@ function WizardProvider({
|
|
|
10101
10102
|
}
|
|
10102
10103
|
navigate(destination);
|
|
10103
10104
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10104
|
-
const discardSponsorship =
|
|
10105
|
+
const discardSponsorship = React39.useCallback(() => {
|
|
10105
10106
|
pendingSponsorshipRef.current = null;
|
|
10106
10107
|
setPendingSponsorship(null);
|
|
10107
10108
|
clearStoredPendingSponsorship();
|
|
10108
10109
|
}, []);
|
|
10109
|
-
const finishSponsorship =
|
|
10110
|
+
const finishSponsorship = React39.useCallback(async () => {
|
|
10110
10111
|
const pending = pendingSponsorshipRef.current;
|
|
10111
10112
|
if (!pending) {
|
|
10112
10113
|
throw new Error("No platform sponsorship continuation is awaiting completion.");
|
|
@@ -10132,7 +10133,7 @@ function WizardProvider({
|
|
|
10132
10133
|
clearStoredPendingSponsorship();
|
|
10133
10134
|
navigate(pending.destination);
|
|
10134
10135
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10135
|
-
const completeAuthentication =
|
|
10136
|
+
const completeAuthentication = React39.useCallback(async (result, destination, effectivePlatform) => {
|
|
10136
10137
|
const currentUserId = currentRegularUserId();
|
|
10137
10138
|
if (!currentUserId || currentUserId !== result.user_id) {
|
|
10138
10139
|
throw new Error("The returned authentication session did not match the signed-in user.");
|
|
@@ -10170,11 +10171,11 @@ function WizardProvider({
|
|
|
10170
10171
|
}
|
|
10171
10172
|
await continueAuthenticated(destination);
|
|
10172
10173
|
}, [bootstrapSession, continueAuthenticated, finishSponsorship, stageSponsorship]);
|
|
10173
|
-
const params =
|
|
10174
|
+
const params = React39.useMemo(() => {
|
|
10174
10175
|
const provider = matchProviderParam(pathname);
|
|
10175
10176
|
return provider ? { provider } : {};
|
|
10176
10177
|
}, [pathname]);
|
|
10177
|
-
const wizardValue =
|
|
10178
|
+
const wizardValue = React39.useMemo(
|
|
10178
10179
|
() => ({
|
|
10179
10180
|
pathname,
|
|
10180
10181
|
state,
|
|
@@ -10212,7 +10213,7 @@ function WizardProvider({
|
|
|
10212
10213
|
discardSponsorship
|
|
10213
10214
|
]
|
|
10214
10215
|
);
|
|
10215
|
-
const overriddenConfig =
|
|
10216
|
+
const overriddenConfig = React39.useMemo(
|
|
10216
10217
|
() => ({
|
|
10217
10218
|
...restConfig,
|
|
10218
10219
|
onNavigate: (href, opts) => navigate(href, { replace: opts?.replace })
|
|
@@ -10240,7 +10241,7 @@ function matchProviderParam(pathname) {
|
|
|
10240
10241
|
return match ? match[1] : void 0;
|
|
10241
10242
|
}
|
|
10242
10243
|
function useWizard() {
|
|
10243
|
-
const ctx =
|
|
10244
|
+
const ctx = React39.useContext(WizardContext);
|
|
10244
10245
|
if (!ctx) {
|
|
10245
10246
|
throw new Error(
|
|
10246
10247
|
"Wizard hooks must be used inside <WizardProvider> (mounted by <OnboardingWizard>)."
|
|
@@ -10258,7 +10259,7 @@ function useWizardParams() {
|
|
|
10258
10259
|
}
|
|
10259
10260
|
function WizardRedirect({ to, replace }) {
|
|
10260
10261
|
const navigate = useWizardNavigate();
|
|
10261
|
-
|
|
10262
|
+
React39.useEffect(() => {
|
|
10262
10263
|
navigate(to, { replace });
|
|
10263
10264
|
}, []);
|
|
10264
10265
|
return null;
|
|
@@ -10375,20 +10376,20 @@ var DEFAULT_MESSAGES = {
|
|
|
10375
10376
|
retryButtonText: "Try again"
|
|
10376
10377
|
}
|
|
10377
10378
|
};
|
|
10378
|
-
var BrandingContext =
|
|
10379
|
+
var BrandingContext = React39.createContext(null);
|
|
10379
10380
|
var ROOT_BRANDING = {
|
|
10380
10381
|
logo: DEFAULT_LOGO(),
|
|
10381
10382
|
messages: DEFAULT_MESSAGES
|
|
10382
10383
|
};
|
|
10383
10384
|
function useBranding() {
|
|
10384
|
-
return
|
|
10385
|
+
return React39.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10385
10386
|
}
|
|
10386
10387
|
function BrandingProvider({
|
|
10387
10388
|
branding,
|
|
10388
10389
|
children
|
|
10389
10390
|
}) {
|
|
10390
|
-
const parent =
|
|
10391
|
-
const value =
|
|
10391
|
+
const parent = React39.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10392
|
+
const value = React39.useMemo(() => {
|
|
10392
10393
|
if (!branding) return parent;
|
|
10393
10394
|
const { logo, logoSize, messages } = branding;
|
|
10394
10395
|
return {
|
|
@@ -10536,11 +10537,11 @@ init_ProviderConfigContext();
|
|
|
10536
10537
|
// src/react/useOnboardingRouting.ts
|
|
10537
10538
|
init_authService();
|
|
10538
10539
|
function useOnboardingState2() {
|
|
10539
|
-
const [state, setState] =
|
|
10540
|
+
const [state, setState] = React39.useState({
|
|
10540
10541
|
step: "unknown",
|
|
10541
10542
|
isLoading: true
|
|
10542
10543
|
});
|
|
10543
|
-
|
|
10544
|
+
React39.useEffect(() => {
|
|
10544
10545
|
let cancelled = false;
|
|
10545
10546
|
(async () => {
|
|
10546
10547
|
if (!exports.authService.isAuthenticated()) {
|
|
@@ -10716,11 +10717,11 @@ function SelectPlan({
|
|
|
10716
10717
|
const wizardPlatform = useWizardPlatform();
|
|
10717
10718
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
10718
10719
|
const { isAuthenticated, isLoading: authLoading } = useAuth();
|
|
10719
|
-
const [catalog, setCatalog] =
|
|
10720
|
-
const [error, setError] =
|
|
10721
|
-
const [attempt, setAttempt] =
|
|
10720
|
+
const [catalog, setCatalog] = React39.useState(null);
|
|
10721
|
+
const [error, setError] = React39.useState(null);
|
|
10722
|
+
const [attempt, setAttempt] = React39.useState(0);
|
|
10722
10723
|
const platformTagged = !!(wizardPlatform ?? config?.platform?.group_id);
|
|
10723
|
-
|
|
10724
|
+
React39.useEffect(() => {
|
|
10724
10725
|
if (configLoading || authLoading || platformTagged || isAuthenticated) return;
|
|
10725
10726
|
let disposed = false;
|
|
10726
10727
|
setCatalog(null);
|
|
@@ -10736,7 +10737,7 @@ function SelectPlan({
|
|
|
10736
10737
|
disposed = true;
|
|
10737
10738
|
};
|
|
10738
10739
|
}, [attempt, authLoading, configLoading, isAuthenticated, platformTagged]);
|
|
10739
|
-
|
|
10740
|
+
React39.useEffect(() => {
|
|
10740
10741
|
if (platformTagged || catalog && !catalog.prepaid_credits_enabled) {
|
|
10741
10742
|
clearPlanSelection();
|
|
10742
10743
|
}
|
|
@@ -10933,9 +10934,9 @@ async function signInWithPasskey(opts = {}) {
|
|
|
10933
10934
|
return await res.json();
|
|
10934
10935
|
}
|
|
10935
10936
|
function PasskeyMethodButton({ mode, chainId, onSuccess, onError, platform }) {
|
|
10936
|
-
const [supported, setSupported] =
|
|
10937
|
-
const [busy, setBusy] =
|
|
10938
|
-
|
|
10937
|
+
const [supported, setSupported] = React39.useState(true);
|
|
10938
|
+
const [busy, setBusy] = React39.useState(false);
|
|
10939
|
+
React39.useEffect(() => {
|
|
10939
10940
|
const ok = typeof window !== "undefined" && !!window.PublicKeyCredential;
|
|
10940
10941
|
setSupported(ok);
|
|
10941
10942
|
}, []);
|
|
@@ -11026,9 +11027,9 @@ var ChooserCard = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11026
11027
|
onSelect
|
|
11027
11028
|
}
|
|
11028
11029
|
);
|
|
11029
|
-
var LazyAvererSignupFlow =
|
|
11030
|
+
var LazyAvererSignupFlow = React39.lazy(() => Promise.resolve().then(() => (init_SignupFlow(), SignupFlow_exports)));
|
|
11030
11031
|
var SignupFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11031
|
-
|
|
11032
|
+
React39.Suspense,
|
|
11032
11033
|
{
|
|
11033
11034
|
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" }),
|
|
11034
11035
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSignupFlow, { ...props })
|
|
@@ -11045,9 +11046,9 @@ var AvererAuth = {
|
|
|
11045
11046
|
// squeezed into LoginLayout's narrow column.
|
|
11046
11047
|
customLayout: true
|
|
11047
11048
|
};
|
|
11048
|
-
var LazyAvererKycFlow =
|
|
11049
|
+
var LazyAvererKycFlow = React39.lazy(() => Promise.resolve().then(() => (init_KycFlow(), KycFlow_exports)));
|
|
11049
11050
|
var KycFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11050
|
-
|
|
11051
|
+
React39.Suspense,
|
|
11051
11052
|
{
|
|
11052
11053
|
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading Averer\u2026" }),
|
|
11053
11054
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererKycFlow, { ...props })
|
|
@@ -11066,8 +11067,8 @@ function SdkGate({
|
|
|
11066
11067
|
hasConfig = true,
|
|
11067
11068
|
configHint
|
|
11068
11069
|
}) {
|
|
11069
|
-
const [state, setState] =
|
|
11070
|
-
|
|
11070
|
+
const [state, setState] = React39.useState({ status: "loading" });
|
|
11071
|
+
React39.useEffect(() => {
|
|
11071
11072
|
let cancelled = false;
|
|
11072
11073
|
(async () => {
|
|
11073
11074
|
try {
|
|
@@ -11207,8 +11208,8 @@ var DynamicCompleter = ({ sdk, action, onError }) => {
|
|
|
11207
11208
|
const ctx = sdk.useDynamicContext();
|
|
11208
11209
|
const wallet = ctx.primaryWallet;
|
|
11209
11210
|
const dynamicUser = ctx.user;
|
|
11210
|
-
const [done, setDone] =
|
|
11211
|
-
|
|
11211
|
+
const [done, setDone] = React39__default.default.useState(false);
|
|
11212
|
+
React39__default.default.useEffect(() => {
|
|
11212
11213
|
if (done || !wallet?.address) return;
|
|
11213
11214
|
setDone(true);
|
|
11214
11215
|
(async () => {
|
|
@@ -11303,9 +11304,9 @@ var ChooserCard3 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11303
11304
|
}
|
|
11304
11305
|
);
|
|
11305
11306
|
var SignupFlow4 = ({ onComplete, onError, platform }) => {
|
|
11306
|
-
const [email, setEmail] =
|
|
11307
|
-
const [password, setPassword] =
|
|
11308
|
-
const [submitting, setSubmitting] =
|
|
11307
|
+
const [email, setEmail] = React39.useState("");
|
|
11308
|
+
const [password, setPassword] = React39.useState("");
|
|
11309
|
+
const [submitting, setSubmitting] = React39.useState(false);
|
|
11309
11310
|
async function submit(e) {
|
|
11310
11311
|
e.preventDefault();
|
|
11311
11312
|
setSubmitting(true);
|
|
@@ -11461,7 +11462,7 @@ var ChooserCard4 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11461
11462
|
}
|
|
11462
11463
|
);
|
|
11463
11464
|
var SignupFlow5 = ({ onComplete, onError, platform }) => {
|
|
11464
|
-
const [busy, setBusy] =
|
|
11465
|
+
const [busy, setBusy] = React39.useState(false);
|
|
11465
11466
|
async function trigger() {
|
|
11466
11467
|
setBusy(true);
|
|
11467
11468
|
try {
|
|
@@ -11633,8 +11634,8 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11633
11634
|
const settings = config?.kyc.settings[providerId];
|
|
11634
11635
|
const publishableKey = settings?.publishable_key;
|
|
11635
11636
|
const requiredForCompletion = settings?.required_for_completion ?? false;
|
|
11636
|
-
const [stage, setStage] =
|
|
11637
|
-
|
|
11637
|
+
const [stage, setStage] = React39__default.default.useState({ kind: "idle" });
|
|
11638
|
+
React39__default.default.useEffect(() => {
|
|
11638
11639
|
let cancelled = false;
|
|
11639
11640
|
(async () => {
|
|
11640
11641
|
try {
|
|
@@ -11658,7 +11659,7 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11658
11659
|
cancelled = true;
|
|
11659
11660
|
};
|
|
11660
11661
|
}, []);
|
|
11661
|
-
|
|
11662
|
+
React39__default.default.useEffect(() => {
|
|
11662
11663
|
if (stage.kind !== "pending-poll") return;
|
|
11663
11664
|
let cancelled = false;
|
|
11664
11665
|
const pollOnce = async () => {
|
|
@@ -11910,14 +11911,14 @@ function useIdentityStatusPoll(opts) {
|
|
|
11910
11911
|
provider,
|
|
11911
11912
|
credentialType
|
|
11912
11913
|
} = opts;
|
|
11913
|
-
const [stuckHint, setStuckHint] =
|
|
11914
|
-
const onVerifiedRef =
|
|
11915
|
-
const onRejectedRef =
|
|
11916
|
-
|
|
11914
|
+
const [stuckHint, setStuckHint] = React39__default.default.useState(false);
|
|
11915
|
+
const onVerifiedRef = React39__default.default.useRef(onVerified);
|
|
11916
|
+
const onRejectedRef = React39__default.default.useRef(onRejected);
|
|
11917
|
+
React39__default.default.useEffect(() => {
|
|
11917
11918
|
onVerifiedRef.current = onVerified;
|
|
11918
11919
|
onRejectedRef.current = onRejected;
|
|
11919
11920
|
}, [onVerified, onRejected]);
|
|
11920
|
-
|
|
11921
|
+
React39__default.default.useEffect(() => {
|
|
11921
11922
|
if (!active) {
|
|
11922
11923
|
setStuckHint(false);
|
|
11923
11924
|
return;
|
|
@@ -12055,12 +12056,12 @@ var KycFlow4 = ({ onComplete, onError, instanceId, subject }) => {
|
|
|
12055
12056
|
const groupId = subject?.kind === "group" ? subject.id : void 0;
|
|
12056
12057
|
const configuredLevel = config?.kyc.settings[providerId]?.level_name?.trim();
|
|
12057
12058
|
const levelName = configuredLevel || "id-and-liveness";
|
|
12058
|
-
const [token, setToken] =
|
|
12059
|
-
const [stage, setStage] =
|
|
12060
|
-
const [attempt, setAttempt] =
|
|
12061
|
-
const submittedRef =
|
|
12062
|
-
const applicantIdRef =
|
|
12063
|
-
|
|
12059
|
+
const [token, setToken] = React39__default.default.useState(null);
|
|
12060
|
+
const [stage, setStage] = React39__default.default.useState({ kind: "init" });
|
|
12061
|
+
const [attempt, setAttempt] = React39__default.default.useState(0);
|
|
12062
|
+
const submittedRef = React39__default.default.useRef(false);
|
|
12063
|
+
const applicantIdRef = React39__default.default.useRef(void 0);
|
|
12064
|
+
React39__default.default.useEffect(() => {
|
|
12064
12065
|
let cancelled = false;
|
|
12065
12066
|
submittedRef.current = false;
|
|
12066
12067
|
(async () => {
|
|
@@ -12290,8 +12291,8 @@ function OnboardingChooseMethod({ chrome } = {}) {
|
|
|
12290
12291
|
const { config, isLoading, error: configError } = useProviderConfig();
|
|
12291
12292
|
const wizardPlatform = useWizardPlatform();
|
|
12292
12293
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12293
|
-
const [busyId, setBusyId] =
|
|
12294
|
-
const [error, setError] =
|
|
12294
|
+
const [busyId, setBusyId] = React39.useState(null);
|
|
12295
|
+
const [error, setError] = React39.useState(null);
|
|
12295
12296
|
if (isLoading) {
|
|
12296
12297
|
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" }) });
|
|
12297
12298
|
}
|
|
@@ -12387,7 +12388,7 @@ function FloatField({
|
|
|
12387
12388
|
adornment,
|
|
12388
12389
|
disabled
|
|
12389
12390
|
}) {
|
|
12390
|
-
const id =
|
|
12391
|
+
const id = React39.useId();
|
|
12391
12392
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12392
12393
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12393
12394
|
"input",
|
|
@@ -12440,16 +12441,16 @@ function OnboardingEmailSignup({ chrome } = {}) {
|
|
|
12440
12441
|
const { config } = useProviderConfig();
|
|
12441
12442
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12442
12443
|
const platform = wizardPlatform ?? config?.platform?.group_id;
|
|
12443
|
-
const [email, setEmail] =
|
|
12444
|
-
const [password, setPassword] =
|
|
12445
|
-
const [confirmPassword, setConfirmPassword] =
|
|
12446
|
-
const [phase, setPhase] =
|
|
12444
|
+
const [email, setEmail] = React39.useState("");
|
|
12445
|
+
const [password, setPassword] = React39.useState("");
|
|
12446
|
+
const [confirmPassword, setConfirmPassword] = React39.useState("");
|
|
12447
|
+
const [phase, setPhase] = React39.useState(null);
|
|
12447
12448
|
const submitting = phase !== null;
|
|
12448
|
-
const [error, setError] =
|
|
12449
|
-
const [emailExists, setEmailExists] =
|
|
12449
|
+
const [error, setError] = React39.useState(null);
|
|
12450
|
+
const [emailExists, setEmailExists] = React39.useState(false);
|
|
12450
12451
|
const invite = useWizardInvite();
|
|
12451
12452
|
const emailLocked = !!invite?.email;
|
|
12452
|
-
|
|
12453
|
+
React39.useEffect(() => {
|
|
12453
12454
|
if (invite?.email) setEmail(invite.email);
|
|
12454
12455
|
}, [invite?.email]);
|
|
12455
12456
|
function validate() {
|
|
@@ -12658,18 +12659,18 @@ init_onboardingClient();
|
|
|
12658
12659
|
function EmailVerify({ chrome } = {}) {
|
|
12659
12660
|
const navigate = useWizardNavigate();
|
|
12660
12661
|
const { refreshUser, logout } = useAuth();
|
|
12661
|
-
const [status, setStatus] =
|
|
12662
|
-
const [phase, setPhase] =
|
|
12663
|
-
const [code, setCode] =
|
|
12664
|
-
const [newEmail, setNewEmail] =
|
|
12665
|
-
const [notice, setNotice] =
|
|
12666
|
-
const [error, setError] =
|
|
12667
|
-
const autoStartRef =
|
|
12668
|
-
const completionTimerRef =
|
|
12662
|
+
const [status, setStatus] = React39.useState(null);
|
|
12663
|
+
const [phase, setPhase] = React39.useState("loading");
|
|
12664
|
+
const [code, setCode] = React39.useState("");
|
|
12665
|
+
const [newEmail, setNewEmail] = React39.useState("");
|
|
12666
|
+
const [notice, setNotice] = React39.useState(null);
|
|
12667
|
+
const [error, setError] = React39.useState(null);
|
|
12668
|
+
const autoStartRef = React39.useRef(false);
|
|
12669
|
+
const completionTimerRef = React39.useRef(null);
|
|
12669
12670
|
const email = status?.email ?? "";
|
|
12670
|
-
const maskedEmail =
|
|
12671
|
+
const maskedEmail = React39.useMemo(() => maskEmail(email), [email]);
|
|
12671
12672
|
const busy = phase === "sending" || phase === "checking" || phase === "updating-email";
|
|
12672
|
-
const completeSoon =
|
|
12673
|
+
const completeSoon = React39.useCallback((message) => {
|
|
12673
12674
|
setNotice(message ?? "Email confirmed. Taking you to the next setup step.");
|
|
12674
12675
|
setError(null);
|
|
12675
12676
|
setPhase("success");
|
|
@@ -12679,7 +12680,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12679
12680
|
navigate("/onboarding/wallets");
|
|
12680
12681
|
}, 850);
|
|
12681
12682
|
}, [navigate]);
|
|
12682
|
-
const loadStatus =
|
|
12683
|
+
const loadStatus = React39.useCallback(async () => {
|
|
12683
12684
|
const next = await getMyEmailVerificationStatus();
|
|
12684
12685
|
setStatus(next);
|
|
12685
12686
|
if (next.verified) {
|
|
@@ -12689,7 +12690,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12689
12690
|
setPhase("ready");
|
|
12690
12691
|
return next;
|
|
12691
12692
|
}, [completeSoon]);
|
|
12692
|
-
const sendCode =
|
|
12693
|
+
const sendCode = React39.useCallback(async () => {
|
|
12693
12694
|
setPhase("sending");
|
|
12694
12695
|
setError(null);
|
|
12695
12696
|
try {
|
|
@@ -12715,7 +12716,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12715
12716
|
setPhase("ready");
|
|
12716
12717
|
}
|
|
12717
12718
|
}, []);
|
|
12718
|
-
|
|
12719
|
+
React39.useEffect(() => {
|
|
12719
12720
|
let cancelled = false;
|
|
12720
12721
|
(async () => {
|
|
12721
12722
|
setPhase("loading");
|
|
@@ -12740,7 +12741,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12740
12741
|
if (completionTimerRef.current) window.clearTimeout(completionTimerRef.current);
|
|
12741
12742
|
};
|
|
12742
12743
|
}, [completeSoon]);
|
|
12743
|
-
|
|
12744
|
+
React39.useEffect(() => {
|
|
12744
12745
|
if (!status || status.verified || status.is_synthetic || status.pending || autoStartRef.current) return;
|
|
12745
12746
|
autoStartRef.current = true;
|
|
12746
12747
|
void sendCode();
|
|
@@ -12985,7 +12986,7 @@ function ProviderSignup({ chrome } = {}) {
|
|
|
12985
12986
|
const { config, isLoading } = useProviderConfig();
|
|
12986
12987
|
const wizardPlatform = useWizardPlatform();
|
|
12987
12988
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12988
|
-
const [error, setError] =
|
|
12989
|
+
const [error, setError] = React39.useState(null);
|
|
12989
12990
|
if (isLoading) {
|
|
12990
12991
|
return /* @__PURE__ */ jsxRuntime.jsx(StepShell, { chrome, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading\u2026" }) });
|
|
12991
12992
|
}
|
|
@@ -13180,8 +13181,8 @@ function AvatarImageUpload({
|
|
|
13180
13181
|
hintClassName = "text-[10px] text-text-secondary",
|
|
13181
13182
|
errorClassName = "text-[11px] text-status-error-text"
|
|
13182
13183
|
}) {
|
|
13183
|
-
const inputRef =
|
|
13184
|
-
const [error, setError] =
|
|
13184
|
+
const inputRef = React39.useRef(null);
|
|
13185
|
+
const [error, setError] = React39.useState(null);
|
|
13185
13186
|
const hasPhoto = !!value;
|
|
13186
13187
|
async function handleRemove() {
|
|
13187
13188
|
setError(null);
|
|
@@ -13256,28 +13257,28 @@ function useTapToCancel({
|
|
|
13256
13257
|
cancellingLabel = "Cancelling\u2026",
|
|
13257
13258
|
onCancel
|
|
13258
13259
|
}) {
|
|
13259
|
-
const [isCancelling, setIsCancelling] =
|
|
13260
|
-
const timeoutRef =
|
|
13261
|
-
const clear =
|
|
13260
|
+
const [isCancelling, setIsCancelling] = React39.useState(false);
|
|
13261
|
+
const timeoutRef = React39.useRef(null);
|
|
13262
|
+
const clear = React39.useCallback(() => {
|
|
13262
13263
|
if (timeoutRef.current !== null) {
|
|
13263
13264
|
window.clearTimeout(timeoutRef.current);
|
|
13264
13265
|
timeoutRef.current = null;
|
|
13265
13266
|
}
|
|
13266
13267
|
}, []);
|
|
13267
|
-
const handlePointerDown =
|
|
13268
|
+
const handlePointerDown = React39.useCallback(() => {
|
|
13268
13269
|
if (!submitting) return;
|
|
13269
13270
|
timeoutRef.current = window.setTimeout(() => {
|
|
13270
13271
|
setIsCancelling(true);
|
|
13271
13272
|
}, LONG_PRESS_MS);
|
|
13272
13273
|
}, [submitting]);
|
|
13273
|
-
const handlePointerUp =
|
|
13274
|
+
const handlePointerUp = React39.useCallback(() => {
|
|
13274
13275
|
clear();
|
|
13275
13276
|
if (isCancelling && onCancel) {
|
|
13276
13277
|
onCancel();
|
|
13277
13278
|
}
|
|
13278
13279
|
setIsCancelling(false);
|
|
13279
13280
|
}, [clear, isCancelling, onCancel]);
|
|
13280
|
-
const handlePointerLeave =
|
|
13281
|
+
const handlePointerLeave = React39.useCallback(() => {
|
|
13281
13282
|
clear();
|
|
13282
13283
|
setIsCancelling(false);
|
|
13283
13284
|
}, [clear]);
|
|
@@ -13308,27 +13309,27 @@ function emailLocalPart(email) {
|
|
|
13308
13309
|
function OnboardingProfile({ chrome } = {}) {
|
|
13309
13310
|
const navigate = useWizardNavigate();
|
|
13310
13311
|
const { refreshUser } = useAuth();
|
|
13311
|
-
const [firstName, setFirstName] =
|
|
13312
|
-
const [lastName, setLastName] =
|
|
13313
|
-
const [dob, setDob] =
|
|
13314
|
-
const [addressLine1, setAddressLine1] =
|
|
13315
|
-
const [addressLine2, setAddressLine2] =
|
|
13316
|
-
const [addressCity, setAddressCity] =
|
|
13317
|
-
const [addressRegion, setAddressRegion] =
|
|
13318
|
-
const [addressPostalCode, setAddressPostalCode] =
|
|
13319
|
-
const [addressCountry, setAddressCountry] =
|
|
13320
|
-
const [displayName, setDisplayName] =
|
|
13321
|
-
const [displayNameEdited, setDisplayNameEdited] =
|
|
13322
|
-
const [submitting, setSubmitting] =
|
|
13323
|
-
const [error, setError] =
|
|
13324
|
-
const [loaded, setLoaded] =
|
|
13325
|
-
const [fallbackName, setFallbackName] =
|
|
13326
|
-
const [avatarChoice, setAvatarChoice] =
|
|
13327
|
-
const [avatarUrl, setAvatarUrl] =
|
|
13328
|
-
const [avatarTouched, setAvatarTouched] =
|
|
13329
|
-
const [avatarUrlTouched, setAvatarUrlTouched] =
|
|
13330
|
-
const [accountEmail, setAccountEmail] =
|
|
13331
|
-
|
|
13312
|
+
const [firstName, setFirstName] = React39.useState(null);
|
|
13313
|
+
const [lastName, setLastName] = React39.useState(null);
|
|
13314
|
+
const [dob, setDob] = React39.useState(null);
|
|
13315
|
+
const [addressLine1, setAddressLine1] = React39.useState(null);
|
|
13316
|
+
const [addressLine2, setAddressLine2] = React39.useState(null);
|
|
13317
|
+
const [addressCity, setAddressCity] = React39.useState(null);
|
|
13318
|
+
const [addressRegion, setAddressRegion] = React39.useState(null);
|
|
13319
|
+
const [addressPostalCode, setAddressPostalCode] = React39.useState(null);
|
|
13320
|
+
const [addressCountry, setAddressCountry] = React39.useState(null);
|
|
13321
|
+
const [displayName, setDisplayName] = React39.useState("");
|
|
13322
|
+
const [displayNameEdited, setDisplayNameEdited] = React39.useState(false);
|
|
13323
|
+
const [submitting, setSubmitting] = React39.useState(false);
|
|
13324
|
+
const [error, setError] = React39.useState(null);
|
|
13325
|
+
const [loaded, setLoaded] = React39.useState(false);
|
|
13326
|
+
const [fallbackName, setFallbackName] = React39.useState("You");
|
|
13327
|
+
const [avatarChoice, setAvatarChoice] = React39.useState(null);
|
|
13328
|
+
const [avatarUrl, setAvatarUrl] = React39.useState(null);
|
|
13329
|
+
const [avatarTouched, setAvatarTouched] = React39.useState(false);
|
|
13330
|
+
const [avatarUrlTouched, setAvatarUrlTouched] = React39.useState(false);
|
|
13331
|
+
const [accountEmail, setAccountEmail] = React39.useState(null);
|
|
13332
|
+
React39.useEffect(() => {
|
|
13332
13333
|
if (!exports.authService.isAuthenticated()) {
|
|
13333
13334
|
setLoaded(true);
|
|
13334
13335
|
return;
|
|
@@ -13386,7 +13387,7 @@ function OnboardingProfile({ chrome } = {}) {
|
|
|
13386
13387
|
};
|
|
13387
13388
|
}, []);
|
|
13388
13389
|
const autoDerivedDisplayName = [firstName, lastName].map((s) => (s || "").trim()).filter(Boolean).join(" ");
|
|
13389
|
-
|
|
13390
|
+
React39.useEffect(() => {
|
|
13390
13391
|
if (!displayNameEdited) {
|
|
13391
13392
|
setDisplayName(autoDerivedDisplayName);
|
|
13392
13393
|
}
|
|
@@ -13582,7 +13583,7 @@ function IdentityVerify({
|
|
|
13582
13583
|
} = {}) {
|
|
13583
13584
|
const navigate = useWizardNavigate();
|
|
13584
13585
|
const { config, isLoading } = useProviderConfig();
|
|
13585
|
-
const [error, setError] =
|
|
13586
|
+
const [error, setError] = React39.useState(null);
|
|
13586
13587
|
const primaryId = config?.kyc.primary;
|
|
13587
13588
|
const allowedIdentityProviders = userIdentityStatusScopes(config);
|
|
13588
13589
|
const gate = useOnboardingState(
|
|
@@ -15036,20 +15037,20 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15036
15037
|
const navigate = useWizardNavigate();
|
|
15037
15038
|
const { bootstrapSession, user } = useAuth();
|
|
15038
15039
|
const { config } = useProviderConfig();
|
|
15039
|
-
const [keys, setKeys] =
|
|
15040
|
-
const [loading, setLoading] =
|
|
15041
|
-
const [busy, setBusy] =
|
|
15042
|
-
const [error, setError] =
|
|
15043
|
-
const [lastFailedAction, setLastFailedAction] =
|
|
15044
|
-
const [status, setStatus] =
|
|
15045
|
-
const [autoAdvanceArmed, setAutoAdvanceArmed] =
|
|
15046
|
-
const [emailDraft, setEmailDraft] =
|
|
15047
|
-
const [showDynamic, setShowDynamic] =
|
|
15048
|
-
const [walletsOpen, setWalletsOpen] =
|
|
15040
|
+
const [keys, setKeys] = React39.useState([]);
|
|
15041
|
+
const [loading, setLoading] = React39.useState(true);
|
|
15042
|
+
const [busy, setBusy] = React39.useState(null);
|
|
15043
|
+
const [error, setError] = React39.useState(null);
|
|
15044
|
+
const [lastFailedAction, setLastFailedAction] = React39.useState(null);
|
|
15045
|
+
const [status, setStatus] = React39.useState(null);
|
|
15046
|
+
const [autoAdvanceArmed, setAutoAdvanceArmed] = React39.useState(false);
|
|
15047
|
+
const [emailDraft, setEmailDraft] = React39.useState("");
|
|
15048
|
+
const [showDynamic, setShowDynamic] = React39.useState(false);
|
|
15049
|
+
const [walletsOpen, setWalletsOpen] = React39.useState(false);
|
|
15049
15050
|
const hasSyntheticEmail = !!user?.email && user.email.toLowerCase().endsWith("@external.yieldfabric.local");
|
|
15050
15051
|
const { snapshot: gateSnapshot } = useOnboardingState();
|
|
15051
15052
|
const emailOk = !!gateSnapshot && snapshotEmailOk(gateSnapshot);
|
|
15052
|
-
const refresh =
|
|
15053
|
+
const refresh = React39.useCallback(async (opts = {}) => {
|
|
15053
15054
|
try {
|
|
15054
15055
|
if (opts.invalidate ?? !opts.silent) {
|
|
15055
15056
|
invalidateWalletCount();
|
|
@@ -15067,7 +15068,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15067
15068
|
setLoading(false);
|
|
15068
15069
|
}
|
|
15069
15070
|
}, []);
|
|
15070
|
-
|
|
15071
|
+
React39.useEffect(() => {
|
|
15071
15072
|
refresh({ invalidate: true });
|
|
15072
15073
|
}, [refresh]);
|
|
15073
15074
|
const keyCount = keys.length;
|
|
@@ -15202,7 +15203,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15202
15203
|
setBusy(null);
|
|
15203
15204
|
}
|
|
15204
15205
|
}
|
|
15205
|
-
const goOn =
|
|
15206
|
+
const goOn = React39.useCallback(async () => {
|
|
15206
15207
|
setBusy("continue");
|
|
15207
15208
|
setLastFailedAction(null);
|
|
15208
15209
|
try {
|
|
@@ -15230,16 +15231,16 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15230
15231
|
setBusy(null);
|
|
15231
15232
|
}
|
|
15232
15233
|
}, [bootstrapSession, config, navigate, user?.role]);
|
|
15233
|
-
const onContinue =
|
|
15234
|
+
const onContinue = React39.useCallback(async () => {
|
|
15234
15235
|
if (!canContinue) return;
|
|
15235
15236
|
await goOn();
|
|
15236
15237
|
}, [canContinue, goOn]);
|
|
15237
|
-
const onSkip =
|
|
15238
|
+
const onSkip = React39.useCallback(async () => {
|
|
15238
15239
|
if (!user?.id) return;
|
|
15239
15240
|
deferKeyStep(user.id);
|
|
15240
15241
|
await goOn();
|
|
15241
15242
|
}, [goOn, user?.id]);
|
|
15242
|
-
|
|
15243
|
+
React39.useEffect(() => {
|
|
15243
15244
|
if (!autoAdvanceArmed || !canContinue || busy) return;
|
|
15244
15245
|
const timeout = window.setTimeout(() => {
|
|
15245
15246
|
setAutoAdvanceArmed(false);
|
|
@@ -15473,10 +15474,10 @@ var Drawer = ({
|
|
|
15473
15474
|
panelStyle,
|
|
15474
15475
|
contentStyle
|
|
15475
15476
|
}) => {
|
|
15476
|
-
const titleId =
|
|
15477
|
-
const panelRef =
|
|
15478
|
-
const closeButtonRef =
|
|
15479
|
-
|
|
15477
|
+
const titleId = React39.useId();
|
|
15478
|
+
const panelRef = React39.useRef(null);
|
|
15479
|
+
const closeButtonRef = React39.useRef(null);
|
|
15480
|
+
React39.useEffect(() => {
|
|
15480
15481
|
if (!isOpen || typeof document === "undefined") return;
|
|
15481
15482
|
const previouslyFocused = document.activeElement;
|
|
15482
15483
|
const bodyOverflow = document.body.style.overflow;
|
|
@@ -15747,12 +15748,12 @@ var EXPLANATIONS = {
|
|
|
15747
15748
|
manual: "Save a card for this billing profile. It is only charged for metered usage \u2014 nothing is charged now."
|
|
15748
15749
|
};
|
|
15749
15750
|
var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) => {
|
|
15750
|
-
const mountRef =
|
|
15751
|
-
const stripeRef =
|
|
15752
|
-
const elementsRef =
|
|
15753
|
-
const [ready, setReady] =
|
|
15754
|
-
const [submitting, setSubmitting] =
|
|
15755
|
-
|
|
15751
|
+
const mountRef = React39.useRef(null);
|
|
15752
|
+
const stripeRef = React39.useRef(null);
|
|
15753
|
+
const elementsRef = React39.useRef(null);
|
|
15754
|
+
const [ready, setReady] = React39.useState(false);
|
|
15755
|
+
const [submitting, setSubmitting] = React39.useState(false);
|
|
15756
|
+
React39.useEffect(() => {
|
|
15756
15757
|
let cancelled = false;
|
|
15757
15758
|
let element = null;
|
|
15758
15759
|
(async () => {
|
|
@@ -15782,7 +15783,7 @@ var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) =>
|
|
|
15782
15783
|
}
|
|
15783
15784
|
};
|
|
15784
15785
|
}, [session.client_secret]);
|
|
15785
|
-
const submit =
|
|
15786
|
+
const submit = React39.useCallback(async () => {
|
|
15786
15787
|
const stripe = stripeRef.current;
|
|
15787
15788
|
const elements = elementsRef.current;
|
|
15788
15789
|
if (!stripe || !elements || submitting) return;
|
|
@@ -15837,9 +15838,9 @@ var AddCardDialog = ({
|
|
|
15837
15838
|
groupId,
|
|
15838
15839
|
source = "manual"
|
|
15839
15840
|
}) => {
|
|
15840
|
-
const [stage, setStage] =
|
|
15841
|
-
const [attempt, setAttempt] =
|
|
15842
|
-
|
|
15841
|
+
const [stage, setStage] = React39.useState({ kind: "creating" });
|
|
15842
|
+
const [attempt, setAttempt] = React39.useState(0);
|
|
15843
|
+
React39.useEffect(() => {
|
|
15843
15844
|
if (!isOpen) return;
|
|
15844
15845
|
let cancelled = false;
|
|
15845
15846
|
setStage({ kind: "creating" });
|
|
@@ -15868,7 +15869,7 @@ var AddCardDialog = ({
|
|
|
15868
15869
|
cancelled = true;
|
|
15869
15870
|
};
|
|
15870
15871
|
}, [isOpen, groupId, attempt]);
|
|
15871
|
-
const openPortal =
|
|
15872
|
+
const openPortal = React39.useCallback(async () => {
|
|
15872
15873
|
try {
|
|
15873
15874
|
const url = await exports.billingService.createPortalSession(void 0, groupId);
|
|
15874
15875
|
window.location.assign(url);
|
|
@@ -15947,8 +15948,8 @@ var AddCardDialog = ({
|
|
|
15947
15948
|
};
|
|
15948
15949
|
function AddCardStep({ chrome } = {}) {
|
|
15949
15950
|
const navigate = useWizardNavigate();
|
|
15950
|
-
const [dialogOpen, setDialogOpen] =
|
|
15951
|
-
const [saved, setSaved] =
|
|
15951
|
+
const [dialogOpen, setDialogOpen] = React39.useState(true);
|
|
15952
|
+
const [saved, setSaved] = React39.useState(false);
|
|
15952
15953
|
const handleSuccess = () => {
|
|
15953
15954
|
setSaved(true);
|
|
15954
15955
|
setDialogOpen(false);
|
|
@@ -16026,7 +16027,7 @@ function Field({
|
|
|
16026
16027
|
value,
|
|
16027
16028
|
copyable
|
|
16028
16029
|
}) {
|
|
16029
|
-
const [copied, setCopied] =
|
|
16030
|
+
const [copied, setCopied] = React39__default.default.useState(false);
|
|
16030
16031
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
16031
16032
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] uppercase tracking-wider text-text-secondary", children: label }),
|
|
16032
16033
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-0.5 flex items-center gap-2", children: [
|
|
@@ -16090,14 +16091,16 @@ var STAGE_COPY = {
|
|
|
16090
16091
|
not_applicable: { title: "Finishing up", body: "" }
|
|
16091
16092
|
};
|
|
16092
16093
|
var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
16093
|
-
const [status, setStatus] =
|
|
16094
|
-
const [impatient, setImpatient] =
|
|
16095
|
-
const
|
|
16096
|
-
const
|
|
16097
|
-
|
|
16094
|
+
const [status, setStatus] = React39__default.default.useState(null);
|
|
16095
|
+
const [impatient, setImpatient] = React39__default.default.useState(false);
|
|
16096
|
+
const [unavailable, setUnavailable] = React39__default.default.useState(false);
|
|
16097
|
+
const [attempt, setAttempt] = React39__default.default.useState(0);
|
|
16098
|
+
const activationStarted = React39__default.default.useRef(false);
|
|
16099
|
+
const onContinueRef = React39__default.default.useRef(onContinue);
|
|
16100
|
+
React39__default.default.useEffect(() => {
|
|
16098
16101
|
onContinueRef.current = onContinue;
|
|
16099
16102
|
}, [onContinue]);
|
|
16100
|
-
|
|
16103
|
+
React39__default.default.useEffect(() => {
|
|
16101
16104
|
let cancelled = false;
|
|
16102
16105
|
let timer;
|
|
16103
16106
|
const startedAt = Date.now();
|
|
@@ -16105,8 +16108,9 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
|
16105
16108
|
if (cancelled) return;
|
|
16106
16109
|
let terminal = false;
|
|
16107
16110
|
try {
|
|
16108
|
-
const next = await fetchAccountOpeningStatus();
|
|
16111
|
+
const next = await withDeadline(fetchAccountOpeningStatus(), "Account opening status");
|
|
16109
16112
|
if (cancelled) return;
|
|
16113
|
+
setUnavailable(false);
|
|
16110
16114
|
setStatus(next);
|
|
16111
16115
|
if (next.status === "not_started") {
|
|
16112
16116
|
onContinueRef.current();
|
|
@@ -16123,6 +16127,8 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
|
16123
16127
|
);
|
|
16124
16128
|
}
|
|
16125
16129
|
} catch {
|
|
16130
|
+
if (cancelled) return;
|
|
16131
|
+
setUnavailable(true);
|
|
16126
16132
|
}
|
|
16127
16133
|
if (cancelled || terminal) return;
|
|
16128
16134
|
const waited = Date.now() - startedAt;
|
|
@@ -16134,8 +16140,20 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
|
16134
16140
|
cancelled = true;
|
|
16135
16141
|
if (timer !== void 0) window.clearTimeout(timer);
|
|
16136
16142
|
};
|
|
16137
|
-
}, []);
|
|
16138
|
-
if (!status)
|
|
16143
|
+
}, [attempt]);
|
|
16144
|
+
if (unavailable || !status) {
|
|
16145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 text-center", role: "status", "aria-live": "polite", children: [
|
|
16146
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: unavailable ? "We couldn\u2019t check your account right now." : "Checking your account\u2026" }),
|
|
16147
|
+
unavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16148
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] text-text-secondary", children: "You can try again or continue. Your account details will be available when setup finishes." }),
|
|
16149
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "min-h-[44px] w-full rounded-lg bg-cta px-4 py-2.5 text-on-cta", onClick: () => {
|
|
16150
|
+
setUnavailable(false);
|
|
16151
|
+
setAttempt((value) => value + 1);
|
|
16152
|
+
}, children: "Try again" }),
|
|
16153
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "min-h-[44px] w-full", onClick: onContinue, children: continueLabel })
|
|
16154
|
+
] })
|
|
16155
|
+
] });
|
|
16156
|
+
}
|
|
16139
16157
|
if (status.status === "ready" && status.account) {
|
|
16140
16158
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", role: "status", "aria-live": "polite", children: [
|
|
16141
16159
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -16193,14 +16211,14 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
|
16193
16211
|
init_authService();
|
|
16194
16212
|
var WALLET_AWAKENING_MS = 1100;
|
|
16195
16213
|
var TOTAL_MS = 3e3;
|
|
16196
|
-
function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
16214
|
+
function OnboardingWelcomeMoment({ chrome, deferAccountOpening = false } = {}) {
|
|
16197
16215
|
const navigate = useWizardNavigate();
|
|
16198
16216
|
const { messages } = useBranding();
|
|
16199
|
-
const [name, setName] =
|
|
16200
|
-
const [walletShort, setWalletShort] =
|
|
16201
|
-
const [phase, setPhase] =
|
|
16202
|
-
const [accountOpened, setAccountOpened] =
|
|
16203
|
-
|
|
16217
|
+
const [name, setName] = React39.useState("");
|
|
16218
|
+
const [walletShort, setWalletShort] = React39.useState(null);
|
|
16219
|
+
const [phase, setPhase] = React39.useState("wallet");
|
|
16220
|
+
const [accountOpened, setAccountOpened] = React39.useState(deferAccountOpening);
|
|
16221
|
+
React39.useEffect(() => {
|
|
16204
16222
|
let cancelled = false;
|
|
16205
16223
|
(async () => {
|
|
16206
16224
|
const token = exports.authService.getAccessToken();
|
|
@@ -16233,7 +16251,7 @@ function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
|
16233
16251
|
cancelled = true;
|
|
16234
16252
|
};
|
|
16235
16253
|
}, []);
|
|
16236
|
-
|
|
16254
|
+
React39.useEffect(() => {
|
|
16237
16255
|
if (!accountOpened) return;
|
|
16238
16256
|
const swap = window.setTimeout(() => setPhase("welcome"), WALLET_AWAKENING_MS);
|
|
16239
16257
|
const route = window.setTimeout(() => navigate("/home"), TOTAL_MS);
|
|
@@ -16443,39 +16461,39 @@ function ChoosePlan({
|
|
|
16443
16461
|
hydratePlanSelection,
|
|
16444
16462
|
clearPlanSelection
|
|
16445
16463
|
} = useWizardPlanIntent();
|
|
16446
|
-
const [catalog, setCatalog] =
|
|
16447
|
-
const [selected, setSelected] =
|
|
16448
|
-
const [selectedCatalogVersion, setSelectedCatalogVersion] =
|
|
16449
|
-
const [loading, setLoading] =
|
|
16450
|
-
const [busy, setBusy] =
|
|
16451
|
-
const [error, setError] =
|
|
16452
|
-
const [loadAttempt, setLoadAttempt] =
|
|
16453
|
-
const [completed, setCompleted] =
|
|
16454
|
-
const [leave, setLeave] =
|
|
16455
|
-
const [serverRequired, setServerRequired] =
|
|
16456
|
-
const [returnPending, setReturnPending] =
|
|
16464
|
+
const [catalog, setCatalog] = React39.useState(null);
|
|
16465
|
+
const [selected, setSelected] = React39.useState(null);
|
|
16466
|
+
const [selectedCatalogVersion, setSelectedCatalogVersion] = React39.useState(null);
|
|
16467
|
+
const [loading, setLoading] = React39.useState(true);
|
|
16468
|
+
const [busy, setBusy] = React39.useState(false);
|
|
16469
|
+
const [error, setError] = React39.useState(null);
|
|
16470
|
+
const [loadAttempt, setLoadAttempt] = React39.useState(0);
|
|
16471
|
+
const [completed, setCompleted] = React39.useState(false);
|
|
16472
|
+
const [leave, setLeave] = React39.useState(false);
|
|
16473
|
+
const [serverRequired, setServerRequired] = React39.useState(false);
|
|
16474
|
+
const [returnPending, setReturnPending] = React39.useState(() => {
|
|
16457
16475
|
const marker = readCreditCheckoutReturnMarker();
|
|
16458
16476
|
return marker?.kind === "plan" && !marker.groupId;
|
|
16459
16477
|
});
|
|
16460
|
-
const [returnRetryRequired, setReturnRetryRequired] =
|
|
16461
|
-
const initialAppliedProofRef =
|
|
16462
|
-
const appliedProofRef =
|
|
16463
|
-
const appliedPlanIdRef =
|
|
16478
|
+
const [returnRetryRequired, setReturnRetryRequired] = React39.useState(false);
|
|
16479
|
+
const initialAppliedProofRef = React39.useRef(readAppliedPlanProof());
|
|
16480
|
+
const appliedProofRef = React39.useRef(initialAppliedProofRef.current);
|
|
16481
|
+
const appliedPlanIdRef = React39.useRef(
|
|
16464
16482
|
initialAppliedProofRef.current?.purchasedPlanId ?? null
|
|
16465
16483
|
);
|
|
16466
|
-
const expectedPlanIdRef =
|
|
16484
|
+
const expectedPlanIdRef = React39.useRef(null);
|
|
16467
16485
|
const initialMismatch = initialAppliedProofRef.current?.intendedPlanId && initialAppliedProofRef.current.intendedPlanId !== initialAppliedProofRef.current.purchasedPlanId ? {
|
|
16468
16486
|
purchasedPlanId: initialAppliedProofRef.current.purchasedPlanId,
|
|
16469
16487
|
intendedPlanId: initialAppliedProofRef.current.intendedPlanId
|
|
16470
16488
|
} : null;
|
|
16471
|
-
const [appliedMismatch, setAppliedMismatch] =
|
|
16489
|
+
const [appliedMismatch, setAppliedMismatch] = React39.useState(
|
|
16472
16490
|
initialMismatch
|
|
16473
16491
|
);
|
|
16474
|
-
const appliedMismatchRef =
|
|
16492
|
+
const appliedMismatchRef = React39.useRef(initialMismatch);
|
|
16475
16493
|
expectedPlanIdRef.current = selected?.id ?? planSelection?.planId ?? null;
|
|
16476
16494
|
const directSelfPayApplicable = !(wizardPlatform ?? config?.platform?.group_id) && !personalSessionHasGroupPayer();
|
|
16477
16495
|
const planRequired = required || serverRequired;
|
|
16478
|
-
|
|
16496
|
+
React39.useEffect(() => {
|
|
16479
16497
|
if (!directSelfPayApplicable) return;
|
|
16480
16498
|
let disposed = false;
|
|
16481
16499
|
setLoading(true);
|
|
@@ -16565,7 +16583,7 @@ function ChoosePlan({
|
|
|
16565
16583
|
required,
|
|
16566
16584
|
returnPending
|
|
16567
16585
|
]);
|
|
16568
|
-
|
|
16586
|
+
React39.useEffect(() => {
|
|
16569
16587
|
const handleApplied = (event) => {
|
|
16570
16588
|
const detail = event.detail;
|
|
16571
16589
|
if (detail.kind !== "plan" || detail.groupId || !detail.creditPlanId) return;
|
|
@@ -16599,7 +16617,7 @@ function ChoosePlan({
|
|
|
16599
16617
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16600
16618
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16601
16619
|
}, []);
|
|
16602
|
-
|
|
16620
|
+
React39.useEffect(() => {
|
|
16603
16621
|
const matchesPersonalPlanReturn = (event) => {
|
|
16604
16622
|
const detail = event.detail;
|
|
16605
16623
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -16630,7 +16648,7 @@ function ChoosePlan({
|
|
|
16630
16648
|
);
|
|
16631
16649
|
};
|
|
16632
16650
|
}, []);
|
|
16633
|
-
|
|
16651
|
+
React39.useEffect(() => {
|
|
16634
16652
|
if (!returnPending) return;
|
|
16635
16653
|
const timer = window.setInterval(() => {
|
|
16636
16654
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -17132,20 +17150,20 @@ function SponsorshipConsent({
|
|
|
17132
17150
|
stageSponsorship,
|
|
17133
17151
|
finishSponsorship
|
|
17134
17152
|
} = useWizardAuthentication();
|
|
17135
|
-
const [sponsorship, setSponsorship] =
|
|
17136
|
-
const [exactSession, setExactSession] =
|
|
17137
|
-
const [agreed, setAgreed] =
|
|
17138
|
-
const [loading, setLoading] =
|
|
17139
|
-
const [busy, setBusy] =
|
|
17140
|
-
const [error, setError] =
|
|
17141
|
-
const [loadAttempt, setLoadAttempt] =
|
|
17142
|
-
const destination =
|
|
17153
|
+
const [sponsorship, setSponsorship] = React39.useState(null);
|
|
17154
|
+
const [exactSession, setExactSession] = React39.useState(false);
|
|
17155
|
+
const [agreed, setAgreed] = React39.useState(false);
|
|
17156
|
+
const [loading, setLoading] = React39.useState(true);
|
|
17157
|
+
const [busy, setBusy] = React39.useState(false);
|
|
17158
|
+
const [error, setError] = React39.useState(null);
|
|
17159
|
+
const [loadAttempt, setLoadAttempt] = React39.useState(0);
|
|
17160
|
+
const destination = React39.useMemo(() => {
|
|
17143
17161
|
if (pendingSponsorship?.groupId === groupId) {
|
|
17144
17162
|
return pendingSponsorship.destination;
|
|
17145
17163
|
}
|
|
17146
17164
|
return fallbackDestination;
|
|
17147
17165
|
}, [fallbackDestination, groupId, pendingSponsorship]);
|
|
17148
|
-
const loadCurrent =
|
|
17166
|
+
const loadCurrent = React39.useCallback(async (driftMessage) => {
|
|
17149
17167
|
setLoading(true);
|
|
17150
17168
|
if (!driftMessage) setError(null);
|
|
17151
17169
|
try {
|
|
@@ -17168,7 +17186,7 @@ function SponsorshipConsent({
|
|
|
17168
17186
|
setLoading(false);
|
|
17169
17187
|
}
|
|
17170
17188
|
}, [destination, groupId, stageSponsorship]);
|
|
17171
|
-
|
|
17189
|
+
React39.useEffect(() => {
|
|
17172
17190
|
let cancelled = false;
|
|
17173
17191
|
setLoading(true);
|
|
17174
17192
|
setError(null);
|
|
@@ -17371,7 +17389,8 @@ function OnboardingWizard({
|
|
|
17371
17389
|
invite,
|
|
17372
17390
|
platform,
|
|
17373
17391
|
onSelectPlatform,
|
|
17374
|
-
sponsorshipConsent = "wizard"
|
|
17392
|
+
sponsorshipConsent = "wizard",
|
|
17393
|
+
billingMode = "automatic"
|
|
17375
17394
|
}) {
|
|
17376
17395
|
return /* @__PURE__ */ jsxRuntime.jsx(BrandingProvider, { branding, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17377
17396
|
WizardProvider,
|
|
@@ -17385,7 +17404,8 @@ function OnboardingWizard({
|
|
|
17385
17404
|
{
|
|
17386
17405
|
chrome,
|
|
17387
17406
|
onSelectPlatform,
|
|
17388
|
-
sponsorshipConsent
|
|
17407
|
+
sponsorshipConsent,
|
|
17408
|
+
billingMode
|
|
17389
17409
|
}
|
|
17390
17410
|
)
|
|
17391
17411
|
}
|
|
@@ -17415,7 +17435,8 @@ function gateToPath(status) {
|
|
|
17415
17435
|
function WizardRouter({
|
|
17416
17436
|
chrome,
|
|
17417
17437
|
onSelectPlatform,
|
|
17418
|
-
sponsorshipConsent = "wizard"
|
|
17438
|
+
sponsorshipConsent = "wizard",
|
|
17439
|
+
billingMode = "automatic"
|
|
17419
17440
|
}) {
|
|
17420
17441
|
const pathname = useWizardPathname();
|
|
17421
17442
|
const { config } = useProviderConfig();
|
|
@@ -17424,7 +17445,7 @@ function WizardRouter({
|
|
|
17424
17445
|
const effectivePlatform = wizardPlatform ?? config?.platform?.group_id ?? pendingSponsorship?.groupId;
|
|
17425
17446
|
const primaryKycId = config?.kyc.primary;
|
|
17426
17447
|
const identityRequired = !!(primaryKycId && config?.kyc.enabled.includes(primaryKycId) && config?.kyc.settings[primaryKycId]?.required_for_completion);
|
|
17427
|
-
const planApplicable = !effectivePlatform && !personalSessionHasGroupPayer();
|
|
17448
|
+
const planApplicable = billingMode !== "host" && !effectivePlatform && !personalSessionHasGroupPayer();
|
|
17428
17449
|
const allowedIdentityProviders = userIdentityStatusScopes(config);
|
|
17429
17450
|
const gate = useOnboardingState(
|
|
17430
17451
|
identityRequired,
|
|
@@ -17435,11 +17456,14 @@ function WizardRouter({
|
|
|
17435
17456
|
identityRequired && primaryKycVerifiesEmail(config)
|
|
17436
17457
|
);
|
|
17437
17458
|
const hostOwnsSponsorshipConsent = sponsorshipConsent === "host";
|
|
17438
|
-
|
|
17459
|
+
React39__default.default.useEffect(() => {
|
|
17439
17460
|
if (hostOwnsSponsorshipConsent && pendingSponsorship) {
|
|
17440
17461
|
discardSponsorship();
|
|
17441
17462
|
}
|
|
17442
17463
|
}, [hostOwnsSponsorshipConsent, pendingSponsorship, discardSponsorship]);
|
|
17464
|
+
if (!planApplicable && ["/onboarding", "/onboarding/pricing", "/onboarding/plan", "/onboarding/card"].includes(pathname)) {
|
|
17465
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WizardRedirect, { to: "/onboarding/choose", replace: true });
|
|
17466
|
+
}
|
|
17443
17467
|
const sponsorshipContext = !hostOwnsSponsorshipConsent && !!effectivePlatform && (pendingSponsorship !== null || exports.authService.isAuthenticated() && !exports.authService.hasExactSponsoredSession(effectivePlatform));
|
|
17444
17468
|
const exactSponsorship = !!effectivePlatform && exports.authService.hasExactSponsoredSession(effectivePlatform);
|
|
17445
17469
|
const gateCanAnswer = exports.authService.isAuthenticated() && !!exports.tokenManager.getAccessToken();
|
|
@@ -17523,7 +17547,7 @@ function WizardRouter({
|
|
|
17523
17547
|
}
|
|
17524
17548
|
);
|
|
17525
17549
|
if (pathname === "/onboarding/welcome")
|
|
17526
|
-
return /* @__PURE__ */ jsxRuntime.jsx(OnboardingWelcomeMoment, { chrome });
|
|
17550
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OnboardingWelcomeMoment, { chrome, deferAccountOpening: billingMode === "host" });
|
|
17527
17551
|
if (pathname === "/onboarding")
|
|
17528
17552
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectPlan, { chrome, platformPlansAvailable: !!onSelectPlatform });
|
|
17529
17553
|
if (pathname.startsWith("/onboarding/"))
|
|
@@ -17651,7 +17675,7 @@ function builtinProviderDisplayName(id) {
|
|
|
17651
17675
|
}
|
|
17652
17676
|
}
|
|
17653
17677
|
function useProviderDisplayName(config) {
|
|
17654
|
-
return
|
|
17678
|
+
return React39__default.default.useCallback(
|
|
17655
17679
|
(id) => {
|
|
17656
17680
|
const labelled = config?.kyc?.settings?.[id]?.label ?? config?.auth?.settings?.[id]?.label;
|
|
17657
17681
|
const trimmed = typeof labelled === "string" ? labelled.trim() : "";
|
|
@@ -17721,26 +17745,26 @@ var OnboardingPolicySection = ({
|
|
|
17721
17745
|
groupId,
|
|
17722
17746
|
sponsorshipEpoch = 0
|
|
17723
17747
|
}) => {
|
|
17724
|
-
const [deployConfig, setDeployConfig] =
|
|
17748
|
+
const [deployConfig, setDeployConfig] = React39.useState(null);
|
|
17725
17749
|
const providerDisplayName = useProviderDisplayName(deployConfig);
|
|
17726
|
-
const [deployLoading, setDeployLoading] =
|
|
17727
|
-
const [profiles, setProfiles] =
|
|
17728
|
-
const [catalogRefreshed, setCatalogRefreshed] =
|
|
17729
|
-
const [loading, setLoading] =
|
|
17730
|
-
const [hidden, setHidden] =
|
|
17731
|
-
const [platformActive, setPlatformActive] =
|
|
17732
|
-
const [loadError, setLoadError] =
|
|
17733
|
-
const [saving, setSaving] =
|
|
17734
|
-
const [saved, setSaved] =
|
|
17735
|
-
const [saveError, setSaveError] =
|
|
17736
|
-
const [profileName, setProfileName] =
|
|
17737
|
-
const [requireEmail, setRequireEmail] =
|
|
17738
|
-
const [customize, setCustomize] =
|
|
17739
|
-
const [selectedProviders, setSelectedProviders] =
|
|
17740
|
-
const [authPrimary, setAuthPrimary] =
|
|
17741
|
-
const [kycPrimary, setKycPrimary] =
|
|
17742
|
-
const [uxSteps, setUxSteps] =
|
|
17743
|
-
|
|
17750
|
+
const [deployLoading, setDeployLoading] = React39.useState(true);
|
|
17751
|
+
const [profiles, setProfiles] = React39.useState([]);
|
|
17752
|
+
const [catalogRefreshed, setCatalogRefreshed] = React39.useState(false);
|
|
17753
|
+
const [loading, setLoading] = React39.useState(true);
|
|
17754
|
+
const [hidden, setHidden] = React39.useState(false);
|
|
17755
|
+
const [platformActive, setPlatformActive] = React39.useState(null);
|
|
17756
|
+
const [loadError, setLoadError] = React39.useState(null);
|
|
17757
|
+
const [saving, setSaving] = React39.useState(false);
|
|
17758
|
+
const [saved, setSaved] = React39.useState(false);
|
|
17759
|
+
const [saveError, setSaveError] = React39.useState(null);
|
|
17760
|
+
const [profileName, setProfileName] = React39.useState("");
|
|
17761
|
+
const [requireEmail, setRequireEmail] = React39.useState(false);
|
|
17762
|
+
const [customize, setCustomize] = React39.useState(false);
|
|
17763
|
+
const [selectedProviders, setSelectedProviders] = React39.useState([]);
|
|
17764
|
+
const [authPrimary, setAuthPrimary] = React39.useState("");
|
|
17765
|
+
const [kycPrimary, setKycPrimary] = React39.useState("");
|
|
17766
|
+
const [uxSteps, setUxSteps] = React39.useState({});
|
|
17767
|
+
React39.useEffect(() => {
|
|
17744
17768
|
let cancelled = false;
|
|
17745
17769
|
(async () => {
|
|
17746
17770
|
try {
|
|
@@ -17759,7 +17783,7 @@ var OnboardingPolicySection = ({
|
|
|
17759
17783
|
cancelled = true;
|
|
17760
17784
|
};
|
|
17761
17785
|
}, []);
|
|
17762
|
-
const applyResponse =
|
|
17786
|
+
const applyResponse = React39.useCallback((p) => {
|
|
17763
17787
|
const pol = p.policy;
|
|
17764
17788
|
setProfileName(p.verification_profile ?? "");
|
|
17765
17789
|
setRequireEmail(pol?.require_email ?? false);
|
|
@@ -17769,8 +17793,8 @@ var OnboardingPolicySection = ({
|
|
|
17769
17793
|
setKycPrimary(pol?.kyc_primary ?? "");
|
|
17770
17794
|
setUxSteps(pol?.ux_steps ?? {});
|
|
17771
17795
|
}, []);
|
|
17772
|
-
const loadGen =
|
|
17773
|
-
const load =
|
|
17796
|
+
const loadGen = React39.useRef(0);
|
|
17797
|
+
const load = React39.useCallback(async () => {
|
|
17774
17798
|
const gen = ++loadGen.current;
|
|
17775
17799
|
setLoading(true);
|
|
17776
17800
|
setLoadError(null);
|
|
@@ -17793,16 +17817,16 @@ var OnboardingPolicySection = ({
|
|
|
17793
17817
|
if (gen === loadGen.current) setLoading(false);
|
|
17794
17818
|
}
|
|
17795
17819
|
}, [groupId, applyResponse]);
|
|
17796
|
-
|
|
17820
|
+
React39.useEffect(() => {
|
|
17797
17821
|
setHidden(false);
|
|
17798
17822
|
setSaved(false);
|
|
17799
17823
|
setSaveError(null);
|
|
17800
17824
|
setCatalogRefreshed(false);
|
|
17801
17825
|
void load();
|
|
17802
17826
|
}, [load]);
|
|
17803
|
-
const [probeRetry, setProbeRetry] =
|
|
17804
|
-
const probedGroupRef =
|
|
17805
|
-
|
|
17827
|
+
const [probeRetry, setProbeRetry] = React39.useState(0);
|
|
17828
|
+
const probedGroupRef = React39.useRef(null);
|
|
17829
|
+
React39.useEffect(() => {
|
|
17806
17830
|
let cancelled = false;
|
|
17807
17831
|
if (probedGroupRef.current !== groupId) {
|
|
17808
17832
|
setPlatformActive(null);
|
|
@@ -17817,7 +17841,7 @@ var OnboardingPolicySection = ({
|
|
|
17817
17841
|
cancelled = true;
|
|
17818
17842
|
};
|
|
17819
17843
|
}, [groupId, sponsorshipEpoch, probeRetry]);
|
|
17820
|
-
const markDirty =
|
|
17844
|
+
const markDirty = React39.useCallback(() => {
|
|
17821
17845
|
setSaved(false);
|
|
17822
17846
|
setSaveError(null);
|
|
17823
17847
|
}, []);
|
|
@@ -17868,7 +17892,7 @@ var OnboardingPolicySection = ({
|
|
|
17868
17892
|
return null;
|
|
17869
17893
|
};
|
|
17870
17894
|
const anyBlockedToggle = !loading && profileGroups.some((g) => groupVendors(g).some((v) => vendorToggleTarget(g, v) === null));
|
|
17871
|
-
|
|
17895
|
+
React39.useEffect(() => {
|
|
17872
17896
|
if (!anyBlockedToggle || catalogRefreshed) return;
|
|
17873
17897
|
setCatalogRefreshed(true);
|
|
17874
17898
|
onboardingPolicyService.listVerificationProfiles().then((v) => setProfiles(v.profiles)).catch(() => {
|
|
@@ -17907,7 +17931,7 @@ var OnboardingPolicySection = ({
|
|
|
17907
17931
|
...requireEmail ? [{ label: "Verify email" }] : [],
|
|
17908
17932
|
...profileName && identityStepLabel ? [{ label: identityStepLabel, detail: identityStepDetail }] : []
|
|
17909
17933
|
];
|
|
17910
|
-
const save =
|
|
17934
|
+
const save = React39.useCallback(async () => {
|
|
17911
17935
|
if (customize && selectedProviders.length === 0) {
|
|
17912
17936
|
setSaveError("Select at least one sign-in method, or turn customization off.");
|
|
17913
17937
|
return;
|
|
@@ -17987,7 +18011,7 @@ var OnboardingPolicySection = ({
|
|
|
17987
18011
|
)
|
|
17988
18012
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
17989
18013
|
/* @__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: [
|
|
17990
|
-
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18014
|
+
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(React39__default.default.Fragment, { children: [
|
|
17991
18015
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-[12px] text-text-muted/60", children: "\u203A" }),
|
|
17992
18016
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
17993
18017
|
/* @__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 }),
|
|
@@ -18846,7 +18870,7 @@ function formatBigNumberString(value) {
|
|
|
18846
18870
|
return { withSeparators, sci: `~${mantissa}e${exp}` };
|
|
18847
18871
|
}
|
|
18848
18872
|
function ExpandableString({ value }) {
|
|
18849
|
-
const [expanded, setExpanded] =
|
|
18873
|
+
const [expanded, setExpanded] = React39.useState(false);
|
|
18850
18874
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex flex-wrap items-baseline gap-2", children: [
|
|
18851
18875
|
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: [
|
|
18852
18876
|
"[",
|
|
@@ -18932,7 +18956,7 @@ function PrettyObject({
|
|
|
18932
18956
|
depth,
|
|
18933
18957
|
keyHint
|
|
18934
18958
|
}) {
|
|
18935
|
-
const [showEmpty, setShowEmpty] =
|
|
18959
|
+
const [showEmpty, setShowEmpty] = React39.useState(false);
|
|
18936
18960
|
const entries = Object.entries(value);
|
|
18937
18961
|
const present = entries.filter(([, v]) => !isEmptyValue(v));
|
|
18938
18962
|
const empty = entries.filter(([, v]) => isEmptyValue(v));
|
|
@@ -19020,24 +19044,24 @@ function PrettyJson({
|
|
|
19020
19044
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary", children: String(value) });
|
|
19021
19045
|
}
|
|
19022
19046
|
function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId, entityType = "user", selectorRegistry, addressLabels, renderSimpleSummary, mode = "sign", onRetry, onSwitchToSign }) {
|
|
19023
|
-
const [unsignedTransaction, setUnsignedTransaction] =
|
|
19024
|
-
const [loading, setLoading] =
|
|
19025
|
-
const [error, setError] =
|
|
19026
|
-
const [reviewWarning, setReviewWarning] =
|
|
19027
|
-
const [signing, setSigning] =
|
|
19028
|
-
const [selectedKey, setSelectedKey] =
|
|
19029
|
-
const [availableKeys, setAvailableKeys] =
|
|
19030
|
-
const [keysLoading, setKeysLoading] =
|
|
19031
|
-
const [keysError, setKeysError] =
|
|
19032
|
-
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] =
|
|
19033
|
-
const [expandedTxData, setExpandedTxData] =
|
|
19034
|
-
const [view, setView] =
|
|
19035
|
-
const [cancelling, setCancelling] =
|
|
19036
|
-
const [cancelError, setCancelError] =
|
|
19047
|
+
const [unsignedTransaction, setUnsignedTransaction] = React39.useState(null);
|
|
19048
|
+
const [loading, setLoading] = React39.useState(true);
|
|
19049
|
+
const [error, setError] = React39.useState(null);
|
|
19050
|
+
const [reviewWarning, setReviewWarning] = React39.useState(null);
|
|
19051
|
+
const [signing, setSigning] = React39.useState(false);
|
|
19052
|
+
const [selectedKey, setSelectedKey] = React39.useState(null);
|
|
19053
|
+
const [availableKeys, setAvailableKeys] = React39.useState([]);
|
|
19054
|
+
const [keysLoading, setKeysLoading] = React39.useState(false);
|
|
19055
|
+
const [keysError, setKeysError] = React39.useState(null);
|
|
19056
|
+
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] = React39.useState([]);
|
|
19057
|
+
const [expandedTxData, setExpandedTxData] = React39.useState(/* @__PURE__ */ new Set());
|
|
19058
|
+
const [view, setView] = React39.useState("simple");
|
|
19059
|
+
const [cancelling, setCancelling] = React39.useState(false);
|
|
19060
|
+
const [cancelError, setCancelError] = React39.useState(null);
|
|
19037
19061
|
const walletSigner = useWalletSigner();
|
|
19038
19062
|
const tokenStore = useTokenStore();
|
|
19039
19063
|
const delegationTokenForSigning = tokenStore.getDelegationToken();
|
|
19040
|
-
const ownedSignerState =
|
|
19064
|
+
const ownedSignerState = React39.useMemo(() => {
|
|
19041
19065
|
try {
|
|
19042
19066
|
return {
|
|
19043
19067
|
binding: nftOwnedSignerBinding(delegationTokenForSigning),
|
|
@@ -19066,7 +19090,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19066
19090
|
setCancelling(false);
|
|
19067
19091
|
}
|
|
19068
19092
|
};
|
|
19069
|
-
|
|
19093
|
+
React39.useEffect(() => {
|
|
19070
19094
|
setError(null);
|
|
19071
19095
|
setReviewWarning(null);
|
|
19072
19096
|
setKeysError(null);
|
|
@@ -19076,7 +19100,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19076
19100
|
setKeysError(null);
|
|
19077
19101
|
};
|
|
19078
19102
|
}, [message.id]);
|
|
19079
|
-
|
|
19103
|
+
React39.useEffect(() => {
|
|
19080
19104
|
const fetchUnsignedTransaction = async () => {
|
|
19081
19105
|
try {
|
|
19082
19106
|
setLoading(true);
|
|
@@ -19199,7 +19223,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19199
19223
|
mode,
|
|
19200
19224
|
delegationTokenForSigning
|
|
19201
19225
|
]);
|
|
19202
|
-
|
|
19226
|
+
React39.useEffect(() => {
|
|
19203
19227
|
if (mode === "inspect") {
|
|
19204
19228
|
setKeysLoading(false);
|
|
19205
19229
|
return;
|
|
@@ -19264,7 +19288,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19264
19288
|
ownedSignerBinding,
|
|
19265
19289
|
ownedSignerState.error
|
|
19266
19290
|
]);
|
|
19267
|
-
|
|
19291
|
+
React39.useEffect(() => {
|
|
19268
19292
|
if (mode === "inspect") {
|
|
19269
19293
|
setPolicyAuthorizedKeyIds([]);
|
|
19270
19294
|
return;
|
|
@@ -19288,7 +19312,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19288
19312
|
cancelled = true;
|
|
19289
19313
|
};
|
|
19290
19314
|
}, [message?.id, mode]);
|
|
19291
|
-
|
|
19315
|
+
React39.useEffect(() => {
|
|
19292
19316
|
if (availableKeys.length === 0) {
|
|
19293
19317
|
if (selectedKey) setSelectedKey(null);
|
|
19294
19318
|
return;
|
|
@@ -20106,8 +20130,8 @@ function InspectFooter({
|
|
|
20106
20130
|
onRetry,
|
|
20107
20131
|
onSwitchToSign
|
|
20108
20132
|
}) {
|
|
20109
|
-
const [retrying, setRetrying] =
|
|
20110
|
-
const [actionError, setActionError] =
|
|
20133
|
+
const [retrying, setRetrying] = React39.useState(false);
|
|
20134
|
+
const [actionError, setActionError] = React39.useState(null);
|
|
20111
20135
|
const status = effectiveStatus(message);
|
|
20112
20136
|
const color = statusToColor(status);
|
|
20113
20137
|
const txHash = message.response?.deployment_tx_hash || message.response?.transaction_hash;
|
|
@@ -20246,8 +20270,8 @@ var GWEI_DISPLAY_THRESHOLD = BigInt("100000000000000");
|
|
|
20246
20270
|
var NATIVE_SYMBOL = "ETH";
|
|
20247
20271
|
var USD_PER_GAS = 0.01 / 21e3;
|
|
20248
20272
|
function useGasPricing() {
|
|
20249
|
-
const [pricing, setPricing] =
|
|
20250
|
-
|
|
20273
|
+
const [pricing, setPricing] = React39.useState(null);
|
|
20274
|
+
React39.useEffect(() => {
|
|
20251
20275
|
let mounted = true;
|
|
20252
20276
|
void exports.billingService.getGasPricing().then((p) => {
|
|
20253
20277
|
if (mounted) setPricing(p);
|
|
@@ -20381,12 +20405,12 @@ var Toast = ({
|
|
|
20381
20405
|
icon,
|
|
20382
20406
|
action
|
|
20383
20407
|
}) => {
|
|
20384
|
-
const [progress, setProgress] =
|
|
20385
|
-
const [isVisible, setIsVisible] =
|
|
20386
|
-
|
|
20408
|
+
const [progress, setProgress] = React39.useState(100);
|
|
20409
|
+
const [isVisible, setIsVisible] = React39.useState(false);
|
|
20410
|
+
React39.useEffect(() => {
|
|
20387
20411
|
requestAnimationFrame(() => setIsVisible(true));
|
|
20388
20412
|
}, []);
|
|
20389
|
-
|
|
20413
|
+
React39.useEffect(() => {
|
|
20390
20414
|
if (duration > 0) {
|
|
20391
20415
|
const interval = setInterval(() => {
|
|
20392
20416
|
setProgress((prev) => {
|
|
@@ -20531,7 +20555,7 @@ function SignatureWorkflow({
|
|
|
20531
20555
|
dismissPending,
|
|
20532
20556
|
refreshPending
|
|
20533
20557
|
} = useSignatureQueue();
|
|
20534
|
-
|
|
20558
|
+
React39.useEffect(() => {
|
|
20535
20559
|
if (!notify || !pending) return;
|
|
20536
20560
|
const cleanup = notify({
|
|
20537
20561
|
id: `signature-${pending.id}`,
|
|
@@ -20681,7 +20705,7 @@ async function resolveKey(userId, selection) {
|
|
|
20681
20705
|
function useGenericSigner() {
|
|
20682
20706
|
const { user } = useAuth();
|
|
20683
20707
|
const { signMessage: signWithWallet } = useWalletSigner();
|
|
20684
|
-
const sign =
|
|
20708
|
+
const sign = React39.useCallback(
|
|
20685
20709
|
async (hash32Hex, opts = {}) => {
|
|
20686
20710
|
if (!user) throw new Error("useGenericSigner: no authenticated user");
|
|
20687
20711
|
const selection = opts.keySelection ?? { mode: "default" };
|
|
@@ -20748,10 +20772,10 @@ function PhoneVerification({
|
|
|
20748
20772
|
readOnly = false,
|
|
20749
20773
|
valueClassName
|
|
20750
20774
|
}) {
|
|
20751
|
-
const [phone, setPhone] =
|
|
20752
|
-
const [editing, setEditing] =
|
|
20753
|
-
const [saving, setSaving] =
|
|
20754
|
-
const [error, setError] =
|
|
20775
|
+
const [phone, setPhone] = React39.useState(profile.phone_e164 ?? "");
|
|
20776
|
+
const [editing, setEditing] = React39.useState(!profile.phone_e164);
|
|
20777
|
+
const [saving, setSaving] = React39.useState(false);
|
|
20778
|
+
const [error, setError] = React39.useState(null);
|
|
20755
20779
|
async function save() {
|
|
20756
20780
|
if (!isValidE164(phone)) {
|
|
20757
20781
|
setError("Please enter a phone number in E.164 format (e.g. +14155550101).");
|
|
@@ -20879,10 +20903,10 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20879
20903
|
...propClassNames ?? {}
|
|
20880
20904
|
});
|
|
20881
20905
|
const { isLoading: configLoading } = useProviderConfig();
|
|
20882
|
-
const [profile, setProfile] =
|
|
20883
|
-
const [loading, setLoading] =
|
|
20884
|
-
const [topError, setTopError] =
|
|
20885
|
-
|
|
20906
|
+
const [profile, setProfile] = React39.useState(null);
|
|
20907
|
+
const [loading, setLoading] = React39.useState(true);
|
|
20908
|
+
const [topError, setTopError] = React39.useState(null);
|
|
20909
|
+
React39.useEffect(() => {
|
|
20886
20910
|
let cancelled = false;
|
|
20887
20911
|
(async () => {
|
|
20888
20912
|
try {
|
|
@@ -20927,13 +20951,13 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20927
20951
|
] });
|
|
20928
20952
|
}
|
|
20929
20953
|
var IdentitySection = ({ profile, onSaved, classNames }) => {
|
|
20930
|
-
const [displayName, setDisplayName] =
|
|
20954
|
+
const [displayName, setDisplayName] = React39.useState(
|
|
20931
20955
|
profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name
|
|
20932
20956
|
);
|
|
20933
|
-
const [avatarChoice, setAvatarChoice] =
|
|
20934
|
-
const [avatarUrl, setAvatarUrl] =
|
|
20935
|
-
const [busy, setBusy] =
|
|
20936
|
-
const [err, setErr] =
|
|
20957
|
+
const [avatarChoice, setAvatarChoice] = React39.useState(profile.avatar_choice);
|
|
20958
|
+
const [avatarUrl, setAvatarUrl] = React39.useState(profile.avatar_url);
|
|
20959
|
+
const [busy, setBusy] = React39.useState(false);
|
|
20960
|
+
const [err, setErr] = React39.useState(null);
|
|
20937
20961
|
const [saved, flashSaved] = useSavedFlash();
|
|
20938
20962
|
const dirty = displayName !== (profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name) || avatarChoice !== profile.avatar_choice || (avatarUrl ?? "") !== (profile.avatar_url ?? "");
|
|
20939
20963
|
async function save() {
|
|
@@ -21174,12 +21198,12 @@ var SaveButton = ({ onClick, busy, disabled, saved = false, classNames }) => /*
|
|
|
21174
21198
|
}
|
|
21175
21199
|
);
|
|
21176
21200
|
function useSavedFlash(ms = 1800) {
|
|
21177
|
-
const [saved, setSaved] =
|
|
21178
|
-
const timer =
|
|
21179
|
-
|
|
21201
|
+
const [saved, setSaved] = React39.useState(false);
|
|
21202
|
+
const timer = React39__default.default.useRef(null);
|
|
21203
|
+
React39.useEffect(() => () => {
|
|
21180
21204
|
if (timer.current) clearTimeout(timer.current);
|
|
21181
21205
|
}, []);
|
|
21182
|
-
const flash =
|
|
21206
|
+
const flash = React39__default.default.useCallback(() => {
|
|
21183
21207
|
setSaved(true);
|
|
21184
21208
|
if (timer.current) clearTimeout(timer.current);
|
|
21185
21209
|
timer.current = setTimeout(() => setSaved(false), ms);
|
|
@@ -21448,14 +21472,14 @@ function isEoaKey(key) {
|
|
|
21448
21472
|
function useKeyBalance(handle, options = {}) {
|
|
21449
21473
|
const { pollIntervalMs = 15e3, enabled = true } = options;
|
|
21450
21474
|
const { request } = useWalletSigner();
|
|
21451
|
-
const [wei, setWei] =
|
|
21452
|
-
const [loading, setLoading] =
|
|
21453
|
-
const [error, setError] =
|
|
21454
|
-
const requestRef =
|
|
21475
|
+
const [wei, setWei] = React39.useState(null);
|
|
21476
|
+
const [loading, setLoading] = React39.useState(false);
|
|
21477
|
+
const [error, setError] = React39.useState(null);
|
|
21478
|
+
const requestRef = React39.useRef(request);
|
|
21455
21479
|
requestRef.current = request;
|
|
21456
|
-
const handleRef =
|
|
21480
|
+
const handleRef = React39.useRef(handle);
|
|
21457
21481
|
handleRef.current = handle;
|
|
21458
|
-
const fetchOnce =
|
|
21482
|
+
const fetchOnce = React39.useCallback(async () => {
|
|
21459
21483
|
const h = handleRef.current;
|
|
21460
21484
|
if (!h) {
|
|
21461
21485
|
setWei(null);
|
|
@@ -21475,7 +21499,7 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21475
21499
|
setLoading(false);
|
|
21476
21500
|
}
|
|
21477
21501
|
}, []);
|
|
21478
|
-
|
|
21502
|
+
React39.useEffect(() => {
|
|
21479
21503
|
if (!enabled || !handle) {
|
|
21480
21504
|
setWei(null);
|
|
21481
21505
|
setError(null);
|
|
@@ -21493,17 +21517,17 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21493
21517
|
function useEoaSend(handle, options = {}) {
|
|
21494
21518
|
const { timeoutMs = 9e4, pollIntervalMs = 3e3, onConfirmed } = options;
|
|
21495
21519
|
const { sendTransaction, request } = useWalletSigner();
|
|
21496
|
-
const [status, setStatus] =
|
|
21497
|
-
const [txHash, setTxHash] =
|
|
21498
|
-
const [error, setError] =
|
|
21499
|
-
const abortRef =
|
|
21500
|
-
const reset =
|
|
21520
|
+
const [status, setStatus] = React39.useState("idle");
|
|
21521
|
+
const [txHash, setTxHash] = React39.useState(null);
|
|
21522
|
+
const [error, setError] = React39.useState(null);
|
|
21523
|
+
const abortRef = React39.useRef(false);
|
|
21524
|
+
const reset = React39.useCallback(() => {
|
|
21501
21525
|
abortRef.current = true;
|
|
21502
21526
|
setStatus("idle");
|
|
21503
21527
|
setTxHash(null);
|
|
21504
21528
|
setError(null);
|
|
21505
21529
|
}, []);
|
|
21506
|
-
const send =
|
|
21530
|
+
const send = React39.useCallback(
|
|
21507
21531
|
async (input) => {
|
|
21508
21532
|
if (!handle) {
|
|
21509
21533
|
setError("No EOA selected.");
|
|
@@ -21594,14 +21618,14 @@ var SendFromKey = ({
|
|
|
21594
21618
|
maxWei,
|
|
21595
21619
|
onClose
|
|
21596
21620
|
}) => {
|
|
21597
|
-
const [to, setTo] =
|
|
21598
|
-
const [amount, setAmount] =
|
|
21621
|
+
const [to, setTo] = React39.useState("");
|
|
21622
|
+
const [amount, setAmount] = React39.useState("");
|
|
21599
21623
|
const { status, txHash, error, send, reset } = useEoaSend(handle, {
|
|
21600
21624
|
onConfirmed: () => {
|
|
21601
21625
|
}
|
|
21602
21626
|
});
|
|
21603
21627
|
const toValid = ADDRESS_RE2.test(to);
|
|
21604
|
-
const amountValid =
|
|
21628
|
+
const amountValid = React39.useMemo(() => {
|
|
21605
21629
|
if (!amount) return false;
|
|
21606
21630
|
if (!/^\d*\.?\d*$/.test(amount.trim())) return false;
|
|
21607
21631
|
return Number(amount) > 0;
|
|
@@ -21826,7 +21850,7 @@ var KeyBalances = ({
|
|
|
21826
21850
|
}) => {
|
|
21827
21851
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
21828
21852
|
const classNames = { ...configuredClassNames ?? {}, ...propClassNames ?? {} };
|
|
21829
|
-
const [sendOpen, setSendOpen] =
|
|
21853
|
+
const [sendOpen, setSendOpen] = React39.useState(false);
|
|
21830
21854
|
const { wei, loading, error } = useKeyBalance(handle);
|
|
21831
21855
|
const formatted = wei === null ? null : formatUnits(wei, 18, 6);
|
|
21832
21856
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -21876,13 +21900,13 @@ var ChangePasswordModal = ({
|
|
|
21876
21900
|
onClose,
|
|
21877
21901
|
onChanged
|
|
21878
21902
|
}) => {
|
|
21879
|
-
const [current, setCurrent] =
|
|
21880
|
-
const [next, setNext] =
|
|
21881
|
-
const [confirm, setConfirm] =
|
|
21882
|
-
const [submitting, setSubmitting] =
|
|
21883
|
-
const [serverError, setServerError] =
|
|
21884
|
-
const [success, setSuccess] =
|
|
21885
|
-
const issues =
|
|
21903
|
+
const [current, setCurrent] = React39.useState("");
|
|
21904
|
+
const [next, setNext] = React39.useState("");
|
|
21905
|
+
const [confirm, setConfirm] = React39.useState("");
|
|
21906
|
+
const [submitting, setSubmitting] = React39.useState(false);
|
|
21907
|
+
const [serverError, setServerError] = React39.useState(null);
|
|
21908
|
+
const [success, setSuccess] = React39.useState(false);
|
|
21909
|
+
const issues = React39.useMemo(() => {
|
|
21886
21910
|
const out = [];
|
|
21887
21911
|
if (!current) out.push({ field: "current", message: "Required." });
|
|
21888
21912
|
if (!next) {
|
|
@@ -22045,7 +22069,7 @@ function PasswordField({
|
|
|
22045
22069
|
autoComplete,
|
|
22046
22070
|
autoFocus
|
|
22047
22071
|
}) {
|
|
22048
|
-
const [reveal, setReveal] =
|
|
22072
|
+
const [reveal, setReveal] = React39.useState(false);
|
|
22049
22073
|
const touched = value.length > 0;
|
|
22050
22074
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
22051
22075
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-[10px] uppercase tracking-wide text-text-muted", children: label }),
|
|
@@ -22175,32 +22199,32 @@ function SecurityPage() {
|
|
|
22175
22199
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
22176
22200
|
const classNames = resolveSecurityClasses(configuredClassNames);
|
|
22177
22201
|
const navigate = useWalletNavigate();
|
|
22178
|
-
const [keys, setKeys] =
|
|
22179
|
-
const [loading, setLoading] =
|
|
22180
|
-
const [error, setError] =
|
|
22181
|
-
const [info, setInfo] =
|
|
22182
|
-
const [showAdvanced, setShowAdvanced] =
|
|
22183
|
-
const [lockdown, setLockdown] =
|
|
22184
|
-
const [busy, setBusy] =
|
|
22185
|
-
const [rotateTarget, setRotateTarget] =
|
|
22186
|
-
const [rotateNewKind, setRotateNewKind] =
|
|
22187
|
-
const [rotateStep, setRotateStep] =
|
|
22188
|
-
const [rotateNewAddress, setRotateNewAddress] =
|
|
22189
|
-
const [rotateNewKeyId, setRotateNewKeyId] =
|
|
22190
|
-
const [rotateAccount, setRotateAccount] =
|
|
22191
|
-
const [rotateAddStatus, setRotateAddStatus] =
|
|
22192
|
-
const [rotateOperationMessageId, setRotateOperationMessageId] =
|
|
22193
|
-
const [passwordModalOpen, setPasswordModalOpen] =
|
|
22194
|
-
const [editingLabelKeyId, setEditingLabelKeyId] =
|
|
22195
|
-
const [labelDraft, setLabelDraft] =
|
|
22196
|
-
const [apiKeys, setApiKeys] =
|
|
22197
|
-
const [apiKeysLoading, setApiKeysLoading] =
|
|
22198
|
-
const [generateOpen, setGenerateOpen] =
|
|
22199
|
-
const [generateName, setGenerateName] =
|
|
22200
|
-
const [generateDescription, setGenerateDescription] =
|
|
22201
|
-
const [freshApiKey, setFreshApiKey] =
|
|
22202
|
-
const [freshApiKeyCopied, setFreshApiKeyCopied] =
|
|
22203
|
-
const refresh =
|
|
22202
|
+
const [keys, setKeys] = React39.useState([]);
|
|
22203
|
+
const [loading, setLoading] = React39.useState(true);
|
|
22204
|
+
const [error, setError] = React39.useState(null);
|
|
22205
|
+
const [info, setInfo] = React39.useState(null);
|
|
22206
|
+
const [showAdvanced, setShowAdvanced] = React39.useState(false);
|
|
22207
|
+
const [lockdown, setLockdown] = React39.useState(null);
|
|
22208
|
+
const [busy, setBusy] = React39.useState(null);
|
|
22209
|
+
const [rotateTarget, setRotateTarget] = React39.useState(null);
|
|
22210
|
+
const [rotateNewKind, setRotateNewKind] = React39.useState(null);
|
|
22211
|
+
const [rotateStep, setRotateStep] = React39.useState("pick");
|
|
22212
|
+
const [rotateNewAddress, setRotateNewAddress] = React39.useState(null);
|
|
22213
|
+
const [rotateNewKeyId, setRotateNewKeyId] = React39.useState(null);
|
|
22214
|
+
const [rotateAccount, setRotateAccount] = React39.useState(null);
|
|
22215
|
+
const [rotateAddStatus, setRotateAddStatus] = React39.useState(null);
|
|
22216
|
+
const [rotateOperationMessageId, setRotateOperationMessageId] = React39.useState(null);
|
|
22217
|
+
const [passwordModalOpen, setPasswordModalOpen] = React39.useState(false);
|
|
22218
|
+
const [editingLabelKeyId, setEditingLabelKeyId] = React39.useState(null);
|
|
22219
|
+
const [labelDraft, setLabelDraft] = React39.useState("");
|
|
22220
|
+
const [apiKeys, setApiKeys] = React39.useState([]);
|
|
22221
|
+
const [apiKeysLoading, setApiKeysLoading] = React39.useState(true);
|
|
22222
|
+
const [generateOpen, setGenerateOpen] = React39.useState(false);
|
|
22223
|
+
const [generateName, setGenerateName] = React39.useState("");
|
|
22224
|
+
const [generateDescription, setGenerateDescription] = React39.useState("");
|
|
22225
|
+
const [freshApiKey, setFreshApiKey] = React39.useState(null);
|
|
22226
|
+
const [freshApiKeyCopied, setFreshApiKeyCopied] = React39.useState(false);
|
|
22227
|
+
const refresh = React39.useCallback(async (opts) => {
|
|
22204
22228
|
setError(null);
|
|
22205
22229
|
try {
|
|
22206
22230
|
if (opts?.invalidate !== false) invalidateWalletCount();
|
|
@@ -22216,10 +22240,10 @@ function SecurityPage() {
|
|
|
22216
22240
|
setLoading(false);
|
|
22217
22241
|
}
|
|
22218
22242
|
}, []);
|
|
22219
|
-
|
|
22243
|
+
React39.useEffect(() => {
|
|
22220
22244
|
void refresh({ invalidate: false });
|
|
22221
22245
|
}, [refresh]);
|
|
22222
|
-
const refreshApiKeys =
|
|
22246
|
+
const refreshApiKeys = React39.useCallback(async () => {
|
|
22223
22247
|
try {
|
|
22224
22248
|
const list = await apiKeysService.list();
|
|
22225
22249
|
setApiKeys(list);
|
|
@@ -22229,7 +22253,7 @@ function SecurityPage() {
|
|
|
22229
22253
|
setApiKeysLoading(false);
|
|
22230
22254
|
}
|
|
22231
22255
|
}, []);
|
|
22232
|
-
|
|
22256
|
+
React39.useEffect(() => {
|
|
22233
22257
|
refreshApiKeys();
|
|
22234
22258
|
}, [refreshApiKeys]);
|
|
22235
22259
|
const userControlledCount = keys.length;
|
|
@@ -23513,42 +23537,42 @@ var GroupsView = ({
|
|
|
23513
23537
|
clearDelegationToken,
|
|
23514
23538
|
user
|
|
23515
23539
|
} = useAuthContext();
|
|
23516
|
-
const [busyId, setBusyId] =
|
|
23517
|
-
const [error, setError] =
|
|
23518
|
-
const [refreshing, setRefreshing] =
|
|
23519
|
-
const [creating, setCreating] =
|
|
23520
|
-
const [createOpen, setCreateOpen] =
|
|
23521
|
-
const [newGroupName, setNewGroupName] =
|
|
23522
|
-
const [newGroupDescription, setNewGroupDescription] =
|
|
23523
|
-
const [newGroupType, setNewGroupType] =
|
|
23524
|
-
const [newGroupLegalEntity, setNewGroupLegalEntity] =
|
|
23525
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
23526
|
-
const [ownedGroups, setOwnedGroups] =
|
|
23527
|
-
const [ownedGroupsLoading, setOwnedGroupsLoading] =
|
|
23528
|
-
const [ownedGroupsError, setOwnedGroupsError] =
|
|
23529
|
-
const [activeOwnedGroup, setActiveOwnedGroup] =
|
|
23530
|
-
const [operatorKeys, setOperatorKeys] =
|
|
23531
|
-
const [operatorKeysLoading, setOperatorKeysLoading] =
|
|
23532
|
-
const [selectedOperatorKeyId, setSelectedOperatorKeyId] =
|
|
23533
|
-
const [relationshipChildGroupId, setRelationshipChildGroupId] =
|
|
23534
|
-
const [relationshipAdvancing, setRelationshipAdvancing] =
|
|
23535
|
-
const [relationshipProgress, setRelationshipProgress] =
|
|
23540
|
+
const [busyId, setBusyId] = React39.useState(null);
|
|
23541
|
+
const [error, setError] = React39.useState(null);
|
|
23542
|
+
const [refreshing, setRefreshing] = React39.useState(false);
|
|
23543
|
+
const [creating, setCreating] = React39.useState(false);
|
|
23544
|
+
const [createOpen, setCreateOpen] = React39.useState(false);
|
|
23545
|
+
const [newGroupName, setNewGroupName] = React39.useState("");
|
|
23546
|
+
const [newGroupDescription, setNewGroupDescription] = React39.useState("");
|
|
23547
|
+
const [newGroupType, setNewGroupType] = React39.useState("Team");
|
|
23548
|
+
const [newGroupLegalEntity, setNewGroupLegalEntity] = React39.useState(false);
|
|
23549
|
+
const [selectedGroupId, setSelectedGroupId] = React39.useState(null);
|
|
23550
|
+
const [ownedGroups, setOwnedGroups] = React39.useState([]);
|
|
23551
|
+
const [ownedGroupsLoading, setOwnedGroupsLoading] = React39.useState(false);
|
|
23552
|
+
const [ownedGroupsError, setOwnedGroupsError] = React39.useState(null);
|
|
23553
|
+
const [activeOwnedGroup, setActiveOwnedGroup] = React39.useState(null);
|
|
23554
|
+
const [operatorKeys, setOperatorKeys] = React39.useState([]);
|
|
23555
|
+
const [operatorKeysLoading, setOperatorKeysLoading] = React39.useState(false);
|
|
23556
|
+
const [selectedOperatorKeyId, setSelectedOperatorKeyId] = React39.useState("");
|
|
23557
|
+
const [relationshipChildGroupId, setRelationshipChildGroupId] = React39.useState("");
|
|
23558
|
+
const [relationshipAdvancing, setRelationshipAdvancing] = React39.useState(false);
|
|
23559
|
+
const [relationshipProgress, setRelationshipProgress] = React39.useState(null);
|
|
23536
23560
|
const actingAsAnyGroup = !!delegationToken;
|
|
23537
|
-
const selectedGroup =
|
|
23561
|
+
const selectedGroup = React39.useMemo(
|
|
23538
23562
|
() => groups.find((group) => group.id === selectedGroupId) ?? null,
|
|
23539
23563
|
[groups, selectedGroupId]
|
|
23540
23564
|
);
|
|
23541
23565
|
const sourceGroupId = delegationSession?.kind === "owned" ? delegationSession.parentGroupId : delegationSession?.currentGroupId ?? null;
|
|
23542
|
-
const sourceGroup =
|
|
23566
|
+
const sourceGroup = React39.useMemo(
|
|
23543
23567
|
() => groups.find((group) => group.id === sourceGroupId) ?? null,
|
|
23544
23568
|
[groups, sourceGroupId]
|
|
23545
23569
|
);
|
|
23546
23570
|
const canAdvanceRelationshipAsParent = sourceGroup?.role === "owner";
|
|
23547
|
-
|
|
23571
|
+
React39.useEffect(() => {
|
|
23548
23572
|
setRelationshipChildGroupId("");
|
|
23549
23573
|
setRelationshipProgress(null);
|
|
23550
23574
|
}, [delegationSession?.kind, delegationSession?.currentGroupId]);
|
|
23551
|
-
|
|
23575
|
+
React39.useEffect(() => {
|
|
23552
23576
|
let cancelled = false;
|
|
23553
23577
|
if (!delegationToken || delegationSession?.kind !== "direct") {
|
|
23554
23578
|
setOwnedGroups([]);
|
|
@@ -23576,7 +23600,7 @@ var GroupsView = ({
|
|
|
23576
23600
|
cancelled = true;
|
|
23577
23601
|
};
|
|
23578
23602
|
}, [delegationSession, delegationToken]);
|
|
23579
|
-
|
|
23603
|
+
React39.useEffect(() => {
|
|
23580
23604
|
let cancelled = false;
|
|
23581
23605
|
if (delegationSession?.kind !== "direct" || !user?.id) {
|
|
23582
23606
|
setOperatorKeys([]);
|
|
@@ -23613,7 +23637,7 @@ var GroupsView = ({
|
|
|
23613
23637
|
cancelled = true;
|
|
23614
23638
|
};
|
|
23615
23639
|
}, [delegationSession, user?.id]);
|
|
23616
|
-
|
|
23640
|
+
React39.useEffect(() => {
|
|
23617
23641
|
let cancelled = false;
|
|
23618
23642
|
if (!delegationToken || delegationSession?.kind !== "owned") {
|
|
23619
23643
|
setActiveOwnedGroup(null);
|
|
@@ -24363,22 +24387,22 @@ function GroupDetailView({
|
|
|
24363
24387
|
onOpenBilling,
|
|
24364
24388
|
onRefreshed
|
|
24365
24389
|
}) {
|
|
24366
|
-
const [details, setDetails] =
|
|
24367
|
-
const [accountStatus, setAccountStatus] =
|
|
24368
|
-
const [members, setMembers] =
|
|
24369
|
-
const [loading, setLoading] =
|
|
24370
|
-
const [membersLoading, setMembersLoading] =
|
|
24371
|
-
const [error, setError] =
|
|
24372
|
-
const [showAddMember, setShowAddMember] =
|
|
24373
|
-
const [newMemberId, setNewMemberId] =
|
|
24374
|
-
const [newMemberRole, setNewMemberRole] =
|
|
24375
|
-
const [editingMemberId, setEditingMemberId] =
|
|
24376
|
-
const [editingRole, setEditingRole] =
|
|
24377
|
-
const [submitting, setSubmitting] =
|
|
24378
|
-
const [deploying, setDeploying] =
|
|
24390
|
+
const [details, setDetails] = React39.useState(group);
|
|
24391
|
+
const [accountStatus, setAccountStatus] = React39.useState(null);
|
|
24392
|
+
const [members, setMembers] = React39.useState([]);
|
|
24393
|
+
const [loading, setLoading] = React39.useState(true);
|
|
24394
|
+
const [membersLoading, setMembersLoading] = React39.useState(true);
|
|
24395
|
+
const [error, setError] = React39.useState(null);
|
|
24396
|
+
const [showAddMember, setShowAddMember] = React39.useState(false);
|
|
24397
|
+
const [newMemberId, setNewMemberId] = React39.useState("");
|
|
24398
|
+
const [newMemberRole, setNewMemberRole] = React39.useState("member");
|
|
24399
|
+
const [editingMemberId, setEditingMemberId] = React39.useState(null);
|
|
24400
|
+
const [editingRole, setEditingRole] = React39.useState("member");
|
|
24401
|
+
const [submitting, setSubmitting] = React39.useState(false);
|
|
24402
|
+
const [deploying, setDeploying] = React39.useState(false);
|
|
24379
24403
|
const role = details.role ?? group.role ?? "member";
|
|
24380
24404
|
const canManageMembers = role === "owner" || role === "admin";
|
|
24381
|
-
const loadDetails =
|
|
24405
|
+
const loadDetails = React39.useCallback(async () => {
|
|
24382
24406
|
setLoading(true);
|
|
24383
24407
|
setMembersLoading(true);
|
|
24384
24408
|
setError(null);
|
|
@@ -24398,7 +24422,7 @@ function GroupDetailView({
|
|
|
24398
24422
|
setMembersLoading(false);
|
|
24399
24423
|
}
|
|
24400
24424
|
}, [group]);
|
|
24401
|
-
|
|
24425
|
+
React39.useEffect(() => {
|
|
24402
24426
|
setDetails(group);
|
|
24403
24427
|
void loadDetails();
|
|
24404
24428
|
}, [group, loadDetails]);
|
|
@@ -24932,17 +24956,17 @@ function ActiveEnvironmentBadge({
|
|
|
24932
24956
|
configuredTestChains
|
|
24933
24957
|
);
|
|
24934
24958
|
const canChoose = Boolean(activeChainId && options.length > 1);
|
|
24935
|
-
const [busyChainId, setBusyChainId] =
|
|
24936
|
-
const [pendingLiveChainId, setPendingLiveChainId] =
|
|
24937
|
-
const [error, setError] =
|
|
24938
|
-
const switchingRef =
|
|
24939
|
-
const confirmLiveRef =
|
|
24940
|
-
const liveWarningId =
|
|
24959
|
+
const [busyChainId, setBusyChainId] = React39__default.default.useState(null);
|
|
24960
|
+
const [pendingLiveChainId, setPendingLiveChainId] = React39__default.default.useState(null);
|
|
24961
|
+
const [error, setError] = React39__default.default.useState(null);
|
|
24962
|
+
const switchingRef = React39__default.default.useRef(false);
|
|
24963
|
+
const confirmLiveRef = React39__default.default.useRef(null);
|
|
24964
|
+
const liveWarningId = React39__default.default.useId();
|
|
24941
24965
|
const label = modeLabel(environment.mode);
|
|
24942
24966
|
const modeCounts = { test: 0, live: 0, unknown: 0 };
|
|
24943
24967
|
for (const option of options) modeCounts[option.mode] += 1;
|
|
24944
24968
|
const pendingLive = options.find((option) => option.chainId === pendingLiveChainId) ?? null;
|
|
24945
|
-
|
|
24969
|
+
React39__default.default.useEffect(() => {
|
|
24946
24970
|
if (pendingLiveChainId) confirmLiveRef.current?.focus();
|
|
24947
24971
|
}, [pendingLiveChainId]);
|
|
24948
24972
|
async function switchTo(option) {
|
|
@@ -25213,26 +25237,26 @@ var WalletCenterSurface = ({
|
|
|
25213
25237
|
} = useAuthContext();
|
|
25214
25238
|
const walletConfig = useWalletConfig();
|
|
25215
25239
|
const walletCenterUi = walletConfig.ui?.walletCenter;
|
|
25216
|
-
const [section, setSection] =
|
|
25217
|
-
const [historyFilter, setHistoryFilter] =
|
|
25218
|
-
const [historyItems, setHistoryItems] =
|
|
25219
|
-
const [historyOffset, setHistoryOffset] =
|
|
25220
|
-
const [historyHasMore, setHistoryHasMore] =
|
|
25221
|
-
const [historyLoading, setHistoryLoading] =
|
|
25222
|
-
const [historyError, setHistoryError] =
|
|
25223
|
-
const [historyLoadedOnce, setHistoryLoadedOnce] =
|
|
25224
|
-
const [selected, setSelected] =
|
|
25225
|
-
const [selectedSource, setSelectedSource] =
|
|
25226
|
-
const [busyId, setBusyId] =
|
|
25227
|
-
const [actionError, setActionError] =
|
|
25228
|
-
const cancelGuardRef =
|
|
25229
|
-
const wasOpenRef =
|
|
25230
|
-
const walletRootRef =
|
|
25231
|
-
const leaveSection =
|
|
25240
|
+
const [section, setSection] = React39.useState("menu");
|
|
25241
|
+
const [historyFilter, setHistoryFilter] = React39.useState("all");
|
|
25242
|
+
const [historyItems, setHistoryItems] = React39.useState([]);
|
|
25243
|
+
const [historyOffset, setHistoryOffset] = React39.useState(0);
|
|
25244
|
+
const [historyHasMore, setHistoryHasMore] = React39.useState(false);
|
|
25245
|
+
const [historyLoading, setHistoryLoading] = React39.useState(false);
|
|
25246
|
+
const [historyError, setHistoryError] = React39.useState(null);
|
|
25247
|
+
const [historyLoadedOnce, setHistoryLoadedOnce] = React39.useState(false);
|
|
25248
|
+
const [selected, setSelected] = React39.useState(null);
|
|
25249
|
+
const [selectedSource, setSelectedSource] = React39.useState("pending");
|
|
25250
|
+
const [busyId, setBusyId] = React39.useState(null);
|
|
25251
|
+
const [actionError, setActionError] = React39.useState(null);
|
|
25252
|
+
const cancelGuardRef = React39.useRef(/* @__PURE__ */ new Map());
|
|
25253
|
+
const wasOpenRef = React39.useRef(false);
|
|
25254
|
+
const walletRootRef = React39.useRef(null);
|
|
25255
|
+
const leaveSection = React39.useCallback(() => {
|
|
25232
25256
|
if (embedded && initialView !== "menu") onClose();
|
|
25233
25257
|
else setSection("menu");
|
|
25234
25258
|
}, [embedded, initialView, onClose]);
|
|
25235
|
-
|
|
25259
|
+
React39.useEffect(() => {
|
|
25236
25260
|
const justOpened = isOpen && !wasOpenRef.current;
|
|
25237
25261
|
wasOpenRef.current = isOpen;
|
|
25238
25262
|
if (!justOpened) return;
|
|
@@ -25246,24 +25270,24 @@ var WalletCenterSurface = ({
|
|
|
25246
25270
|
setHistoryHasMore(false);
|
|
25247
25271
|
setHistoryLoadedOnce(false);
|
|
25248
25272
|
}, [initialView, isOpen, refreshPending]);
|
|
25249
|
-
|
|
25273
|
+
React39.useEffect(() => {
|
|
25250
25274
|
if (!isOpen) return;
|
|
25251
25275
|
if (activeBuiltinFor(section, modules) === "transactions" && pendingList.length === 0) {
|
|
25252
25276
|
leaveSection();
|
|
25253
25277
|
}
|
|
25254
25278
|
}, [isOpen, leaveSection, modules, pendingList.length, section]);
|
|
25255
|
-
const delegatedGroupId =
|
|
25279
|
+
const delegatedGroupId = React39.useMemo(() => {
|
|
25256
25280
|
if (!delegationToken || typeof window === "undefined") return null;
|
|
25257
25281
|
return window.localStorage.getItem("delegation_group_id");
|
|
25258
25282
|
}, [delegationToken]);
|
|
25259
|
-
const configuredModules =
|
|
25283
|
+
const configuredModules = React39.useMemo(() => {
|
|
25260
25284
|
return validateWalletCenterModules(modules ?? defaultWalletCenterModules());
|
|
25261
25285
|
}, [modules]);
|
|
25262
|
-
const runtime =
|
|
25286
|
+
const runtime = React39.useMemo(
|
|
25263
25287
|
() => ({ pendingCount: pendingList.length, isAuthenticated: !!user }),
|
|
25264
25288
|
[pendingList.length, user]
|
|
25265
25289
|
);
|
|
25266
|
-
const visibleModules =
|
|
25290
|
+
const visibleModules = React39.useMemo(
|
|
25267
25291
|
() => configuredModules.filter((module) => {
|
|
25268
25292
|
if (module.kind === "builtin" && module.builtin === "transactions" && pendingList.length === 0) {
|
|
25269
25293
|
return false;
|
|
@@ -25272,16 +25296,16 @@ var WalletCenterSurface = ({
|
|
|
25272
25296
|
}),
|
|
25273
25297
|
[configuredModules, pendingList.length, runtime]
|
|
25274
25298
|
);
|
|
25275
|
-
const activeModule =
|
|
25299
|
+
const activeModule = React39.useMemo(
|
|
25276
25300
|
() => configuredModules.find((module) => module.id === section) ?? null,
|
|
25277
25301
|
[configuredModules, section]
|
|
25278
25302
|
);
|
|
25279
25303
|
const activeBuiltin = activeModule?.kind === "builtin" ? activeModule.builtin : null;
|
|
25280
|
-
const menuItems =
|
|
25304
|
+
const menuItems = React39.useMemo(
|
|
25281
25305
|
() => buildWalletMenuItems(visibleModules, runtime, groups.length),
|
|
25282
25306
|
[groups.length, runtime, visibleModules]
|
|
25283
25307
|
);
|
|
25284
|
-
|
|
25308
|
+
React39.useEffect(() => {
|
|
25285
25309
|
if (!isOpen) return;
|
|
25286
25310
|
const onVis = () => {
|
|
25287
25311
|
if (document.visibilityState === "visible") {
|
|
@@ -25291,11 +25315,11 @@ var WalletCenterSurface = ({
|
|
|
25291
25315
|
document.addEventListener("visibilitychange", onVis);
|
|
25292
25316
|
return () => document.removeEventListener("visibilitychange", onVis);
|
|
25293
25317
|
}, [isOpen, refreshPending]);
|
|
25294
|
-
|
|
25318
|
+
React39.useEffect(() => {
|
|
25295
25319
|
const scrollContainer = walletRootRef.current?.parentElement;
|
|
25296
25320
|
if (scrollContainer) scrollContainer.scrollTop = 0;
|
|
25297
25321
|
}, [section, selected]);
|
|
25298
|
-
const fetchHistory =
|
|
25322
|
+
const fetchHistory = React39.useCallback(
|
|
25299
25323
|
async (offset, append) => {
|
|
25300
25324
|
setHistoryLoading(true);
|
|
25301
25325
|
setHistoryError(null);
|
|
@@ -25318,7 +25342,7 @@ var WalletCenterSurface = ({
|
|
|
25318
25342
|
},
|
|
25319
25343
|
[userId]
|
|
25320
25344
|
);
|
|
25321
|
-
|
|
25345
|
+
React39.useEffect(() => {
|
|
25322
25346
|
if (!isOpen) return;
|
|
25323
25347
|
if (activeBuiltin !== "history") return;
|
|
25324
25348
|
if (historyLoadedOnce) return;
|
|
@@ -25333,7 +25357,7 @@ var WalletCenterSurface = ({
|
|
|
25333
25357
|
if (historyItems.length >= HISTORY_MAX_ITEMS) return;
|
|
25334
25358
|
void fetchHistory(historyOffset, true);
|
|
25335
25359
|
};
|
|
25336
|
-
const filteredHistoryItems =
|
|
25360
|
+
const filteredHistoryItems = React39.useMemo(() => {
|
|
25337
25361
|
if (historyFilter === "all") return historyItems;
|
|
25338
25362
|
const want = historyFilter === "Completed" /* Completed */ ? /* @__PURE__ */ new Set(["completed", "success"]) : historyFilter === "Failed" /* Failed */ ? /* @__PURE__ */ new Set(["failed", "error"]) : /* @__PURE__ */ new Set(["canceled", "cancelled"]);
|
|
25339
25363
|
return historyItems.filter(
|
|
@@ -25406,7 +25430,7 @@ var WalletCenterSurface = ({
|
|
|
25406
25430
|
setActionError(e?.message ?? "Failed to retry message.");
|
|
25407
25431
|
}
|
|
25408
25432
|
};
|
|
25409
|
-
const handleMenuActAsSelf =
|
|
25433
|
+
const handleMenuActAsSelf = React39.useCallback(async () => {
|
|
25410
25434
|
setActionError(null);
|
|
25411
25435
|
try {
|
|
25412
25436
|
clearDelegationToken();
|
|
@@ -25414,7 +25438,7 @@ var WalletCenterSurface = ({
|
|
|
25414
25438
|
setActionError(e?.message ?? "Failed to switch entity.");
|
|
25415
25439
|
}
|
|
25416
25440
|
}, [clearDelegationToken]);
|
|
25417
|
-
const handleMenuActAsGroup =
|
|
25441
|
+
const handleMenuActAsGroup = React39.useCallback(
|
|
25418
25442
|
async (group) => {
|
|
25419
25443
|
setActionError(null);
|
|
25420
25444
|
try {
|
|
@@ -25425,7 +25449,7 @@ var WalletCenterSurface = ({
|
|
|
25425
25449
|
},
|
|
25426
25450
|
[createDelegationToken]
|
|
25427
25451
|
);
|
|
25428
|
-
const handleSignOut =
|
|
25452
|
+
const handleSignOut = React39.useCallback(async () => {
|
|
25429
25453
|
setActionError(null);
|
|
25430
25454
|
try {
|
|
25431
25455
|
await logout();
|
|
@@ -25439,7 +25463,7 @@ var WalletCenterSurface = ({
|
|
|
25439
25463
|
setActionError(e?.message ?? "Failed to sign out.");
|
|
25440
25464
|
}
|
|
25441
25465
|
}, [logout, onClose, walletConfig]);
|
|
25442
|
-
const navigateFromCenter =
|
|
25466
|
+
const navigateFromCenter = React39.useCallback(
|
|
25443
25467
|
(href, options) => {
|
|
25444
25468
|
if (walletConfig.onNavigate) {
|
|
25445
25469
|
walletConfig.onNavigate(href, options);
|
|
@@ -25450,7 +25474,7 @@ var WalletCenterSurface = ({
|
|
|
25450
25474
|
},
|
|
25451
25475
|
[walletConfig]
|
|
25452
25476
|
);
|
|
25453
|
-
const panelContext =
|
|
25477
|
+
const panelContext = React39.useMemo(
|
|
25454
25478
|
() => ({
|
|
25455
25479
|
close: onClose,
|
|
25456
25480
|
back: () => setSection("menu"),
|
|
@@ -25461,7 +25485,7 @@ var WalletCenterSurface = ({
|
|
|
25461
25485
|
}),
|
|
25462
25486
|
[navigateFromCenter, onClose]
|
|
25463
25487
|
);
|
|
25464
|
-
const resolvedActors =
|
|
25488
|
+
const resolvedActors = React39.useMemo(() => {
|
|
25465
25489
|
if (actors) return actors;
|
|
25466
25490
|
return [
|
|
25467
25491
|
{
|
|
@@ -25488,7 +25512,7 @@ var WalletCenterSurface = ({
|
|
|
25488
25512
|
status: identity?.status ?? { label: "Online", color: "#4ade80" },
|
|
25489
25513
|
actions: identity?.actions ?? []
|
|
25490
25514
|
};
|
|
25491
|
-
const handleSelectModule =
|
|
25515
|
+
const handleSelectModule = React39.useCallback(
|
|
25492
25516
|
(module) => {
|
|
25493
25517
|
setActionError(null);
|
|
25494
25518
|
if (module.kind === "route") {
|
|
@@ -25500,7 +25524,7 @@ var WalletCenterSurface = ({
|
|
|
25500
25524
|
},
|
|
25501
25525
|
[navigateFromCenter, onClose]
|
|
25502
25526
|
);
|
|
25503
|
-
const handleSelectActor =
|
|
25527
|
+
const handleSelectActor = React39.useCallback(async (actor) => {
|
|
25504
25528
|
setActionError(null);
|
|
25505
25529
|
try {
|
|
25506
25530
|
await actor.onSelect();
|
|
@@ -25509,7 +25533,7 @@ var WalletCenterSurface = ({
|
|
|
25509
25533
|
setActionError(error?.message ?? "Failed to switch signing context.");
|
|
25510
25534
|
}
|
|
25511
25535
|
}, [leaveSection]);
|
|
25512
|
-
const drawerTitle =
|
|
25536
|
+
const drawerTitle = React39.useMemo(() => {
|
|
25513
25537
|
if (selected) {
|
|
25514
25538
|
const label = humanizeMessageType(selected.data?.message_type);
|
|
25515
25539
|
return selectedSource === "pending" ? `${label} \u2014 Sign` : label;
|
|
@@ -25517,7 +25541,7 @@ var WalletCenterSurface = ({
|
|
|
25517
25541
|
return "Wallet";
|
|
25518
25542
|
}, [selected, selectedSource]);
|
|
25519
25543
|
const hostedTitle = !embedded ? null : selected ? drawerTitle : section === "actors" ? "Signing context" : activeModule?.label ?? null;
|
|
25520
|
-
|
|
25544
|
+
React39.useEffect(() => {
|
|
25521
25545
|
if (!embedded) return void 0;
|
|
25522
25546
|
onTitle?.(hostedTitle);
|
|
25523
25547
|
return () => onTitle?.(null);
|
|
@@ -25702,7 +25726,7 @@ function WalletMenu({
|
|
|
25702
25726
|
const secondaryItems = items.filter((item) => item.placement === "secondary");
|
|
25703
25727
|
const activeActor = actors.find((actor) => actor.active) ?? actors[0];
|
|
25704
25728
|
const userName = identity.name ?? "You";
|
|
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(
|
|
25729
|
+
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(React39__default.default.Fragment, { children: [
|
|
25706
25730
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25707
25731
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25708
25732
|
WalletMenuRow,
|
|
@@ -25946,13 +25970,13 @@ function ActorsPane({
|
|
|
25946
25970
|
error,
|
|
25947
25971
|
onSelect
|
|
25948
25972
|
}) {
|
|
25949
|
-
const [busyId, setBusyId] =
|
|
25973
|
+
const [busyId, setBusyId] = React39.useState(null);
|
|
25950
25974
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [
|
|
25951
25975
|
/* @__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." }),
|
|
25952
25976
|
error && /* @__PURE__ */ jsxRuntime.jsx(ErrorBanner, { children: error }),
|
|
25953
25977
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[22px] border border-border-light bg-raised", children: actors.map((actor, index) => {
|
|
25954
25978
|
const ActorIcon = actor.icon;
|
|
25955
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25979
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React39__default.default.Fragment, { children: [
|
|
25956
25980
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25957
25981
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25958
25982
|
"button",
|
|
@@ -25987,10 +26011,10 @@ function DirectoryPane({
|
|
|
25987
26011
|
module,
|
|
25988
26012
|
context
|
|
25989
26013
|
}) {
|
|
25990
|
-
const [query, setQuery] =
|
|
26014
|
+
const [query, setQuery] = React39.useState("");
|
|
25991
26015
|
const isMobile = useWalletCenterMobile();
|
|
25992
26016
|
const normalizedQuery = normalizeSearchText(query);
|
|
25993
|
-
const visibleGroups =
|
|
26017
|
+
const visibleGroups = React39.useMemo(
|
|
25994
26018
|
() => module.groups.filter((group) => {
|
|
25995
26019
|
if (!group.visibility || group.visibility === "always") return true;
|
|
25996
26020
|
return group.visibility === (isMobile ? "mobile" : "desktop");
|
|
@@ -26091,10 +26115,10 @@ function normalizeSearchText(value) {
|
|
|
26091
26115
|
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLocaleLowerCase();
|
|
26092
26116
|
}
|
|
26093
26117
|
function useWalletCenterMobile() {
|
|
26094
|
-
const [isMobile, setIsMobile] =
|
|
26118
|
+
const [isMobile, setIsMobile] = React39.useState(
|
|
26095
26119
|
() => typeof window !== "undefined" && window.matchMedia("(max-width: 639px)").matches
|
|
26096
26120
|
);
|
|
26097
|
-
|
|
26121
|
+
React39.useEffect(() => {
|
|
26098
26122
|
if (typeof window === "undefined") return;
|
|
26099
26123
|
const media = window.matchMedia("(max-width: 639px)");
|
|
26100
26124
|
const update = () => setIsMobile(media.matches);
|
|
@@ -26634,10 +26658,10 @@ function messageText(content) {
|
|
|
26634
26658
|
return JSON.stringify(content, null, 2);
|
|
26635
26659
|
}
|
|
26636
26660
|
var PromptTranscript = ({ usageEventId }) => {
|
|
26637
|
-
const [log, setLog] =
|
|
26638
|
-
const [note, setNote] =
|
|
26639
|
-
const [loading, setLoading] =
|
|
26640
|
-
|
|
26661
|
+
const [log, setLog] = React39.useState(null);
|
|
26662
|
+
const [note, setNote] = React39.useState(null);
|
|
26663
|
+
const [loading, setLoading] = React39.useState(true);
|
|
26664
|
+
React39.useEffect(() => {
|
|
26641
26665
|
let cancelled = false;
|
|
26642
26666
|
const base = getAgentsServiceUrl();
|
|
26643
26667
|
setLoading(true);
|
|
@@ -26802,13 +26826,13 @@ var LineItemsTable = ({
|
|
|
26802
26826
|
caption,
|
|
26803
26827
|
showActor
|
|
26804
26828
|
}) => {
|
|
26805
|
-
const [selected, setSelected] =
|
|
26806
|
-
const [gasPricing, setGasPricing] =
|
|
26829
|
+
const [selected, setSelected] = React39.useState(null);
|
|
26830
|
+
const [gasPricing, setGasPricing] = React39.useState(null);
|
|
26807
26831
|
const minuteRate = gasPricing?.agent_minute_usd ?? 0;
|
|
26808
|
-
|
|
26832
|
+
React39.useEffect(() => {
|
|
26809
26833
|
void exports.billingService.getGasPricing().then(setGasPricing);
|
|
26810
26834
|
}, []);
|
|
26811
|
-
const columns =
|
|
26835
|
+
const columns = React39.useMemo(
|
|
26812
26836
|
() => [
|
|
26813
26837
|
{
|
|
26814
26838
|
header: "When",
|
|
@@ -27067,12 +27091,12 @@ var BuyCreditsDialog = ({
|
|
|
27067
27091
|
source = "manual",
|
|
27068
27092
|
reason
|
|
27069
27093
|
}) => {
|
|
27070
|
-
const [stage, setStage] =
|
|
27071
|
-
const [attempt, setAttempt] =
|
|
27094
|
+
const [stage, setStage] = React39.useState({ kind: "loading" });
|
|
27095
|
+
const [attempt, setAttempt] = React39.useState(0);
|
|
27072
27096
|
const activeGate = creditGateInfoForActiveToken();
|
|
27073
27097
|
const effectiveReason = reason ?? activeGate.reason ?? void 0;
|
|
27074
27098
|
const effectiveGroupId = resolveBuyCreditsTargetGroupId(target, activeGate);
|
|
27075
|
-
|
|
27099
|
+
React39.useEffect(() => {
|
|
27076
27100
|
if (!isOpen) return;
|
|
27077
27101
|
let cancelled = false;
|
|
27078
27102
|
setStage({ kind: "loading" });
|
|
@@ -27111,7 +27135,7 @@ var BuyCreditsDialog = ({
|
|
|
27111
27135
|
cancelled = true;
|
|
27112
27136
|
};
|
|
27113
27137
|
}, [isOpen, effectiveGroupId, effectiveReason, target.kind, attempt]);
|
|
27114
|
-
const redirectTo =
|
|
27138
|
+
const redirectTo = React39.useCallback(
|
|
27115
27139
|
async (open) => {
|
|
27116
27140
|
setStage({ kind: "redirecting" });
|
|
27117
27141
|
try {
|
|
@@ -27130,7 +27154,7 @@ var BuyCreditsDialog = ({
|
|
|
27130
27154
|
},
|
|
27131
27155
|
[effectiveGroupId]
|
|
27132
27156
|
);
|
|
27133
|
-
const buyPlan =
|
|
27157
|
+
const buyPlan = React39.useCallback(
|
|
27134
27158
|
(planId) => {
|
|
27135
27159
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27136
27160
|
kind: "plan",
|
|
@@ -27147,7 +27171,7 @@ var BuyCreditsDialog = ({
|
|
|
27147
27171
|
},
|
|
27148
27172
|
[redirectTo, effectiveGroupId]
|
|
27149
27173
|
);
|
|
27150
|
-
const buyTopup =
|
|
27174
|
+
const buyTopup = React39.useCallback(
|
|
27151
27175
|
(topupId) => {
|
|
27152
27176
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27153
27177
|
kind: "topup",
|
|
@@ -27324,11 +27348,11 @@ var shareKindLabel = (share) => {
|
|
|
27324
27348
|
return KIND_LABELS[kind] ?? (share.entry_kind === "clawback" ? "Adjustment" : "Earnings");
|
|
27325
27349
|
};
|
|
27326
27350
|
var EarningsSection = ({ dense = false }) => {
|
|
27327
|
-
const [summary, setSummary] =
|
|
27328
|
-
const [loaded, setLoaded] =
|
|
27329
|
-
const [connectBusy, setConnectBusy] =
|
|
27330
|
-
const [error, setError] =
|
|
27331
|
-
const load =
|
|
27351
|
+
const [summary, setSummary] = React39.useState(null);
|
|
27352
|
+
const [loaded, setLoaded] = React39.useState(false);
|
|
27353
|
+
const [connectBusy, setConnectBusy] = React39.useState(false);
|
|
27354
|
+
const [error, setError] = React39.useState(null);
|
|
27355
|
+
const load = React39.useCallback(async () => {
|
|
27332
27356
|
try {
|
|
27333
27357
|
const s = await exports.billingService.getMyEarnings();
|
|
27334
27358
|
setSummary(s);
|
|
@@ -27338,10 +27362,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27338
27362
|
setLoaded(true);
|
|
27339
27363
|
}
|
|
27340
27364
|
}, []);
|
|
27341
|
-
|
|
27365
|
+
React39.useEffect(() => {
|
|
27342
27366
|
void load();
|
|
27343
27367
|
}, [load]);
|
|
27344
|
-
const openConnectOnboarding =
|
|
27368
|
+
const openConnectOnboarding = React39.useCallback(async () => {
|
|
27345
27369
|
setConnectBusy(true);
|
|
27346
27370
|
setError(null);
|
|
27347
27371
|
try {
|
|
@@ -27453,10 +27477,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27453
27477
|
init_billingService();
|
|
27454
27478
|
init_creditCheckoutReturn();
|
|
27455
27479
|
var GroupBillingSection = ({ groupId }) => {
|
|
27456
|
-
const [summary, setSummary] =
|
|
27457
|
-
const [portalBusy, setPortalBusy] =
|
|
27458
|
-
const [portalError, setPortalError] =
|
|
27459
|
-
const openGroupPortal =
|
|
27480
|
+
const [summary, setSummary] = React39.useState(null);
|
|
27481
|
+
const [portalBusy, setPortalBusy] = React39.useState(false);
|
|
27482
|
+
const [portalError, setPortalError] = React39.useState(null);
|
|
27483
|
+
const openGroupPortal = React39.useCallback(async () => {
|
|
27460
27484
|
setPortalBusy(true);
|
|
27461
27485
|
setPortalError(null);
|
|
27462
27486
|
try {
|
|
@@ -27472,21 +27496,21 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27472
27496
|
setPortalBusy(false);
|
|
27473
27497
|
}
|
|
27474
27498
|
}, [groupId]);
|
|
27475
|
-
const [pricing, setPricing] =
|
|
27476
|
-
const [items, setItems] =
|
|
27477
|
-
const [hasMore, setHasMore] =
|
|
27478
|
-
const [moreBusy, setMoreBusy] =
|
|
27479
|
-
const [loading, setLoading] =
|
|
27480
|
-
const [hidden, setHidden] =
|
|
27481
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27482
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27483
|
-
const [earnings, setEarnings] =
|
|
27484
|
-
const [reactivating, setReactivating] =
|
|
27485
|
-
const [reactivationError, setReactivationError] =
|
|
27486
|
-
|
|
27499
|
+
const [pricing, setPricing] = React39.useState(null);
|
|
27500
|
+
const [items, setItems] = React39.useState([]);
|
|
27501
|
+
const [hasMore, setHasMore] = React39.useState(false);
|
|
27502
|
+
const [moreBusy, setMoreBusy] = React39.useState(false);
|
|
27503
|
+
const [loading, setLoading] = React39.useState(true);
|
|
27504
|
+
const [hidden, setHidden] = React39.useState(false);
|
|
27505
|
+
const [addCardOpen, setAddCardOpen] = React39.useState(false);
|
|
27506
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React39.useState(false);
|
|
27507
|
+
const [earnings, setEarnings] = React39.useState(null);
|
|
27508
|
+
const [reactivating, setReactivating] = React39.useState(false);
|
|
27509
|
+
const [reactivationError, setReactivationError] = React39.useState(null);
|
|
27510
|
+
React39.useEffect(() => {
|
|
27487
27511
|
void exports.billingService.getGasPricing().then(setPricing);
|
|
27488
27512
|
}, []);
|
|
27489
|
-
|
|
27513
|
+
React39.useEffect(() => {
|
|
27490
27514
|
let cancelled = false;
|
|
27491
27515
|
exports.billingService.getGroupEarnings(groupId).then((e) => {
|
|
27492
27516
|
if (!cancelled) setEarnings(e);
|
|
@@ -27496,7 +27520,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27496
27520
|
cancelled = true;
|
|
27497
27521
|
};
|
|
27498
27522
|
}, [groupId]);
|
|
27499
|
-
const load =
|
|
27523
|
+
const load = React39.useCallback(async () => {
|
|
27500
27524
|
setLoading(true);
|
|
27501
27525
|
try {
|
|
27502
27526
|
const s = await exports.billingService.getGroupBilling(groupId);
|
|
@@ -27509,10 +27533,10 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27509
27533
|
setLoading(false);
|
|
27510
27534
|
}
|
|
27511
27535
|
}, [groupId]);
|
|
27512
|
-
|
|
27536
|
+
React39.useEffect(() => {
|
|
27513
27537
|
void load();
|
|
27514
27538
|
}, [load]);
|
|
27515
|
-
|
|
27539
|
+
React39.useEffect(() => {
|
|
27516
27540
|
const reloadMatchingGroup = (event) => {
|
|
27517
27541
|
const detail = event.detail;
|
|
27518
27542
|
if (detail?.groupId === groupId) void load();
|
|
@@ -27520,7 +27544,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27520
27544
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27521
27545
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27522
27546
|
}, [groupId, load]);
|
|
27523
|
-
const loadMore =
|
|
27547
|
+
const loadMore = React39.useCallback(async () => {
|
|
27524
27548
|
const last = items[items.length - 1];
|
|
27525
27549
|
if (!last || moreBusy) return;
|
|
27526
27550
|
setMoreBusy(true);
|
|
@@ -27537,7 +27561,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27537
27561
|
setMoreBusy(false);
|
|
27538
27562
|
}
|
|
27539
27563
|
}, [groupId, items, moreBusy]);
|
|
27540
|
-
const reactivate =
|
|
27564
|
+
const reactivate = React39.useCallback(async () => {
|
|
27541
27565
|
setReactivating(true);
|
|
27542
27566
|
setReactivationError(null);
|
|
27543
27567
|
try {
|
|
@@ -27756,8 +27780,8 @@ var SeriesLine = ({
|
|
|
27756
27780
|
formatUsdMicros(Math.round(usd2 * 1e6))
|
|
27757
27781
|
] });
|
|
27758
27782
|
var DailySpendChart = ({ summary }) => {
|
|
27759
|
-
const [hovered, setHovered] =
|
|
27760
|
-
const rows =
|
|
27783
|
+
const [hovered, setHovered] = React39.useState(null);
|
|
27784
|
+
const rows = React39.useMemo(() => {
|
|
27761
27785
|
const byDay = /* @__PURE__ */ new Map();
|
|
27762
27786
|
for (const p of summary.daily ?? []) {
|
|
27763
27787
|
const parsed = new Date(p.day);
|
|
@@ -27865,7 +27889,7 @@ var BTN = "inline-flex h-8 shrink-0 items-center rounded-md border border-border
|
|
|
27865
27889
|
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";
|
|
27866
27890
|
var METER_TRACK = "h-1 overflow-hidden rounded-full bg-raised";
|
|
27867
27891
|
var BreakdownCard = ({ title, rows, color, minuteRate, labelFor: labelFor2, countNoun }) => {
|
|
27868
|
-
const displayRows =
|
|
27892
|
+
const displayRows = React39.useMemo(() => {
|
|
27869
27893
|
if (!labelFor2) return rows;
|
|
27870
27894
|
const merged = /* @__PURE__ */ new Map();
|
|
27871
27895
|
for (const r of rows) {
|
|
@@ -27928,21 +27952,21 @@ var Banner = ({
|
|
|
27928
27952
|
);
|
|
27929
27953
|
};
|
|
27930
27954
|
var BillingCenter = ({ dense = false }) => {
|
|
27931
|
-
const [summary, setSummary] =
|
|
27932
|
-
const [pricing, setPricing] =
|
|
27933
|
-
const [items, setItems] =
|
|
27934
|
-
const [hasMore, setHasMore] =
|
|
27935
|
-
const [moreBusy, setMoreBusy] =
|
|
27936
|
-
const [expandedGroup, setExpandedGroup] =
|
|
27937
|
-
const [notConfigured, setNotConfigured] =
|
|
27938
|
-
const [loading, setLoading] =
|
|
27939
|
-
const [loadError, setLoadError] =
|
|
27940
|
-
const [portalBusy, setPortalBusy] =
|
|
27941
|
-
const [portalError, setPortalError] =
|
|
27942
|
-
const [reactivating, setReactivating] =
|
|
27943
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27944
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27945
|
-
const load =
|
|
27955
|
+
const [summary, setSummary] = React39.useState(null);
|
|
27956
|
+
const [pricing, setPricing] = React39.useState(null);
|
|
27957
|
+
const [items, setItems] = React39.useState([]);
|
|
27958
|
+
const [hasMore, setHasMore] = React39.useState(false);
|
|
27959
|
+
const [moreBusy, setMoreBusy] = React39.useState(false);
|
|
27960
|
+
const [expandedGroup, setExpandedGroup] = React39.useState(null);
|
|
27961
|
+
const [notConfigured, setNotConfigured] = React39.useState(false);
|
|
27962
|
+
const [loading, setLoading] = React39.useState(true);
|
|
27963
|
+
const [loadError, setLoadError] = React39.useState(null);
|
|
27964
|
+
const [portalBusy, setPortalBusy] = React39.useState(false);
|
|
27965
|
+
const [portalError, setPortalError] = React39.useState(null);
|
|
27966
|
+
const [reactivating, setReactivating] = React39.useState(false);
|
|
27967
|
+
const [addCardOpen, setAddCardOpen] = React39.useState(false);
|
|
27968
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React39.useState(false);
|
|
27969
|
+
const load = React39.useCallback(async () => {
|
|
27946
27970
|
setLoading(true);
|
|
27947
27971
|
setLoadError(null);
|
|
27948
27972
|
try {
|
|
@@ -27961,16 +27985,16 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27961
27985
|
setLoading(false);
|
|
27962
27986
|
}
|
|
27963
27987
|
}, []);
|
|
27964
|
-
|
|
27988
|
+
React39.useEffect(() => {
|
|
27965
27989
|
void load();
|
|
27966
27990
|
void exports.billingService.getGasPricing().then(setPricing).catch(() => setPricing(null));
|
|
27967
27991
|
}, [load]);
|
|
27968
|
-
|
|
27992
|
+
React39.useEffect(() => {
|
|
27969
27993
|
const reloadAfterCheckout = () => void load();
|
|
27970
27994
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
27971
27995
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
27972
27996
|
}, [load]);
|
|
27973
|
-
const loadMore =
|
|
27997
|
+
const loadMore = React39.useCallback(async () => {
|
|
27974
27998
|
const last = items[items.length - 1];
|
|
27975
27999
|
if (!last || moreBusy) return;
|
|
27976
28000
|
setMoreBusy(true);
|
|
@@ -27984,7 +28008,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27984
28008
|
setMoreBusy(false);
|
|
27985
28009
|
}
|
|
27986
28010
|
}, [items, moreBusy]);
|
|
27987
|
-
const openPortal =
|
|
28011
|
+
const openPortal = React39.useCallback(async () => {
|
|
27988
28012
|
setPortalBusy(true);
|
|
27989
28013
|
setPortalError(null);
|
|
27990
28014
|
try {
|
|
@@ -27995,7 +28019,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27995
28019
|
setPortalBusy(false);
|
|
27996
28020
|
}
|
|
27997
28021
|
}, []);
|
|
27998
|
-
const reactivate =
|
|
28022
|
+
const reactivate = React39.useCallback(async () => {
|
|
27999
28023
|
setReactivating(true);
|
|
28000
28024
|
setPortalError(null);
|
|
28001
28025
|
try {
|
|
@@ -28024,7 +28048,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28024
28048
|
const breakdownCount = [llmBreakdown, gasBreakdown, knowledgeBreakdown].filter(
|
|
28025
28049
|
(rows) => rows.length > 0
|
|
28026
28050
|
).length;
|
|
28027
|
-
const meterKeys =
|
|
28051
|
+
const meterKeys = React39.useMemo(
|
|
28028
28052
|
() => [
|
|
28029
28053
|
"llm_usage_usd",
|
|
28030
28054
|
"gas_usage_usd",
|
|
@@ -28038,10 +28062,10 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28038
28062
|
(g) => g.credit_plan_id && g.status === "active"
|
|
28039
28063
|
) ?? null;
|
|
28040
28064
|
const tokenCardGated = billingGateInfoForActiveToken().cardRequired;
|
|
28041
|
-
const [sponsorBusy, setSponsorBusy] =
|
|
28042
|
-
const [sponsorError, setSponsorError] =
|
|
28043
|
-
const [autoBind, setAutoBind] =
|
|
28044
|
-
|
|
28065
|
+
const [sponsorBusy, setSponsorBusy] = React39.useState(false);
|
|
28066
|
+
const [sponsorError, setSponsorError] = React39.useState(null);
|
|
28067
|
+
const [autoBind, setAutoBind] = React39.useState("idle");
|
|
28068
|
+
React39.useEffect(() => {
|
|
28045
28069
|
if (autoBind !== "idle") return;
|
|
28046
28070
|
if (!summary?.card_required || !tokenCardGated || !platformGroup) return;
|
|
28047
28071
|
setAutoBind("trying");
|
|
@@ -28049,7 +28073,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28049
28073
|
if (bound) await load();
|
|
28050
28074
|
}).finally(() => setAutoBind("settled"));
|
|
28051
28075
|
}, [summary, tokenCardGated, platformGroup, autoBind]);
|
|
28052
|
-
const billViaGroup =
|
|
28076
|
+
const billViaGroup = React39.useCallback(async () => {
|
|
28053
28077
|
if (!platformGroup || sponsorBusy) return;
|
|
28054
28078
|
setSponsorBusy(true);
|
|
28055
28079
|
setSponsorError(null);
|
|
@@ -28433,9 +28457,9 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28433
28457
|
init_cardRequired();
|
|
28434
28458
|
init_billingService();
|
|
28435
28459
|
var CardRequiredHost = () => {
|
|
28436
|
-
const [request, setRequest] =
|
|
28437
|
-
|
|
28438
|
-
|
|
28460
|
+
const [request, setRequest] = React39.useState(null);
|
|
28461
|
+
React39.useEffect(() => exports.cardRequiredGate.subscribe(setRequest), []);
|
|
28462
|
+
React39.useEffect(() => {
|
|
28439
28463
|
let inFlight = false;
|
|
28440
28464
|
const heal = async () => {
|
|
28441
28465
|
if (inFlight) return;
|
|
@@ -28519,11 +28543,11 @@ var PENDING_RETURN_NOTICE = {
|
|
|
28519
28543
|
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."
|
|
28520
28544
|
};
|
|
28521
28545
|
var CreditExhaustedHost = () => {
|
|
28522
|
-
const [request, setRequest] =
|
|
28523
|
-
const [checkoutNotice, setCheckoutNotice] =
|
|
28524
|
-
const [retryMarker, setRetryMarker] =
|
|
28525
|
-
|
|
28526
|
-
|
|
28546
|
+
const [request, setRequest] = React39.useState(null);
|
|
28547
|
+
const [checkoutNotice, setCheckoutNotice] = React39.useState(null);
|
|
28548
|
+
const [retryMarker, setRetryMarker] = React39.useState(null);
|
|
28549
|
+
React39.useEffect(() => creditRequiredGate.subscribe(setRequest), []);
|
|
28550
|
+
React39.useEffect(() => {
|
|
28527
28551
|
const parsedMarker = readCreditCheckoutReturnMarker();
|
|
28528
28552
|
if (!parsedMarker) return;
|
|
28529
28553
|
const marker = parsedMarker;
|
|
@@ -28729,12 +28753,12 @@ function VerifiedBadge({
|
|
|
28729
28753
|
}
|
|
28730
28754
|
function IdentityCard() {
|
|
28731
28755
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
28732
|
-
const [credentials, setCredentials] =
|
|
28733
|
-
const [profile, setProfile] =
|
|
28734
|
-
const [loading, setLoading] =
|
|
28735
|
-
const [activeKyc, setActiveKyc] =
|
|
28736
|
-
const [error, setError] =
|
|
28737
|
-
|
|
28756
|
+
const [credentials, setCredentials] = React39.useState([]);
|
|
28757
|
+
const [profile, setProfile] = React39.useState(null);
|
|
28758
|
+
const [loading, setLoading] = React39.useState(true);
|
|
28759
|
+
const [activeKyc, setActiveKyc] = React39.useState(null);
|
|
28760
|
+
const [error, setError] = React39.useState(null);
|
|
28761
|
+
React39.useEffect(() => {
|
|
28738
28762
|
let cancelled = false;
|
|
28739
28763
|
(async () => {
|
|
28740
28764
|
try {
|
|
@@ -28871,10 +28895,10 @@ function LoginAltMethods({ exclude, platform, onSuccess } = {}) {
|
|
|
28871
28895
|
const navigate = useWalletNavigate();
|
|
28872
28896
|
const { bootstrapSession } = useAuth();
|
|
28873
28897
|
const { config, isLoading } = useProviderConfig();
|
|
28874
|
-
const [busyId, setBusyId] =
|
|
28875
|
-
const [error, setError] =
|
|
28876
|
-
const [passkeySupported, setPasskeySupported] =
|
|
28877
|
-
|
|
28898
|
+
const [busyId, setBusyId] = React39.useState(null);
|
|
28899
|
+
const [error, setError] = React39.useState(null);
|
|
28900
|
+
const [passkeySupported, setPasskeySupported] = React39.useState(false);
|
|
28901
|
+
React39.useEffect(() => {
|
|
28878
28902
|
setPasskeySupported(typeof window !== "undefined" && !!window.PublicKeyCredential);
|
|
28879
28903
|
}, []);
|
|
28880
28904
|
if (isLoading || !config) return null;
|
|
@@ -29040,25 +29064,25 @@ function useForm({
|
|
|
29040
29064
|
schema,
|
|
29041
29065
|
onSubmit
|
|
29042
29066
|
}) {
|
|
29043
|
-
const [state, setState] =
|
|
29067
|
+
const [state, setState] = React39.useState({
|
|
29044
29068
|
values: initialValues,
|
|
29045
29069
|
errors: {},
|
|
29046
29070
|
touched: {}
|
|
29047
29071
|
});
|
|
29048
|
-
const handleChange =
|
|
29072
|
+
const handleChange = React39.useCallback((name, value) => {
|
|
29049
29073
|
setState((prev) => ({
|
|
29050
29074
|
...prev,
|
|
29051
29075
|
values: { ...prev.values, [name]: value },
|
|
29052
29076
|
touched: { ...prev.touched, [name]: true }
|
|
29053
29077
|
}));
|
|
29054
29078
|
}, []);
|
|
29055
|
-
const handleBlur =
|
|
29079
|
+
const handleBlur = React39.useCallback((name) => {
|
|
29056
29080
|
setState((prev) => ({
|
|
29057
29081
|
...prev,
|
|
29058
29082
|
touched: { ...prev.touched, [name]: true }
|
|
29059
29083
|
}));
|
|
29060
29084
|
}, []);
|
|
29061
|
-
const validate =
|
|
29085
|
+
const validate = React39.useCallback(() => {
|
|
29062
29086
|
try {
|
|
29063
29087
|
schema.parse(state.values);
|
|
29064
29088
|
setState((prev) => ({ ...prev, errors: {} }));
|
|
@@ -29074,13 +29098,13 @@ function useForm({
|
|
|
29074
29098
|
return false;
|
|
29075
29099
|
}
|
|
29076
29100
|
}, [schema, state.values]);
|
|
29077
|
-
const handleSubmit =
|
|
29101
|
+
const handleSubmit = React39.useCallback(async (e) => {
|
|
29078
29102
|
e.preventDefault();
|
|
29079
29103
|
if (validate()) {
|
|
29080
29104
|
await onSubmit(state.values);
|
|
29081
29105
|
}
|
|
29082
29106
|
}, [onSubmit, state.values, validate]);
|
|
29083
|
-
const reset =
|
|
29107
|
+
const reset = React39.useCallback(() => {
|
|
29084
29108
|
setState({
|
|
29085
29109
|
values: initialValues,
|
|
29086
29110
|
errors: {},
|
|
@@ -29125,9 +29149,9 @@ var defaultFormConfig = {
|
|
|
29125
29149
|
function useLogin(options = {}) {
|
|
29126
29150
|
const navigate = useWalletNavigate();
|
|
29127
29151
|
const { login: contextLogin, isLoading: contextLoading, error: contextError, clearError: contextClearError, user } = useAuth();
|
|
29128
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29129
|
-
const [error, setError] =
|
|
29130
|
-
const [isAuthenticated, setIsAuthenticated] =
|
|
29152
|
+
const [isSubmitting, setIsSubmitting] = React39.useState(false);
|
|
29153
|
+
const [error, setError] = React39.useState(null);
|
|
29154
|
+
const [isAuthenticated, setIsAuthenticated] = React39.useState(exports.authService.isAuthenticated());
|
|
29131
29155
|
const {
|
|
29132
29156
|
services = ["vault", "payments"],
|
|
29133
29157
|
redirectPath = "/dashboard",
|
|
@@ -29137,11 +29161,11 @@ function useLogin(options = {}) {
|
|
|
29137
29161
|
showErrorMessages = true,
|
|
29138
29162
|
platform: optionsPlatform
|
|
29139
29163
|
} = options;
|
|
29140
|
-
const clearError =
|
|
29164
|
+
const clearError = React39.useCallback(() => {
|
|
29141
29165
|
setError(null);
|
|
29142
29166
|
contextClearError();
|
|
29143
29167
|
}, [contextClearError]);
|
|
29144
|
-
const login =
|
|
29168
|
+
const login = React39.useCallback(async (credentials) => {
|
|
29145
29169
|
try {
|
|
29146
29170
|
setIsSubmitting(true);
|
|
29147
29171
|
setError(null);
|
|
@@ -29395,8 +29419,8 @@ function AccessFlowBody({
|
|
|
29395
29419
|
onSelectPlatform
|
|
29396
29420
|
}) {
|
|
29397
29421
|
const { isAuthenticated } = useAuth();
|
|
29398
|
-
const [mode, setMode] =
|
|
29399
|
-
const handleWizardComplete =
|
|
29422
|
+
const [mode, setMode] = React39.useState(initialMode);
|
|
29423
|
+
const handleWizardComplete = React39.useCallback(
|
|
29400
29424
|
(destination) => {
|
|
29401
29425
|
if (destination === "/login") {
|
|
29402
29426
|
setMode("login");
|
|
@@ -29449,8 +29473,8 @@ init_chainAccountRequired();
|
|
|
29449
29473
|
// src/ui/account/ChainAccountRequiredHost.tsx
|
|
29450
29474
|
init_chainAccountRequired();
|
|
29451
29475
|
var ChainAccountRequiredHost = () => {
|
|
29452
|
-
const [request, setRequest] =
|
|
29453
|
-
|
|
29476
|
+
const [request, setRequest] = React39.useState(null);
|
|
29477
|
+
React39.useEffect(() => exports.chainAccountRequiredGate.subscribe(setRequest), []);
|
|
29454
29478
|
if (!request) return null;
|
|
29455
29479
|
const key = `${request.context.entityKind}:${request.context.entityId}:${request.context.chainId}`;
|
|
29456
29480
|
return /* @__PURE__ */ jsxRuntime.jsx(ChainAccountActivationDialog, { request }, key);
|
|
@@ -29458,10 +29482,10 @@ var ChainAccountRequiredHost = () => {
|
|
|
29458
29482
|
var ChainAccountActivationDialog = ({ request }) => {
|
|
29459
29483
|
const mode = chainAccountMode(request.context);
|
|
29460
29484
|
const label = mode === "test" ? "Test" : "Live";
|
|
29461
|
-
const [started, setStarted] =
|
|
29462
|
-
const [waitingForVerification, setWaitingForVerification] =
|
|
29463
|
-
const [status, setStatus] =
|
|
29464
|
-
const [error, setError] =
|
|
29485
|
+
const [started, setStarted] = React39.useState(false);
|
|
29486
|
+
const [waitingForVerification, setWaitingForVerification] = React39.useState(false);
|
|
29487
|
+
const [status, setStatus] = React39.useState(null);
|
|
29488
|
+
const [error, setError] = React39.useState(null);
|
|
29465
29489
|
async function activate(verificationAttempted = false) {
|
|
29466
29490
|
setStarted(true);
|
|
29467
29491
|
setError(null);
|
|
@@ -29584,8 +29608,8 @@ init_walletIdentity();
|
|
|
29584
29608
|
init_verificationsService();
|
|
29585
29609
|
init_ProviderConfigContext();
|
|
29586
29610
|
var VerificationRequiredHost = () => {
|
|
29587
|
-
const [request, setRequest] =
|
|
29588
|
-
|
|
29611
|
+
const [request, setRequest] = React39.useState(null);
|
|
29612
|
+
React39.useEffect(() => verificationRequiredGate.subscribe(setRequest), []);
|
|
29589
29613
|
if (!request) return null;
|
|
29590
29614
|
return /* @__PURE__ */ jsxRuntime.jsx(VerificationDialog, { request }, request.context.profile ?? "default");
|
|
29591
29615
|
};
|
|
@@ -29594,12 +29618,12 @@ var VerificationDialog = ({
|
|
|
29594
29618
|
}) => {
|
|
29595
29619
|
const { context } = request;
|
|
29596
29620
|
const { config } = useProviderConfig();
|
|
29597
|
-
const [activeProvider, setActiveProvider] =
|
|
29598
|
-
const [checking, setChecking] =
|
|
29599
|
-
const [error, setError] =
|
|
29600
|
-
const [isGroupManager, setIsGroupManager] =
|
|
29621
|
+
const [activeProvider, setActiveProvider] = React39.useState(null);
|
|
29622
|
+
const [checking, setChecking] = React39.useState(false);
|
|
29623
|
+
const [error, setError] = React39.useState(null);
|
|
29624
|
+
const [isGroupManager, setIsGroupManager] = React39.useState(null);
|
|
29601
29625
|
const hasGroupMiss = context.missing.some((m) => m.subject_kind === "group");
|
|
29602
|
-
|
|
29626
|
+
React39.useEffect(() => {
|
|
29603
29627
|
if (!hasGroupMiss || !context.groupId) return;
|
|
29604
29628
|
let cancelled = false;
|
|
29605
29629
|
groupsService.getGroupDetails(context.groupId).then((g) => {
|
|
@@ -29776,25 +29800,25 @@ function BusinessVerificationSection({
|
|
|
29776
29800
|
initialStatus
|
|
29777
29801
|
}) {
|
|
29778
29802
|
const { config } = useProviderConfig();
|
|
29779
|
-
const [status, setStatus] =
|
|
29780
|
-
const [flowInstance, setFlowInstance] =
|
|
29781
|
-
const [error, setError] =
|
|
29782
|
-
const [busy, setBusy] =
|
|
29783
|
-
const kybInstances =
|
|
29803
|
+
const [status, setStatus] = React39__default.default.useState(initialStatus ?? "not_required");
|
|
29804
|
+
const [flowInstance, setFlowInstance] = React39__default.default.useState(null);
|
|
29805
|
+
const [error, setError] = React39__default.default.useState(null);
|
|
29806
|
+
const [busy, setBusy] = React39__default.default.useState(false);
|
|
29807
|
+
const kybInstances = React39__default.default.useMemo(
|
|
29784
29808
|
() => (config?.kyc.enabled ?? []).filter(
|
|
29785
29809
|
(id) => config?.kyc.settings[id]?.subject === "group"
|
|
29786
29810
|
),
|
|
29787
29811
|
[config]
|
|
29788
29812
|
);
|
|
29789
29813
|
const entityDefault = config?.kyc.entity_default_profile ?? null;
|
|
29790
|
-
const refreshStatus =
|
|
29814
|
+
const refreshStatus = React39__default.default.useCallback(async () => {
|
|
29791
29815
|
try {
|
|
29792
29816
|
const s = await getIdentityStatus({ groupId });
|
|
29793
29817
|
setStatus(s.status === "unverified" ? "unverified" : s.status);
|
|
29794
29818
|
} catch {
|
|
29795
29819
|
}
|
|
29796
29820
|
}, [groupId]);
|
|
29797
|
-
|
|
29821
|
+
React39__default.default.useEffect(() => {
|
|
29798
29822
|
if (initialStatus !== void 0) setStatus(initialStatus);
|
|
29799
29823
|
}, [initialStatus]);
|
|
29800
29824
|
const startFlow = async (bindFirst) => {
|
|
@@ -30530,31 +30554,31 @@ function readDelegationGroupId() {
|
|
|
30530
30554
|
function useIncomingPayments(options = {}) {
|
|
30531
30555
|
const { entityId: entityIdOverride, walletId: walletIdOverride, disableLiveRefresh } = options;
|
|
30532
30556
|
const { user, isAuthenticated } = useAuth();
|
|
30533
|
-
const [delegationGroupId, setDelegationGroupId] =
|
|
30557
|
+
const [delegationGroupId, setDelegationGroupId] = React39.useState(
|
|
30534
30558
|
() => readDelegationGroupId()
|
|
30535
30559
|
);
|
|
30536
|
-
|
|
30560
|
+
React39.useEffect(() => {
|
|
30537
30561
|
setDelegationGroupId(readDelegationGroupId());
|
|
30538
30562
|
}, [isAuthenticated, user?.id]);
|
|
30539
|
-
const activeEntityId =
|
|
30563
|
+
const activeEntityId = React39.useMemo(() => {
|
|
30540
30564
|
if (entityIdOverride !== void 0) return entityIdOverride;
|
|
30541
30565
|
if (delegationGroupId) return delegationGroupId;
|
|
30542
30566
|
return user?.id ?? null;
|
|
30543
30567
|
}, [entityIdOverride, delegationGroupId, user?.id]);
|
|
30544
30568
|
const activeWalletId = walletIdOverride ?? user?.default_wallet_id ?? null;
|
|
30545
|
-
const [payments, setPayments] =
|
|
30546
|
-
const [contracts, setContracts] =
|
|
30547
|
-
const [swaps, setSwaps] =
|
|
30548
|
-
const [loading, setLoading] =
|
|
30549
|
-
const [error, setError] =
|
|
30550
|
-
const [acceptState, setAcceptState] =
|
|
30551
|
-
const inflightRef =
|
|
30552
|
-
const activeEntityIdRef =
|
|
30553
|
-
|
|
30569
|
+
const [payments, setPayments] = React39.useState([]);
|
|
30570
|
+
const [contracts, setContracts] = React39.useState([]);
|
|
30571
|
+
const [swaps, setSwaps] = React39.useState([]);
|
|
30572
|
+
const [loading, setLoading] = React39.useState(false);
|
|
30573
|
+
const [error, setError] = React39.useState(null);
|
|
30574
|
+
const [acceptState, setAcceptState] = React39.useState({ itemKey: null, error: null });
|
|
30575
|
+
const inflightRef = React39.useRef(null);
|
|
30576
|
+
const activeEntityIdRef = React39.useRef(activeEntityId);
|
|
30577
|
+
React39.useEffect(() => {
|
|
30554
30578
|
activeEntityIdRef.current = activeEntityId;
|
|
30555
30579
|
setDelegationGroupId(readDelegationGroupId());
|
|
30556
30580
|
});
|
|
30557
|
-
const fetchAll =
|
|
30581
|
+
const fetchAll = React39.useCallback(async () => {
|
|
30558
30582
|
if (!isAuthenticated || !activeEntityId) {
|
|
30559
30583
|
setPayments([]);
|
|
30560
30584
|
setContracts([]);
|
|
@@ -30605,10 +30629,10 @@ function useIncomingPayments(options = {}) {
|
|
|
30605
30629
|
inflightRef.current = work;
|
|
30606
30630
|
return work;
|
|
30607
30631
|
}, [isAuthenticated, activeEntityId, activeWalletId]);
|
|
30608
|
-
|
|
30632
|
+
React39.useEffect(() => {
|
|
30609
30633
|
void fetchAll();
|
|
30610
30634
|
}, [fetchAll]);
|
|
30611
|
-
|
|
30635
|
+
React39.useEffect(() => {
|
|
30612
30636
|
if (disableLiveRefresh) return;
|
|
30613
30637
|
if (!isAuthenticated || !activeEntityId) return;
|
|
30614
30638
|
const unsub = subscribeEntityEvents(activeEntityId, (event) => {
|
|
@@ -30620,12 +30644,12 @@ function useIncomingPayments(options = {}) {
|
|
|
30620
30644
|
unsub();
|
|
30621
30645
|
};
|
|
30622
30646
|
}, [isAuthenticated, activeEntityId, disableLiveRefresh, fetchAll]);
|
|
30623
|
-
const items =
|
|
30647
|
+
const items = React39.useMemo(
|
|
30624
30648
|
() => buildInbox({ payments, contracts, swaps, activeEntityId }),
|
|
30625
30649
|
[payments, contracts, swaps, activeEntityId]
|
|
30626
30650
|
);
|
|
30627
|
-
const groups =
|
|
30628
|
-
const accept =
|
|
30651
|
+
const groups = React39.useMemo(() => groupInbox(items), [items]);
|
|
30652
|
+
const accept = React39.useCallback(
|
|
30629
30653
|
async (item) => {
|
|
30630
30654
|
setAcceptState({ itemKey: item.key, error: null });
|
|
30631
30655
|
try {
|
|
@@ -30650,7 +30674,7 @@ function useIncomingPayments(options = {}) {
|
|
|
30650
30674
|
},
|
|
30651
30675
|
[]
|
|
30652
30676
|
);
|
|
30653
|
-
const cancel =
|
|
30677
|
+
const cancel = React39.useCallback(async (paymentId) => {
|
|
30654
30678
|
try {
|
|
30655
30679
|
await paymentsService.cancelPayment({ paymentId });
|
|
30656
30680
|
setPayments((prev) => prev.filter((p) => p.id !== paymentId));
|
|
@@ -30679,14 +30703,14 @@ function resetDecimalsWarningCache() {
|
|
|
30679
30703
|
warnedTokenIds.clear();
|
|
30680
30704
|
}
|
|
30681
30705
|
function useDecimalsCore(payments, walletAddress) {
|
|
30682
|
-
const [cache2, setCache] =
|
|
30683
|
-
const [cacheErrors, setCacheErrors] =
|
|
30684
|
-
const fetchingRef =
|
|
30685
|
-
const cacheRef =
|
|
30686
|
-
|
|
30706
|
+
const [cache2, setCache] = React39.useState(/* @__PURE__ */ new Map());
|
|
30707
|
+
const [cacheErrors, setCacheErrors] = React39.useState(/* @__PURE__ */ new Map());
|
|
30708
|
+
const fetchingRef = React39.useRef(/* @__PURE__ */ new Set());
|
|
30709
|
+
const cacheRef = React39.useRef(cache2);
|
|
30710
|
+
React39.useEffect(() => {
|
|
30687
30711
|
cacheRef.current = cache2;
|
|
30688
30712
|
}, [cache2]);
|
|
30689
|
-
|
|
30713
|
+
React39.useEffect(() => {
|
|
30690
30714
|
if (!payments || payments.length === 0) return;
|
|
30691
30715
|
const todo = /* @__PURE__ */ new Set();
|
|
30692
30716
|
for (const payment of payments) {
|
|
@@ -30777,7 +30801,7 @@ function useDecimalsCore(payments, walletAddress) {
|
|
|
30777
30801
|
todo.forEach((id) => fetchingRef.current.delete(id));
|
|
30778
30802
|
};
|
|
30779
30803
|
}, [payments, walletAddress]);
|
|
30780
|
-
return
|
|
30804
|
+
return React39.useMemo(() => ({ cache: cache2, cacheErrors }), [cache2, cacheErrors]);
|
|
30781
30805
|
}
|
|
30782
30806
|
function usePaymentDecimals(payments, walletAddress) {
|
|
30783
30807
|
const { cache: cache2 } = useDecimalsCore(payments, walletAddress);
|
|
@@ -30982,7 +31006,7 @@ var IncomingPaymentsInbox = ({
|
|
|
30982
31006
|
...hookOptions
|
|
30983
31007
|
}) => {
|
|
30984
31008
|
const inbox = useIncomingPayments(hookOptions);
|
|
30985
|
-
const allPayments =
|
|
31009
|
+
const allPayments = React39__default.default.useMemo(
|
|
30986
31010
|
() => [
|
|
30987
31011
|
...inbox.payments,
|
|
30988
31012
|
...inbox.contracts.flatMap((c) => c.payments ?? [])
|
|
@@ -31143,7 +31167,7 @@ var IncomingPaymentsLauncher = ({
|
|
|
31143
31167
|
}) => {
|
|
31144
31168
|
const { isAuthenticated } = useAuth();
|
|
31145
31169
|
const inbox = useIncomingPayments(hookOptions);
|
|
31146
|
-
const [open, setOpen] =
|
|
31170
|
+
const [open, setOpen] = React39.useState(false);
|
|
31147
31171
|
if (hideWhenSignedOut && !isAuthenticated) return null;
|
|
31148
31172
|
const handleClick = onClick ?? (() => setOpen(true));
|
|
31149
31173
|
const count = inbox.items.length;
|
|
@@ -31273,11 +31297,11 @@ function SummaryTile({ label, count }) {
|
|
|
31273
31297
|
] });
|
|
31274
31298
|
}
|
|
31275
31299
|
function useSendPayment() {
|
|
31276
|
-
const [sending, setSending] =
|
|
31277
|
-
const [error, setError] =
|
|
31278
|
-
const [lastResponse, setLastResponse] =
|
|
31279
|
-
const inflightRef =
|
|
31280
|
-
const send =
|
|
31300
|
+
const [sending, setSending] = React39.useState(false);
|
|
31301
|
+
const [error, setError] = React39.useState(null);
|
|
31302
|
+
const [lastResponse, setLastResponse] = React39.useState(null);
|
|
31303
|
+
const inflightRef = React39.useRef(null);
|
|
31304
|
+
const send = React39.useCallback(async (args) => {
|
|
31281
31305
|
if (inflightRef.current) {
|
|
31282
31306
|
return inflightRef.current;
|
|
31283
31307
|
}
|
|
@@ -31305,7 +31329,7 @@ function useSendPayment() {
|
|
|
31305
31329
|
inflightRef.current = work;
|
|
31306
31330
|
return work;
|
|
31307
31331
|
}, []);
|
|
31308
|
-
const reset =
|
|
31332
|
+
const reset = React39.useCallback(() => {
|
|
31309
31333
|
setError(null);
|
|
31310
31334
|
setLastResponse(null);
|
|
31311
31335
|
}, []);
|
|
@@ -31323,13 +31347,13 @@ var SendPaymentForm = ({
|
|
|
31323
31347
|
className = ""
|
|
31324
31348
|
}) => {
|
|
31325
31349
|
const initialAssetId = (defaultAssetId && assets.find((a) => a.id === defaultAssetId)?.id) ?? assets[0]?.id ?? "";
|
|
31326
|
-
const [assetId, setAssetId] =
|
|
31327
|
-
const [amount, setAmount] =
|
|
31328
|
-
const [recipient, setRecipient] =
|
|
31329
|
-
const [recipientMode, setRecipientMode] =
|
|
31330
|
-
const [description, setDescription] =
|
|
31331
|
-
const [validationError, setValidationError] =
|
|
31332
|
-
|
|
31350
|
+
const [assetId, setAssetId] = React39.useState(initialAssetId);
|
|
31351
|
+
const [amount, setAmount] = React39.useState(defaultAmount);
|
|
31352
|
+
const [recipient, setRecipient] = React39.useState(defaultRecipient);
|
|
31353
|
+
const [recipientMode, setRecipientMode] = React39.useState("entity");
|
|
31354
|
+
const [description, setDescription] = React39.useState("");
|
|
31355
|
+
const [validationError, setValidationError] = React39.useState(null);
|
|
31356
|
+
React39.useEffect(() => {
|
|
31333
31357
|
if (assetId === "" && assets.length > 0) {
|
|
31334
31358
|
setAssetId(assets[0].id);
|
|
31335
31359
|
} else if (assetId && !assets.find((a) => a.id === assetId)) {
|