@yieldfabric/wallet 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +745 -773
- package/dist/index.js +104 -132
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var React55 = require('react');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var avererWebsdk = require('@averer/averer-websdk');
|
|
13
13
|
var sha3 = require('js-sha3');
|
|
@@ -20,7 +20,7 @@ var zod = require('zod');
|
|
|
20
20
|
|
|
21
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var React55__default = /*#__PURE__*/_interopDefault(React55);
|
|
24
24
|
var sha3__default = /*#__PURE__*/_interopDefault(sha3);
|
|
25
25
|
var theme__default = /*#__PURE__*/_interopDefault(theme);
|
|
26
26
|
|
|
@@ -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 React55.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 = React55.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] = React55.useState({
|
|
5004
5004
|
config: null,
|
|
5005
5005
|
isLoading: true,
|
|
5006
5006
|
error: null
|
|
5007
5007
|
});
|
|
5008
|
-
|
|
5008
|
+
React55.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 React55.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 = React55.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
|
+
React55.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
|
+
React55.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 = React55.useRef(wallet);
|
|
5420
|
+
React55.useEffect(() => {
|
|
5421
5421
|
walletRef.current = wallet;
|
|
5422
5422
|
}, [wallet]);
|
|
5423
|
-
const widgetWrapRef =
|
|
5424
|
-
|
|
5423
|
+
const widgetWrapRef = React55.useRef(null);
|
|
5424
|
+
React55.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 = React55.useRef(identityProvidersKey);
|
|
5920
|
+
const [state, setState] = React55.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
|
+
React55.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
|
+
React55.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
|
+
React55.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 = React55.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] = React55.useState(null);
|
|
6025
|
+
const [isLoading, setIsLoading] = React55.useState(true);
|
|
6026
|
+
const [error, setError] = React55.useState(null);
|
|
6027
|
+
const [retryTick, setRetryTick] = React55.useState(0);
|
|
6028
|
+
const retryWhenOnline = React55.useCallback(() => {
|
|
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
|
+
React55.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
|
+
React55.useEffect(() => {
|
|
6068
6068
|
if (user?.id) {
|
|
6069
6069
|
invalidateWalletCount();
|
|
6070
6070
|
}
|
|
6071
6071
|
}, [user?.id]);
|
|
6072
|
-
|
|
6072
|
+
React55.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 = React55.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] = React55.useState(cachedModule);
|
|
6473
|
+
React55.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
|
+
React55.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 = React55.createContext(null);
|
|
6508
|
+
var SilentSdkBoundary = class extends React55.Component {
|
|
6509
6509
|
constructor() {
|
|
6510
6510
|
super(...arguments);
|
|
6511
6511
|
this.state = { hasError: false };
|
|
@@ -6525,10 +6525,10 @@ var SilentSdkBoundary = class extends React54.Component {
|
|
|
6525
6525
|
}
|
|
6526
6526
|
};
|
|
6527
6527
|
function usePathname() {
|
|
6528
|
-
const [path, setPath] =
|
|
6528
|
+
const [path, setPath] = React55.useState(
|
|
6529
6529
|
() => typeof window !== "undefined" ? window.location.pathname : "/"
|
|
6530
6530
|
);
|
|
6531
|
-
|
|
6531
|
+
React55.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 = React55.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 = React55.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 = React55.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 = React55.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 = React55.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 = React55.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 = React55.useContext(WalletSignerContext);
|
|
6685
6685
|
if (!ctx) {
|
|
6686
6686
|
throw new Error("useWalletSigner must be used inside <WalletSignerProvider>");
|
|
6687
6687
|
}
|
|
@@ -7824,13 +7824,13 @@ function getWebSocketChannelManager(url, getAccessToken) {
|
|
|
7824
7824
|
init_config();
|
|
7825
7825
|
init_jwtClaims();
|
|
7826
7826
|
init_WalletConfigContext();
|
|
7827
|
-
var SignatureQueueContext =
|
|
7827
|
+
var SignatureQueueContext = React55.createContext(null);
|
|
7828
7828
|
function SignatureQueueProvider({ children }) {
|
|
7829
7829
|
const value = useSignatureQueueInternal();
|
|
7830
7830
|
return /* @__PURE__ */ jsxRuntime.jsx(SignatureQueueContext.Provider, { value, children });
|
|
7831
7831
|
}
|
|
7832
7832
|
function useSignatureQueue() {
|
|
7833
|
-
const ctx =
|
|
7833
|
+
const ctx = React55.useContext(SignatureQueueContext);
|
|
7834
7834
|
const fallback = useSignatureQueueInternal(ctx !== null);
|
|
7835
7835
|
return ctx ?? fallback;
|
|
7836
7836
|
}
|
|
@@ -7838,12 +7838,12 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7838
7838
|
const { user, isAuthenticated } = useAuth();
|
|
7839
7839
|
const { webSocketUrl } = useWalletConfig();
|
|
7840
7840
|
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 =
|
|
7841
|
+
const [pending, setPending] = React55.useState(null);
|
|
7842
|
+
const [pendingList, setPendingList] = React55.useState([]);
|
|
7843
|
+
const [currentMessage, setCurrentMessage] = React55.useState(null);
|
|
7844
|
+
const [drawerOpen, setDrawerOpen] = React55.useState(false);
|
|
7845
|
+
const surfacedRef = React55.useRef(/* @__PURE__ */ new Set());
|
|
7846
|
+
const fetchAndSetPending = React55.useCallback(async () => {
|
|
7847
7847
|
if (inert || !user?.id) return;
|
|
7848
7848
|
try {
|
|
7849
7849
|
const awaiting = await messagesService.getMessagesAwaitingSignature(user.id);
|
|
@@ -7865,7 +7865,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7865
7865
|
console.warn("[useSignatureQueue] refresh failed");
|
|
7866
7866
|
}
|
|
7867
7867
|
}, [inert, user?.id]);
|
|
7868
|
-
|
|
7868
|
+
React55.useEffect(() => {
|
|
7869
7869
|
if (inert) return;
|
|
7870
7870
|
if (!isAuthenticated || !user?.id) return;
|
|
7871
7871
|
if (!getActiveChainId()) return;
|
|
@@ -7921,7 +7921,7 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7921
7921
|
}
|
|
7922
7922
|
};
|
|
7923
7923
|
}, [inert, isAuthenticated, user?.id, webSocketUrl, fetchAndSetPending, tokenStore]);
|
|
7924
|
-
const openSigner =
|
|
7924
|
+
const openSigner = React55.useCallback(
|
|
7925
7925
|
(message) => {
|
|
7926
7926
|
const target = message ?? pending;
|
|
7927
7927
|
if (!target) return;
|
|
@@ -7930,14 +7930,14 @@ function useSignatureQueueInternal(inert = false) {
|
|
|
7930
7930
|
},
|
|
7931
7931
|
[pending]
|
|
7932
7932
|
);
|
|
7933
|
-
const closeSigner =
|
|
7933
|
+
const closeSigner = React55.useCallback(() => {
|
|
7934
7934
|
setDrawerOpen(false);
|
|
7935
7935
|
setCurrentMessage(null);
|
|
7936
7936
|
}, []);
|
|
7937
|
-
const dismissPending =
|
|
7937
|
+
const dismissPending = React55.useCallback(() => {
|
|
7938
7938
|
setPending(null);
|
|
7939
7939
|
}, []);
|
|
7940
|
-
|
|
7940
|
+
React55.useEffect(() => {
|
|
7941
7941
|
if (inert) return;
|
|
7942
7942
|
if (!isAuthenticated) {
|
|
7943
7943
|
setDrawerOpen(false);
|
|
@@ -8681,15 +8681,15 @@ init_delegationScopes();
|
|
|
8681
8681
|
init_tokenManager();
|
|
8682
8682
|
init_jwtClaims();
|
|
8683
8683
|
init_jwtPayload();
|
|
8684
|
-
var AppAuthContext =
|
|
8684
|
+
var AppAuthContext = React55.createContext(void 0);
|
|
8685
8685
|
function AppAuthProvider({ children }) {
|
|
8686
8686
|
const walletAuth = useAuth();
|
|
8687
8687
|
const { isAuthenticated, user, isLoading: walletLoading } = walletAuth;
|
|
8688
|
-
const [groups, setGroups] =
|
|
8689
|
-
const [groupsLoaded, setGroupsLoaded] =
|
|
8690
|
-
const [delegationToken, setDelegationToken] =
|
|
8691
|
-
const [delegationSession, setDelegationSession] =
|
|
8692
|
-
|
|
8688
|
+
const [groups, setGroups] = React55.useState([]);
|
|
8689
|
+
const [groupsLoaded, setGroupsLoaded] = React55.useState(false);
|
|
8690
|
+
const [delegationToken, setDelegationToken] = React55.useState(null);
|
|
8691
|
+
const [delegationSession, setDelegationSession] = React55.useState(null);
|
|
8692
|
+
React55.useEffect(() => {
|
|
8693
8693
|
if (!isAuthenticated) {
|
|
8694
8694
|
setGroups([]);
|
|
8695
8695
|
setGroupsLoaded(false);
|
|
@@ -8720,7 +8720,7 @@ function AppAuthProvider({ children }) {
|
|
|
8720
8720
|
cancelled = true;
|
|
8721
8721
|
};
|
|
8722
8722
|
}, [isAuthenticated, walletLoading, user]);
|
|
8723
|
-
|
|
8723
|
+
React55.useEffect(() => {
|
|
8724
8724
|
if (!isAuthenticated) {
|
|
8725
8725
|
setDelegationToken(null);
|
|
8726
8726
|
setDelegationSession(null);
|
|
@@ -8733,7 +8733,7 @@ function AppAuthProvider({ children }) {
|
|
|
8733
8733
|
sync();
|
|
8734
8734
|
return exports.tokenManager.subscribe(sync);
|
|
8735
8735
|
}, [isAuthenticated]);
|
|
8736
|
-
const refreshGroups =
|
|
8736
|
+
const refreshGroups = React55.useCallback(async () => {
|
|
8737
8737
|
if (!isAuthenticated) return;
|
|
8738
8738
|
try {
|
|
8739
8739
|
const userGroups = await groupsService.getUserGroups();
|
|
@@ -8743,7 +8743,7 @@ function AppAuthProvider({ children }) {
|
|
|
8743
8743
|
console.warn("AppAuthContext.refreshGroups failed:", err);
|
|
8744
8744
|
}
|
|
8745
8745
|
}, [isAuthenticated]);
|
|
8746
|
-
const createDelegationToken =
|
|
8746
|
+
const createDelegationToken = React55.useCallback(async (group) => {
|
|
8747
8747
|
const response = await exports.delegationService.createDelegationToken({
|
|
8748
8748
|
group_id: group.id,
|
|
8749
8749
|
delegation_scope: [...exports.DEFAULT_APP_DELEGATION_SCOPE],
|
|
@@ -8760,7 +8760,7 @@ function AppAuthProvider({ children }) {
|
|
|
8760
8760
|
expiresAt: expirationTime
|
|
8761
8761
|
});
|
|
8762
8762
|
}, []);
|
|
8763
|
-
const assumeOwnedGroup =
|
|
8763
|
+
const assumeOwnedGroup = React55.useCallback(async (group, signerKeyId, delegationScope = exports.DEFAULT_OWNED_GROUP_DELEGATION_SCOPE) => {
|
|
8764
8764
|
const parent = exports.tokenManager.getDelegationSessionMetadata();
|
|
8765
8765
|
const parentToken = exports.tokenManager.getDelegationToken();
|
|
8766
8766
|
if (parent?.kind !== "direct" || !parentToken) {
|
|
@@ -8811,11 +8811,11 @@ function AppAuthProvider({ children }) {
|
|
|
8811
8811
|
});
|
|
8812
8812
|
return response;
|
|
8813
8813
|
}, []);
|
|
8814
|
-
const returnToParent =
|
|
8815
|
-
const clearDelegationToken =
|
|
8814
|
+
const returnToParent = React55.useCallback(() => exports.tokenManager.restoreParentDelegationSession(), []);
|
|
8815
|
+
const clearDelegationToken = React55.useCallback(() => {
|
|
8816
8816
|
exports.tokenManager.clearDelegationToken();
|
|
8817
8817
|
}, []);
|
|
8818
|
-
const value =
|
|
8818
|
+
const value = React55.useMemo(
|
|
8819
8819
|
() => ({
|
|
8820
8820
|
...walletAuth,
|
|
8821
8821
|
groups,
|
|
@@ -8844,42 +8844,42 @@ function AppAuthProvider({ children }) {
|
|
|
8844
8844
|
return /* @__PURE__ */ jsxRuntime.jsx(AppAuthContext.Provider, { value, children });
|
|
8845
8845
|
}
|
|
8846
8846
|
function useAuthContext() {
|
|
8847
|
-
const ctx =
|
|
8847
|
+
const ctx = React55.useContext(AppAuthContext);
|
|
8848
8848
|
if (!ctx) {
|
|
8849
8849
|
throw new Error("useAuthContext must be used within an <AppAuthProvider>");
|
|
8850
8850
|
}
|
|
8851
8851
|
return ctx;
|
|
8852
8852
|
}
|
|
8853
|
-
var WalletCenterContext =
|
|
8853
|
+
var WalletCenterContext = React55.createContext(null);
|
|
8854
8854
|
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 =
|
|
8855
|
+
const [isOpen, setIsOpen] = React55.useState(false);
|
|
8856
|
+
const [requestedView, setRequestedView] = React55.useState("menu");
|
|
8857
|
+
const [host, setHostElement] = React55.useState(null);
|
|
8858
|
+
const [hostOptions, setHostOptions] = React55.useState({});
|
|
8859
|
+
const [hostTitle, setHostTitle] = React55.useState(null);
|
|
8860
|
+
const setHost = React55.useCallback((next) => {
|
|
8861
8861
|
setHostElement((current) => {
|
|
8862
8862
|
if (current === next) return current;
|
|
8863
8863
|
if (!next) setHostTitle(null);
|
|
8864
8864
|
return next;
|
|
8865
8865
|
});
|
|
8866
8866
|
}, []);
|
|
8867
|
-
const openWalletCenter =
|
|
8867
|
+
const openWalletCenter = React55.useCallback((view = "menu") => {
|
|
8868
8868
|
setRequestedView(view);
|
|
8869
8869
|
setIsOpen(true);
|
|
8870
8870
|
}, []);
|
|
8871
|
-
const closeWalletCenter =
|
|
8871
|
+
const closeWalletCenter = React55.useCallback(() => {
|
|
8872
8872
|
setIsOpen(false);
|
|
8873
8873
|
setRequestedView("menu");
|
|
8874
8874
|
}, []);
|
|
8875
|
-
const value =
|
|
8875
|
+
const value = React55.useMemo(
|
|
8876
8876
|
() => ({ isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, setHostOptions, hostTitle, setHostTitle }),
|
|
8877
8877
|
[isOpen, requestedView, openWalletCenter, closeWalletCenter, host, setHost, hostOptions, hostTitle]
|
|
8878
8878
|
);
|
|
8879
8879
|
return /* @__PURE__ */ jsxRuntime.jsx(WalletCenterContext.Provider, { value, children });
|
|
8880
8880
|
}
|
|
8881
8881
|
function useWalletCenter() {
|
|
8882
|
-
const value =
|
|
8882
|
+
const value = React55.useContext(WalletCenterContext);
|
|
8883
8883
|
if (!value) {
|
|
8884
8884
|
throw new Error("useWalletCenter must be used within <WalletProvider>.");
|
|
8885
8885
|
}
|
|
@@ -8896,7 +8896,7 @@ init_WalletConfigContext();
|
|
|
8896
8896
|
init_WalletConfigContext();
|
|
8897
8897
|
function RedirectTo({ href, replace = true }) {
|
|
8898
8898
|
const navigate = useWalletNavigate();
|
|
8899
|
-
|
|
8899
|
+
React55.useEffect(() => {
|
|
8900
8900
|
navigate(href, { replace });
|
|
8901
8901
|
}, []);
|
|
8902
8902
|
return null;
|
|
@@ -9172,14 +9172,14 @@ var _GlobalNotificationService = class _GlobalNotificationService {
|
|
|
9172
9172
|
_GlobalNotificationService.instance = null;
|
|
9173
9173
|
var GlobalNotificationService = _GlobalNotificationService;
|
|
9174
9174
|
var globalNotificationService_default = GlobalNotificationService;
|
|
9175
|
-
var EntitySSEContext =
|
|
9175
|
+
var EntitySSEContext = React55.createContext(void 0);
|
|
9176
9176
|
var EntitySSEProvider = ({ children }) => {
|
|
9177
9177
|
const { user } = useAuthContext();
|
|
9178
|
-
const [connected, setConnected] =
|
|
9179
|
-
const [currentEntityId, setCurrentEntityId] =
|
|
9180
|
-
const unsubRef =
|
|
9181
|
-
const handlersRef =
|
|
9182
|
-
const [activityLog, setActivityLog] =
|
|
9178
|
+
const [connected, setConnected] = React55.useState(false);
|
|
9179
|
+
const [currentEntityId, setCurrentEntityId] = React55.useState(user?.id || null);
|
|
9180
|
+
const unsubRef = React55.useRef(null);
|
|
9181
|
+
const handlersRef = React55.useRef(/* @__PURE__ */ new Map());
|
|
9182
|
+
const [activityLog, setActivityLog] = React55.useState(() => {
|
|
9183
9183
|
try {
|
|
9184
9184
|
const stored = localStorage.getItem("sse_activity_log");
|
|
9185
9185
|
return stored ? JSON.parse(stored) : [];
|
|
@@ -9187,7 +9187,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9187
9187
|
return [];
|
|
9188
9188
|
}
|
|
9189
9189
|
});
|
|
9190
|
-
|
|
9190
|
+
React55.useEffect(() => {
|
|
9191
9191
|
if (user?.id) {
|
|
9192
9192
|
if (!currentEntityId) {
|
|
9193
9193
|
setCurrentEntityId(user.id);
|
|
@@ -9196,7 +9196,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9196
9196
|
setCurrentEntityId(null);
|
|
9197
9197
|
}
|
|
9198
9198
|
}, [user?.id, currentEntityId]);
|
|
9199
|
-
|
|
9199
|
+
React55.useEffect(() => {
|
|
9200
9200
|
const handleEntitySwitch = (event) => {
|
|
9201
9201
|
const { actingAs } = event.detail;
|
|
9202
9202
|
if (!actingAs) return;
|
|
@@ -9221,7 +9221,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9221
9221
|
window.removeEventListener("entitySwitched", handleEntitySwitch);
|
|
9222
9222
|
};
|
|
9223
9223
|
}, [currentEntityId]);
|
|
9224
|
-
|
|
9224
|
+
React55.useEffect(() => {
|
|
9225
9225
|
if (!currentEntityId) return;
|
|
9226
9226
|
unsubRef.current?.();
|
|
9227
9227
|
const unsub = subscribeEntityEvents(
|
|
@@ -9321,7 +9321,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9321
9321
|
setConnected(false);
|
|
9322
9322
|
};
|
|
9323
9323
|
}, [currentEntityId]);
|
|
9324
|
-
const subscribeToEvent =
|
|
9324
|
+
const subscribeToEvent = React55.useCallback(
|
|
9325
9325
|
(eventType, handler) => {
|
|
9326
9326
|
if (!handlersRef.current.has(eventType)) {
|
|
9327
9327
|
handlersRef.current.set(eventType, /* @__PURE__ */ new Set());
|
|
@@ -9347,7 +9347,7 @@ var EntitySSEProvider = ({ children }) => {
|
|
|
9347
9347
|
return /* @__PURE__ */ jsxRuntime.jsx(EntitySSEContext.Provider, { value: contextValue, children });
|
|
9348
9348
|
};
|
|
9349
9349
|
var useEntitySSE = () => {
|
|
9350
|
-
const context =
|
|
9350
|
+
const context = React55.useContext(EntitySSEContext);
|
|
9351
9351
|
if (context === void 0) {
|
|
9352
9352
|
throw new Error("useEntitySSE must be used within an EntitySSEProvider");
|
|
9353
9353
|
}
|
|
@@ -9576,19 +9576,19 @@ var GroupOwnershipPanel = ({
|
|
|
9576
9576
|
onChanged,
|
|
9577
9577
|
className = ""
|
|
9578
9578
|
}) => {
|
|
9579
|
-
const [relationships, setRelationships] =
|
|
9580
|
-
const [parentGroupId, setParentGroupId] =
|
|
9581
|
-
const [loading, setLoading] =
|
|
9582
|
-
const [submittingId, setSubmittingId] =
|
|
9583
|
-
const [error, setError] =
|
|
9579
|
+
const [relationships, setRelationships] = React55.useState([]);
|
|
9580
|
+
const [parentGroupId, setParentGroupId] = React55.useState("");
|
|
9581
|
+
const [loading, setLoading] = React55.useState(false);
|
|
9582
|
+
const [submittingId, setSubmittingId] = React55.useState(null);
|
|
9583
|
+
const [error, setError] = React55.useState(null);
|
|
9584
9584
|
const isOwner = currentRole === "owner";
|
|
9585
9585
|
const isDirectChildContext = activeDirectGroupId === childGroup.id;
|
|
9586
9586
|
const canMutate = isOwner && isDirectChildContext && accountReady && Boolean(chainId);
|
|
9587
|
-
const labelById =
|
|
9587
|
+
const labelById = React55.useMemo(
|
|
9588
9588
|
() => new Map(availableParentGroups.map((group) => [group.id, group.name])),
|
|
9589
9589
|
[availableParentGroups]
|
|
9590
9590
|
);
|
|
9591
|
-
const loadRelationships =
|
|
9591
|
+
const loadRelationships = React55.useCallback(async () => {
|
|
9592
9592
|
if (!chainId) {
|
|
9593
9593
|
setRelationships([]);
|
|
9594
9594
|
return;
|
|
@@ -9608,7 +9608,7 @@ var GroupOwnershipPanel = ({
|
|
|
9608
9608
|
setLoading(false);
|
|
9609
9609
|
}
|
|
9610
9610
|
}, [chainId, childGroup.id]);
|
|
9611
|
-
|
|
9611
|
+
React55.useEffect(() => {
|
|
9612
9612
|
void loadRelationships();
|
|
9613
9613
|
}, [loadRelationships]);
|
|
9614
9614
|
const commit = async (relationship) => {
|
|
@@ -9975,7 +9975,7 @@ function writeStoredPendingSponsorship(pending) {
|
|
|
9975
9975
|
} catch {
|
|
9976
9976
|
}
|
|
9977
9977
|
}
|
|
9978
|
-
var WizardContext =
|
|
9978
|
+
var WizardContext = React55.createContext(null);
|
|
9979
9979
|
function WizardProvider({
|
|
9980
9980
|
initialPathname = "/onboarding",
|
|
9981
9981
|
onComplete,
|
|
@@ -9985,18 +9985,18 @@ function WizardProvider({
|
|
|
9985
9985
|
}) {
|
|
9986
9986
|
const { onNavigate: hostNavigate, ...restConfig } = useWalletConfig();
|
|
9987
9987
|
const { bootstrapSession } = useAuth();
|
|
9988
|
-
const [pendingSponsorship, setPendingSponsorship] =
|
|
9989
|
-
const [pathname, setPathname] =
|
|
9988
|
+
const [pendingSponsorship, setPendingSponsorship] = React55.useState(readStoredPendingSponsorship);
|
|
9989
|
+
const [pathname, setPathname] = React55.useState(
|
|
9990
9990
|
() => pendingSponsorship ? "/onboarding/sponsorship" : initialPathname
|
|
9991
9991
|
);
|
|
9992
|
-
const [state, setStateValue] =
|
|
9993
|
-
const [planSelection, setPlanSelection] =
|
|
9992
|
+
const [state, setStateValue] = React55.useState(void 0);
|
|
9993
|
+
const [planSelection, setPlanSelection] = React55.useState(
|
|
9994
9994
|
readOnboardingPlanSelectionHint
|
|
9995
9995
|
);
|
|
9996
|
-
const pendingSponsorshipRef =
|
|
9996
|
+
const pendingSponsorshipRef = React55__default.default.useRef(
|
|
9997
9997
|
pendingSponsorship
|
|
9998
9998
|
);
|
|
9999
|
-
const stageSponsorship =
|
|
9999
|
+
const stageSponsorship = React55.useCallback((groupId, destination) => {
|
|
10000
10000
|
const normalizedGroupId = canonicalSponsorGroupId(groupId);
|
|
10001
10001
|
const userId = currentRegularUserId();
|
|
10002
10002
|
if (!userId) {
|
|
@@ -10014,7 +10014,7 @@ function WizardProvider({
|
|
|
10014
10014
|
writeStoredPendingSponsorship(next);
|
|
10015
10015
|
return next;
|
|
10016
10016
|
}, []);
|
|
10017
|
-
const selectPlan =
|
|
10017
|
+
const selectPlan = React55.useCallback((plan, catalogVersion) => {
|
|
10018
10018
|
const next = {
|
|
10019
10019
|
planId: plan.id,
|
|
10020
10020
|
ownerType: plan.owner_type,
|
|
@@ -10024,7 +10024,7 @@ function WizardProvider({
|
|
|
10024
10024
|
setPlanSelection(next);
|
|
10025
10025
|
writeOnboardingPlanSelectionHint(next);
|
|
10026
10026
|
}, []);
|
|
10027
|
-
const hydratePlanSelection =
|
|
10027
|
+
const hydratePlanSelection = React55.useCallback(
|
|
10028
10028
|
(plan, catalogVersion, selectedAt = Date.now()) => {
|
|
10029
10029
|
setPlanSelection({
|
|
10030
10030
|
planId: plan.id,
|
|
@@ -10036,11 +10036,11 @@ function WizardProvider({
|
|
|
10036
10036
|
},
|
|
10037
10037
|
[]
|
|
10038
10038
|
);
|
|
10039
|
-
const clearPlanSelection =
|
|
10039
|
+
const clearPlanSelection = React55.useCallback(() => {
|
|
10040
10040
|
setPlanSelection(null);
|
|
10041
10041
|
clearOnboardingPlanSelectionHint();
|
|
10042
10042
|
}, []);
|
|
10043
|
-
const syncPlanIntent =
|
|
10043
|
+
const syncPlanIntent = React55.useCallback(async () => {
|
|
10044
10044
|
if (!planSelection || !exports.authService.isAuthenticated()) return null;
|
|
10045
10045
|
const response = await onboardingPlanService.selectIntent(planSelection.planId);
|
|
10046
10046
|
const current = response.intent?.current_plan;
|
|
@@ -10056,7 +10056,7 @@ function WizardProvider({
|
|
|
10056
10056
|
}
|
|
10057
10057
|
return response;
|
|
10058
10058
|
}, [planSelection]);
|
|
10059
|
-
const navigate =
|
|
10059
|
+
const navigate = React55.useCallback(
|
|
10060
10060
|
(to, opts) => {
|
|
10061
10061
|
if (to.startsWith("/onboarding")) {
|
|
10062
10062
|
setPathname(to);
|
|
@@ -10086,7 +10086,7 @@ function WizardProvider({
|
|
|
10086
10086
|
},
|
|
10087
10087
|
[clearPlanSelection, hostNavigate, onComplete]
|
|
10088
10088
|
);
|
|
10089
|
-
const continueAuthenticated =
|
|
10089
|
+
const continueAuthenticated = React55.useCallback(async (destination, expectedSponsor) => {
|
|
10090
10090
|
await bootstrapSession();
|
|
10091
10091
|
if (expectedSponsor && !exports.authService.hasExactSponsoredSession(expectedSponsor)) {
|
|
10092
10092
|
throw new Error(
|
|
@@ -10101,12 +10101,12 @@ function WizardProvider({
|
|
|
10101
10101
|
}
|
|
10102
10102
|
navigate(destination);
|
|
10103
10103
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10104
|
-
const discardSponsorship =
|
|
10104
|
+
const discardSponsorship = React55.useCallback(() => {
|
|
10105
10105
|
pendingSponsorshipRef.current = null;
|
|
10106
10106
|
setPendingSponsorship(null);
|
|
10107
10107
|
clearStoredPendingSponsorship();
|
|
10108
10108
|
}, []);
|
|
10109
|
-
const finishSponsorship =
|
|
10109
|
+
const finishSponsorship = React55.useCallback(async () => {
|
|
10110
10110
|
const pending = pendingSponsorshipRef.current;
|
|
10111
10111
|
if (!pending) {
|
|
10112
10112
|
throw new Error("No platform sponsorship continuation is awaiting completion.");
|
|
@@ -10132,7 +10132,7 @@ function WizardProvider({
|
|
|
10132
10132
|
clearStoredPendingSponsorship();
|
|
10133
10133
|
navigate(pending.destination);
|
|
10134
10134
|
}, [bootstrapSession, navigate, syncPlanIntent]);
|
|
10135
|
-
const completeAuthentication =
|
|
10135
|
+
const completeAuthentication = React55.useCallback(async (result, destination, effectivePlatform) => {
|
|
10136
10136
|
const currentUserId = currentRegularUserId();
|
|
10137
10137
|
if (!currentUserId || currentUserId !== result.user_id) {
|
|
10138
10138
|
throw new Error("The returned authentication session did not match the signed-in user.");
|
|
@@ -10170,11 +10170,11 @@ function WizardProvider({
|
|
|
10170
10170
|
}
|
|
10171
10171
|
await continueAuthenticated(destination);
|
|
10172
10172
|
}, [bootstrapSession, continueAuthenticated, finishSponsorship, stageSponsorship]);
|
|
10173
|
-
const params =
|
|
10173
|
+
const params = React55.useMemo(() => {
|
|
10174
10174
|
const provider = matchProviderParam(pathname);
|
|
10175
10175
|
return provider ? { provider } : {};
|
|
10176
10176
|
}, [pathname]);
|
|
10177
|
-
const wizardValue =
|
|
10177
|
+
const wizardValue = React55.useMemo(
|
|
10178
10178
|
() => ({
|
|
10179
10179
|
pathname,
|
|
10180
10180
|
state,
|
|
@@ -10212,7 +10212,7 @@ function WizardProvider({
|
|
|
10212
10212
|
discardSponsorship
|
|
10213
10213
|
]
|
|
10214
10214
|
);
|
|
10215
|
-
const overriddenConfig =
|
|
10215
|
+
const overriddenConfig = React55.useMemo(
|
|
10216
10216
|
() => ({
|
|
10217
10217
|
...restConfig,
|
|
10218
10218
|
onNavigate: (href, opts) => navigate(href, { replace: opts?.replace })
|
|
@@ -10240,7 +10240,7 @@ function matchProviderParam(pathname) {
|
|
|
10240
10240
|
return match ? match[1] : void 0;
|
|
10241
10241
|
}
|
|
10242
10242
|
function useWizard() {
|
|
10243
|
-
const ctx =
|
|
10243
|
+
const ctx = React55.useContext(WizardContext);
|
|
10244
10244
|
if (!ctx) {
|
|
10245
10245
|
throw new Error(
|
|
10246
10246
|
"Wizard hooks must be used inside <WizardProvider> (mounted by <OnboardingWizard>)."
|
|
@@ -10258,7 +10258,7 @@ function useWizardParams() {
|
|
|
10258
10258
|
}
|
|
10259
10259
|
function WizardRedirect({ to, replace }) {
|
|
10260
10260
|
const navigate = useWizardNavigate();
|
|
10261
|
-
|
|
10261
|
+
React55.useEffect(() => {
|
|
10262
10262
|
navigate(to, { replace });
|
|
10263
10263
|
}, []);
|
|
10264
10264
|
return null;
|
|
@@ -10375,20 +10375,20 @@ var DEFAULT_MESSAGES = {
|
|
|
10375
10375
|
retryButtonText: "Try again"
|
|
10376
10376
|
}
|
|
10377
10377
|
};
|
|
10378
|
-
var BrandingContext =
|
|
10378
|
+
var BrandingContext = React55.createContext(null);
|
|
10379
10379
|
var ROOT_BRANDING = {
|
|
10380
10380
|
logo: DEFAULT_LOGO(),
|
|
10381
10381
|
messages: DEFAULT_MESSAGES
|
|
10382
10382
|
};
|
|
10383
10383
|
function useBranding() {
|
|
10384
|
-
return
|
|
10384
|
+
return React55.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10385
10385
|
}
|
|
10386
10386
|
function BrandingProvider({
|
|
10387
10387
|
branding,
|
|
10388
10388
|
children
|
|
10389
10389
|
}) {
|
|
10390
|
-
const parent =
|
|
10391
|
-
const value =
|
|
10390
|
+
const parent = React55.useContext(BrandingContext) ?? ROOT_BRANDING;
|
|
10391
|
+
const value = React55.useMemo(() => {
|
|
10392
10392
|
if (!branding) return parent;
|
|
10393
10393
|
const { logo, logoSize, messages } = branding;
|
|
10394
10394
|
return {
|
|
@@ -10536,11 +10536,11 @@ init_ProviderConfigContext();
|
|
|
10536
10536
|
// src/react/useOnboardingRouting.ts
|
|
10537
10537
|
init_authService();
|
|
10538
10538
|
function useOnboardingState2() {
|
|
10539
|
-
const [state, setState] =
|
|
10539
|
+
const [state, setState] = React55.useState({
|
|
10540
10540
|
step: "unknown",
|
|
10541
10541
|
isLoading: true
|
|
10542
10542
|
});
|
|
10543
|
-
|
|
10543
|
+
React55.useEffect(() => {
|
|
10544
10544
|
let cancelled = false;
|
|
10545
10545
|
(async () => {
|
|
10546
10546
|
if (!exports.authService.isAuthenticated()) {
|
|
@@ -10716,11 +10716,11 @@ function SelectPlan({
|
|
|
10716
10716
|
const wizardPlatform = useWizardPlatform();
|
|
10717
10717
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
10718
10718
|
const { isAuthenticated, isLoading: authLoading } = useAuth();
|
|
10719
|
-
const [catalog, setCatalog] =
|
|
10720
|
-
const [error, setError] =
|
|
10721
|
-
const [attempt, setAttempt] =
|
|
10719
|
+
const [catalog, setCatalog] = React55.useState(null);
|
|
10720
|
+
const [error, setError] = React55.useState(null);
|
|
10721
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
10722
10722
|
const platformTagged = !!(wizardPlatform ?? config?.platform?.group_id);
|
|
10723
|
-
|
|
10723
|
+
React55.useEffect(() => {
|
|
10724
10724
|
if (configLoading || authLoading || platformTagged || isAuthenticated) return;
|
|
10725
10725
|
let disposed = false;
|
|
10726
10726
|
setCatalog(null);
|
|
@@ -10736,7 +10736,7 @@ function SelectPlan({
|
|
|
10736
10736
|
disposed = true;
|
|
10737
10737
|
};
|
|
10738
10738
|
}, [attempt, authLoading, configLoading, isAuthenticated, platformTagged]);
|
|
10739
|
-
|
|
10739
|
+
React55.useEffect(() => {
|
|
10740
10740
|
if (platformTagged || catalog && !catalog.prepaid_credits_enabled) {
|
|
10741
10741
|
clearPlanSelection();
|
|
10742
10742
|
}
|
|
@@ -10933,9 +10933,9 @@ async function signInWithPasskey(opts = {}) {
|
|
|
10933
10933
|
return await res.json();
|
|
10934
10934
|
}
|
|
10935
10935
|
function PasskeyMethodButton({ mode, chainId, onSuccess, onError, platform }) {
|
|
10936
|
-
const [supported, setSupported] =
|
|
10937
|
-
const [busy, setBusy] =
|
|
10938
|
-
|
|
10936
|
+
const [supported, setSupported] = React55.useState(true);
|
|
10937
|
+
const [busy, setBusy] = React55.useState(false);
|
|
10938
|
+
React55.useEffect(() => {
|
|
10939
10939
|
const ok = typeof window !== "undefined" && !!window.PublicKeyCredential;
|
|
10940
10940
|
setSupported(ok);
|
|
10941
10941
|
}, []);
|
|
@@ -11026,9 +11026,9 @@ var ChooserCard = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11026
11026
|
onSelect
|
|
11027
11027
|
}
|
|
11028
11028
|
);
|
|
11029
|
-
var LazyAvererSignupFlow =
|
|
11029
|
+
var LazyAvererSignupFlow = React55.lazy(() => Promise.resolve().then(() => (init_SignupFlow(), SignupFlow_exports)));
|
|
11030
11030
|
var SignupFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11031
|
-
|
|
11031
|
+
React55.Suspense,
|
|
11032
11032
|
{
|
|
11033
11033
|
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-screen flex items-center justify-center bg-background text-text-secondary text-[13px]", children: "Loading Averer\u2026" }),
|
|
11034
11034
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSignupFlow, { ...props })
|
|
@@ -11045,9 +11045,9 @@ var AvererAuth = {
|
|
|
11045
11045
|
// squeezed into LoginLayout's narrow column.
|
|
11046
11046
|
customLayout: true
|
|
11047
11047
|
};
|
|
11048
|
-
var LazyAvererKycFlow =
|
|
11048
|
+
var LazyAvererKycFlow = React55.lazy(() => Promise.resolve().then(() => (init_KycFlow(), KycFlow_exports)));
|
|
11049
11049
|
var KycFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11050
|
-
|
|
11050
|
+
React55.Suspense,
|
|
11051
11051
|
{
|
|
11052
11052
|
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading Averer\u2026" }),
|
|
11053
11053
|
children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererKycFlow, { ...props })
|
|
@@ -11066,8 +11066,8 @@ function SdkGate({
|
|
|
11066
11066
|
hasConfig = true,
|
|
11067
11067
|
configHint
|
|
11068
11068
|
}) {
|
|
11069
|
-
const [state, setState] =
|
|
11070
|
-
|
|
11069
|
+
const [state, setState] = React55.useState({ status: "loading" });
|
|
11070
|
+
React55.useEffect(() => {
|
|
11071
11071
|
let cancelled = false;
|
|
11072
11072
|
(async () => {
|
|
11073
11073
|
try {
|
|
@@ -11207,8 +11207,8 @@ var DynamicCompleter = ({ sdk, action, onError }) => {
|
|
|
11207
11207
|
const ctx = sdk.useDynamicContext();
|
|
11208
11208
|
const wallet = ctx.primaryWallet;
|
|
11209
11209
|
const dynamicUser = ctx.user;
|
|
11210
|
-
const [done, setDone] =
|
|
11211
|
-
|
|
11210
|
+
const [done, setDone] = React55__default.default.useState(false);
|
|
11211
|
+
React55__default.default.useEffect(() => {
|
|
11212
11212
|
if (done || !wallet?.address) return;
|
|
11213
11213
|
setDone(true);
|
|
11214
11214
|
(async () => {
|
|
@@ -11303,9 +11303,9 @@ var ChooserCard3 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11303
11303
|
}
|
|
11304
11304
|
);
|
|
11305
11305
|
var SignupFlow4 = ({ onComplete, onError, platform }) => {
|
|
11306
|
-
const [email, setEmail] =
|
|
11307
|
-
const [password, setPassword] =
|
|
11308
|
-
const [submitting, setSubmitting] =
|
|
11306
|
+
const [email, setEmail] = React55.useState("");
|
|
11307
|
+
const [password, setPassword] = React55.useState("");
|
|
11308
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
11309
11309
|
async function submit(e) {
|
|
11310
11310
|
e.preventDefault();
|
|
11311
11311
|
setSubmitting(true);
|
|
@@ -11461,7 +11461,7 @@ var ChooserCard4 = ({ onSelect, isPrimary }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
11461
11461
|
}
|
|
11462
11462
|
);
|
|
11463
11463
|
var SignupFlow5 = ({ onComplete, onError, platform }) => {
|
|
11464
|
-
const [busy, setBusy] =
|
|
11464
|
+
const [busy, setBusy] = React55.useState(false);
|
|
11465
11465
|
async function trigger() {
|
|
11466
11466
|
setBusy(true);
|
|
11467
11467
|
try {
|
|
@@ -11633,8 +11633,8 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11633
11633
|
const settings = config?.kyc.settings[providerId];
|
|
11634
11634
|
const publishableKey = settings?.publishable_key;
|
|
11635
11635
|
const requiredForCompletion = settings?.required_for_completion ?? false;
|
|
11636
|
-
const [stage, setStage] =
|
|
11637
|
-
|
|
11636
|
+
const [stage, setStage] = React55__default.default.useState({ kind: "idle" });
|
|
11637
|
+
React55__default.default.useEffect(() => {
|
|
11638
11638
|
let cancelled = false;
|
|
11639
11639
|
(async () => {
|
|
11640
11640
|
try {
|
|
@@ -11658,7 +11658,7 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
|
|
|
11658
11658
|
cancelled = true;
|
|
11659
11659
|
};
|
|
11660
11660
|
}, []);
|
|
11661
|
-
|
|
11661
|
+
React55__default.default.useEffect(() => {
|
|
11662
11662
|
if (stage.kind !== "pending-poll") return;
|
|
11663
11663
|
let cancelled = false;
|
|
11664
11664
|
const pollOnce = async () => {
|
|
@@ -11910,14 +11910,14 @@ function useIdentityStatusPoll(opts) {
|
|
|
11910
11910
|
provider,
|
|
11911
11911
|
credentialType
|
|
11912
11912
|
} = opts;
|
|
11913
|
-
const [stuckHint, setStuckHint] =
|
|
11914
|
-
const onVerifiedRef =
|
|
11915
|
-
const onRejectedRef =
|
|
11916
|
-
|
|
11913
|
+
const [stuckHint, setStuckHint] = React55__default.default.useState(false);
|
|
11914
|
+
const onVerifiedRef = React55__default.default.useRef(onVerified);
|
|
11915
|
+
const onRejectedRef = React55__default.default.useRef(onRejected);
|
|
11916
|
+
React55__default.default.useEffect(() => {
|
|
11917
11917
|
onVerifiedRef.current = onVerified;
|
|
11918
11918
|
onRejectedRef.current = onRejected;
|
|
11919
11919
|
}, [onVerified, onRejected]);
|
|
11920
|
-
|
|
11920
|
+
React55__default.default.useEffect(() => {
|
|
11921
11921
|
if (!active) {
|
|
11922
11922
|
setStuckHint(false);
|
|
11923
11923
|
return;
|
|
@@ -12055,12 +12055,12 @@ var KycFlow4 = ({ onComplete, onError, instanceId, subject }) => {
|
|
|
12055
12055
|
const groupId = subject?.kind === "group" ? subject.id : void 0;
|
|
12056
12056
|
const configuredLevel = config?.kyc.settings[providerId]?.level_name?.trim();
|
|
12057
12057
|
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
|
-
|
|
12058
|
+
const [token, setToken] = React55__default.default.useState(null);
|
|
12059
|
+
const [stage, setStage] = React55__default.default.useState({ kind: "init" });
|
|
12060
|
+
const [attempt, setAttempt] = React55__default.default.useState(0);
|
|
12061
|
+
const submittedRef = React55__default.default.useRef(false);
|
|
12062
|
+
const applicantIdRef = React55__default.default.useRef(void 0);
|
|
12063
|
+
React55__default.default.useEffect(() => {
|
|
12064
12064
|
let cancelled = false;
|
|
12065
12065
|
submittedRef.current = false;
|
|
12066
12066
|
(async () => {
|
|
@@ -12290,8 +12290,8 @@ function OnboardingChooseMethod({ chrome } = {}) {
|
|
|
12290
12290
|
const { config, isLoading, error: configError } = useProviderConfig();
|
|
12291
12291
|
const wizardPlatform = useWizardPlatform();
|
|
12292
12292
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12293
|
-
const [busyId, setBusyId] =
|
|
12294
|
-
const [error, setError] =
|
|
12293
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
12294
|
+
const [error, setError] = React55.useState(null);
|
|
12295
12295
|
if (isLoading) {
|
|
12296
12296
|
return /* @__PURE__ */ jsxRuntime.jsx(StepShell, { chrome, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading sign-up options\u2026" }) });
|
|
12297
12297
|
}
|
|
@@ -12375,6 +12375,47 @@ function OnboardingChooseMethod({ chrome } = {}) {
|
|
|
12375
12375
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] text-text-secondary text-center pt-2", children: messages.legal.agreementText })
|
|
12376
12376
|
] }) });
|
|
12377
12377
|
}
|
|
12378
|
+
function FloatField({
|
|
12379
|
+
label,
|
|
12380
|
+
type,
|
|
12381
|
+
value,
|
|
12382
|
+
onChange,
|
|
12383
|
+
autoComplete,
|
|
12384
|
+
required,
|
|
12385
|
+
minLength,
|
|
12386
|
+
maxLength,
|
|
12387
|
+
adornment,
|
|
12388
|
+
disabled
|
|
12389
|
+
}) {
|
|
12390
|
+
const id = React55.useId();
|
|
12391
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12392
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12393
|
+
"input",
|
|
12394
|
+
{
|
|
12395
|
+
id,
|
|
12396
|
+
type,
|
|
12397
|
+
required,
|
|
12398
|
+
minLength,
|
|
12399
|
+
maxLength,
|
|
12400
|
+
autoComplete,
|
|
12401
|
+
placeholder: " ",
|
|
12402
|
+
value,
|
|
12403
|
+
disabled,
|
|
12404
|
+
onChange: (e) => onChange(e.target.value),
|
|
12405
|
+
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60 disabled:cursor-not-allowed\n "
|
|
12406
|
+
}
|
|
12407
|
+
),
|
|
12408
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12409
|
+
"label",
|
|
12410
|
+
{
|
|
12411
|
+
htmlFor: id,
|
|
12412
|
+
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12413
|
+
children: label
|
|
12414
|
+
}
|
|
12415
|
+
),
|
|
12416
|
+
adornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-0 top-4 pointer-events-none", children: adornment })
|
|
12417
|
+
] });
|
|
12418
|
+
}
|
|
12378
12419
|
init_authService();
|
|
12379
12420
|
init_tokenManager();
|
|
12380
12421
|
init_ProviderConfigContext();
|
|
@@ -12399,16 +12440,16 @@ function OnboardingEmailSignup({ chrome } = {}) {
|
|
|
12399
12440
|
const { config } = useProviderConfig();
|
|
12400
12441
|
const { completeAuthentication } = useWizardAuthentication();
|
|
12401
12442
|
const platform = wizardPlatform ?? config?.platform?.group_id;
|
|
12402
|
-
const [email, setEmail] =
|
|
12403
|
-
const [password, setPassword] =
|
|
12404
|
-
const [confirmPassword, setConfirmPassword] =
|
|
12405
|
-
const [phase, setPhase] =
|
|
12443
|
+
const [email, setEmail] = React55.useState("");
|
|
12444
|
+
const [password, setPassword] = React55.useState("");
|
|
12445
|
+
const [confirmPassword, setConfirmPassword] = React55.useState("");
|
|
12446
|
+
const [phase, setPhase] = React55.useState(null);
|
|
12406
12447
|
const submitting = phase !== null;
|
|
12407
|
-
const [error, setError] =
|
|
12408
|
-
const [emailExists, setEmailExists] =
|
|
12448
|
+
const [error, setError] = React55.useState(null);
|
|
12449
|
+
const [emailExists, setEmailExists] = React55.useState(false);
|
|
12409
12450
|
const invite = useWizardInvite();
|
|
12410
12451
|
const emailLocked = !!invite?.email;
|
|
12411
|
-
|
|
12452
|
+
React55.useEffect(() => {
|
|
12412
12453
|
if (invite?.email) setEmail(invite.email);
|
|
12413
12454
|
}, [invite?.email]);
|
|
12414
12455
|
function validate() {
|
|
@@ -12612,61 +12653,23 @@ function OnboardingEmailSignup({ chrome } = {}) {
|
|
|
12612
12653
|
] })
|
|
12613
12654
|
] }) });
|
|
12614
12655
|
}
|
|
12615
|
-
function FloatField({
|
|
12616
|
-
label,
|
|
12617
|
-
type,
|
|
12618
|
-
value,
|
|
12619
|
-
onChange,
|
|
12620
|
-
autoComplete,
|
|
12621
|
-
required,
|
|
12622
|
-
minLength,
|
|
12623
|
-
maxLength,
|
|
12624
|
-
adornment,
|
|
12625
|
-
disabled
|
|
12626
|
-
}) {
|
|
12627
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12628
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12629
|
-
"input",
|
|
12630
|
-
{
|
|
12631
|
-
type,
|
|
12632
|
-
required,
|
|
12633
|
-
minLength,
|
|
12634
|
-
maxLength,
|
|
12635
|
-
autoComplete,
|
|
12636
|
-
placeholder: " ",
|
|
12637
|
-
value,
|
|
12638
|
-
disabled,
|
|
12639
|
-
onChange: (e) => onChange(e.target.value),
|
|
12640
|
-
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60 disabled:cursor-not-allowed\n "
|
|
12641
|
-
}
|
|
12642
|
-
),
|
|
12643
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12644
|
-
"span",
|
|
12645
|
-
{
|
|
12646
|
-
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12647
|
-
children: label
|
|
12648
|
-
}
|
|
12649
|
-
),
|
|
12650
|
-
adornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-0 top-4 pointer-events-none", children: adornment })
|
|
12651
|
-
] });
|
|
12652
|
-
}
|
|
12653
12656
|
init_authService();
|
|
12654
12657
|
init_onboardingClient();
|
|
12655
12658
|
function EmailVerify({ chrome } = {}) {
|
|
12656
12659
|
const navigate = useWizardNavigate();
|
|
12657
12660
|
const { refreshUser, logout } = useAuth();
|
|
12658
|
-
const [status, setStatus] =
|
|
12659
|
-
const [phase, setPhase] =
|
|
12660
|
-
const [code, setCode] =
|
|
12661
|
-
const [newEmail, setNewEmail] =
|
|
12662
|
-
const [notice, setNotice] =
|
|
12663
|
-
const [error, setError] =
|
|
12664
|
-
const autoStartRef =
|
|
12665
|
-
const completionTimerRef =
|
|
12661
|
+
const [status, setStatus] = React55.useState(null);
|
|
12662
|
+
const [phase, setPhase] = React55.useState("loading");
|
|
12663
|
+
const [code, setCode] = React55.useState("");
|
|
12664
|
+
const [newEmail, setNewEmail] = React55.useState("");
|
|
12665
|
+
const [notice, setNotice] = React55.useState(null);
|
|
12666
|
+
const [error, setError] = React55.useState(null);
|
|
12667
|
+
const autoStartRef = React55.useRef(false);
|
|
12668
|
+
const completionTimerRef = React55.useRef(null);
|
|
12666
12669
|
const email = status?.email ?? "";
|
|
12667
|
-
const maskedEmail =
|
|
12670
|
+
const maskedEmail = React55.useMemo(() => maskEmail(email), [email]);
|
|
12668
12671
|
const busy = phase === "sending" || phase === "checking" || phase === "updating-email";
|
|
12669
|
-
const completeSoon =
|
|
12672
|
+
const completeSoon = React55.useCallback((message) => {
|
|
12670
12673
|
setNotice(message ?? "Email confirmed. Taking you to the next setup step.");
|
|
12671
12674
|
setError(null);
|
|
12672
12675
|
setPhase("success");
|
|
@@ -12676,7 +12679,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12676
12679
|
navigate("/onboarding/wallets");
|
|
12677
12680
|
}, 850);
|
|
12678
12681
|
}, [navigate]);
|
|
12679
|
-
const loadStatus =
|
|
12682
|
+
const loadStatus = React55.useCallback(async () => {
|
|
12680
12683
|
const next = await getMyEmailVerificationStatus();
|
|
12681
12684
|
setStatus(next);
|
|
12682
12685
|
if (next.verified) {
|
|
@@ -12686,7 +12689,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12686
12689
|
setPhase("ready");
|
|
12687
12690
|
return next;
|
|
12688
12691
|
}, [completeSoon]);
|
|
12689
|
-
const sendCode =
|
|
12692
|
+
const sendCode = React55.useCallback(async () => {
|
|
12690
12693
|
setPhase("sending");
|
|
12691
12694
|
setError(null);
|
|
12692
12695
|
try {
|
|
@@ -12712,7 +12715,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12712
12715
|
setPhase("ready");
|
|
12713
12716
|
}
|
|
12714
12717
|
}, []);
|
|
12715
|
-
|
|
12718
|
+
React55.useEffect(() => {
|
|
12716
12719
|
let cancelled = false;
|
|
12717
12720
|
(async () => {
|
|
12718
12721
|
setPhase("loading");
|
|
@@ -12737,7 +12740,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12737
12740
|
if (completionTimerRef.current) window.clearTimeout(completionTimerRef.current);
|
|
12738
12741
|
};
|
|
12739
12742
|
}, [completeSoon]);
|
|
12740
|
-
|
|
12743
|
+
React55.useEffect(() => {
|
|
12741
12744
|
if (!status || status.verified || status.is_synthetic || status.pending || autoStartRef.current) return;
|
|
12742
12745
|
autoStartRef.current = true;
|
|
12743
12746
|
void sendCode();
|
|
@@ -12810,7 +12813,7 @@ function EmailVerify({ chrome } = {}) {
|
|
|
12810
12813
|
/* @__PURE__ */ jsxRuntime.jsx(ProgressRail, { phase, verified: !!status?.verified || phase === "success" }),
|
|
12811
12814
|
phase === "loading" && !status ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-border-default bg-surface-alt/70 p-4 text-center text-[12px] text-text-secondary", children: "Checking email status..." }) : phase === "success" ? /* @__PURE__ */ jsxRuntime.jsx(SuccessPanel, { notice }) : status?.is_synthetic ? /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submitRealEmail, className: "space-y-4", children: [
|
|
12812
12815
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12813
|
-
|
|
12816
|
+
FloatField,
|
|
12814
12817
|
{
|
|
12815
12818
|
label: "Email",
|
|
12816
12819
|
type: "email",
|
|
@@ -12933,38 +12936,6 @@ function CodeField({
|
|
|
12933
12936
|
}
|
|
12934
12937
|
);
|
|
12935
12938
|
}
|
|
12936
|
-
function FloatField2({
|
|
12937
|
-
label,
|
|
12938
|
-
type,
|
|
12939
|
-
value,
|
|
12940
|
-
onChange,
|
|
12941
|
-
autoComplete,
|
|
12942
|
-
disabled,
|
|
12943
|
-
required
|
|
12944
|
-
}) {
|
|
12945
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12946
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12947
|
-
"input",
|
|
12948
|
-
{
|
|
12949
|
-
type,
|
|
12950
|
-
required,
|
|
12951
|
-
autoComplete,
|
|
12952
|
-
placeholder: " ",
|
|
12953
|
-
value,
|
|
12954
|
-
disabled,
|
|
12955
|
-
onChange: (e) => onChange(e.target.value),
|
|
12956
|
-
className: "\n peer w-full bg-transparent border-0 border-b border-border-default\n rounded-none px-0 pt-4 pb-1.5 text-[14px] text-text-primary\n focus:outline-none focus:border-border-strong transition-colors\n disabled:opacity-60\n "
|
|
12957
|
-
}
|
|
12958
|
-
),
|
|
12959
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12960
|
-
"span",
|
|
12961
|
-
{
|
|
12962
|
-
className: "\n absolute left-0 pointer-events-none transition-all duration-200\n text-[10px] text-text-secondary top-0\n peer-placeholder-shown:text-[13px] peer-placeholder-shown:top-4\n peer-focus:text-[10px] peer-focus:top-0 peer-focus:text-text-secondary\n ",
|
|
12963
|
-
children: label
|
|
12964
|
-
}
|
|
12965
|
-
)
|
|
12966
|
-
] });
|
|
12967
|
-
}
|
|
12968
12939
|
function friendlyEmailError(err, action) {
|
|
12969
12940
|
const message = err instanceof Error ? err.message : String(err);
|
|
12970
12941
|
if (message.includes("email delivery unavailable") || message.includes("503")) {
|
|
@@ -13014,7 +12985,7 @@ function ProviderSignup({ chrome } = {}) {
|
|
|
13014
12985
|
const { config, isLoading } = useProviderConfig();
|
|
13015
12986
|
const wizardPlatform = useWizardPlatform();
|
|
13016
12987
|
const { completeAuthentication } = useWizardAuthentication();
|
|
13017
|
-
const [error, setError] =
|
|
12988
|
+
const [error, setError] = React55.useState(null);
|
|
13018
12989
|
if (isLoading) {
|
|
13019
12990
|
return /* @__PURE__ */ jsxRuntime.jsx(StepShell, { chrome, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[12px] text-text-secondary", children: "Loading\u2026" }) });
|
|
13020
12991
|
}
|
|
@@ -13209,8 +13180,8 @@ function AvatarImageUpload({
|
|
|
13209
13180
|
hintClassName = "text-[10px] text-text-secondary",
|
|
13210
13181
|
errorClassName = "text-[11px] text-status-error-text"
|
|
13211
13182
|
}) {
|
|
13212
|
-
const inputRef =
|
|
13213
|
-
const [error, setError] =
|
|
13183
|
+
const inputRef = React55.useRef(null);
|
|
13184
|
+
const [error, setError] = React55.useState(null);
|
|
13214
13185
|
const hasPhoto = !!value;
|
|
13215
13186
|
async function handleRemove() {
|
|
13216
13187
|
setError(null);
|
|
@@ -13285,28 +13256,28 @@ function useTapToCancel({
|
|
|
13285
13256
|
cancellingLabel = "Cancelling\u2026",
|
|
13286
13257
|
onCancel
|
|
13287
13258
|
}) {
|
|
13288
|
-
const [isCancelling, setIsCancelling] =
|
|
13289
|
-
const timeoutRef =
|
|
13290
|
-
const clear =
|
|
13259
|
+
const [isCancelling, setIsCancelling] = React55.useState(false);
|
|
13260
|
+
const timeoutRef = React55.useRef(null);
|
|
13261
|
+
const clear = React55.useCallback(() => {
|
|
13291
13262
|
if (timeoutRef.current !== null) {
|
|
13292
13263
|
window.clearTimeout(timeoutRef.current);
|
|
13293
13264
|
timeoutRef.current = null;
|
|
13294
13265
|
}
|
|
13295
13266
|
}, []);
|
|
13296
|
-
const handlePointerDown =
|
|
13267
|
+
const handlePointerDown = React55.useCallback(() => {
|
|
13297
13268
|
if (!submitting) return;
|
|
13298
13269
|
timeoutRef.current = window.setTimeout(() => {
|
|
13299
13270
|
setIsCancelling(true);
|
|
13300
13271
|
}, LONG_PRESS_MS);
|
|
13301
13272
|
}, [submitting]);
|
|
13302
|
-
const handlePointerUp =
|
|
13273
|
+
const handlePointerUp = React55.useCallback(() => {
|
|
13303
13274
|
clear();
|
|
13304
13275
|
if (isCancelling && onCancel) {
|
|
13305
13276
|
onCancel();
|
|
13306
13277
|
}
|
|
13307
13278
|
setIsCancelling(false);
|
|
13308
13279
|
}, [clear, isCancelling, onCancel]);
|
|
13309
|
-
const handlePointerLeave =
|
|
13280
|
+
const handlePointerLeave = React55.useCallback(() => {
|
|
13310
13281
|
clear();
|
|
13311
13282
|
setIsCancelling(false);
|
|
13312
13283
|
}, [clear]);
|
|
@@ -13337,27 +13308,27 @@ function emailLocalPart(email) {
|
|
|
13337
13308
|
function OnboardingProfile({ chrome } = {}) {
|
|
13338
13309
|
const navigate = useWizardNavigate();
|
|
13339
13310
|
const { refreshUser } = useAuth();
|
|
13340
|
-
const [firstName, setFirstName] =
|
|
13341
|
-
const [lastName, setLastName] =
|
|
13342
|
-
const [dob, setDob] =
|
|
13343
|
-
const [addressLine1, setAddressLine1] =
|
|
13344
|
-
const [addressLine2, setAddressLine2] =
|
|
13345
|
-
const [addressCity, setAddressCity] =
|
|
13346
|
-
const [addressRegion, setAddressRegion] =
|
|
13347
|
-
const [addressPostalCode, setAddressPostalCode] =
|
|
13348
|
-
const [addressCountry, setAddressCountry] =
|
|
13349
|
-
const [displayName, setDisplayName] =
|
|
13350
|
-
const [displayNameEdited, setDisplayNameEdited] =
|
|
13351
|
-
const [submitting, setSubmitting] =
|
|
13352
|
-
const [error, setError] =
|
|
13353
|
-
const [loaded, setLoaded] =
|
|
13354
|
-
const [fallbackName, setFallbackName] =
|
|
13355
|
-
const [avatarChoice, setAvatarChoice] =
|
|
13356
|
-
const [avatarUrl, setAvatarUrl] =
|
|
13357
|
-
const [avatarTouched, setAvatarTouched] =
|
|
13358
|
-
const [avatarUrlTouched, setAvatarUrlTouched] =
|
|
13359
|
-
const [accountEmail, setAccountEmail] =
|
|
13360
|
-
|
|
13311
|
+
const [firstName, setFirstName] = React55.useState(null);
|
|
13312
|
+
const [lastName, setLastName] = React55.useState(null);
|
|
13313
|
+
const [dob, setDob] = React55.useState(null);
|
|
13314
|
+
const [addressLine1, setAddressLine1] = React55.useState(null);
|
|
13315
|
+
const [addressLine2, setAddressLine2] = React55.useState(null);
|
|
13316
|
+
const [addressCity, setAddressCity] = React55.useState(null);
|
|
13317
|
+
const [addressRegion, setAddressRegion] = React55.useState(null);
|
|
13318
|
+
const [addressPostalCode, setAddressPostalCode] = React55.useState(null);
|
|
13319
|
+
const [addressCountry, setAddressCountry] = React55.useState(null);
|
|
13320
|
+
const [displayName, setDisplayName] = React55.useState("");
|
|
13321
|
+
const [displayNameEdited, setDisplayNameEdited] = React55.useState(false);
|
|
13322
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
13323
|
+
const [error, setError] = React55.useState(null);
|
|
13324
|
+
const [loaded, setLoaded] = React55.useState(false);
|
|
13325
|
+
const [fallbackName, setFallbackName] = React55.useState("You");
|
|
13326
|
+
const [avatarChoice, setAvatarChoice] = React55.useState(null);
|
|
13327
|
+
const [avatarUrl, setAvatarUrl] = React55.useState(null);
|
|
13328
|
+
const [avatarTouched, setAvatarTouched] = React55.useState(false);
|
|
13329
|
+
const [avatarUrlTouched, setAvatarUrlTouched] = React55.useState(false);
|
|
13330
|
+
const [accountEmail, setAccountEmail] = React55.useState(null);
|
|
13331
|
+
React55.useEffect(() => {
|
|
13361
13332
|
if (!exports.authService.isAuthenticated()) {
|
|
13362
13333
|
setLoaded(true);
|
|
13363
13334
|
return;
|
|
@@ -13415,7 +13386,7 @@ function OnboardingProfile({ chrome } = {}) {
|
|
|
13415
13386
|
};
|
|
13416
13387
|
}, []);
|
|
13417
13388
|
const autoDerivedDisplayName = [firstName, lastName].map((s) => (s || "").trim()).filter(Boolean).join(" ");
|
|
13418
|
-
|
|
13389
|
+
React55.useEffect(() => {
|
|
13419
13390
|
if (!displayNameEdited) {
|
|
13420
13391
|
setDisplayName(autoDerivedDisplayName);
|
|
13421
13392
|
}
|
|
@@ -13611,7 +13582,7 @@ function IdentityVerify({
|
|
|
13611
13582
|
} = {}) {
|
|
13612
13583
|
const navigate = useWizardNavigate();
|
|
13613
13584
|
const { config, isLoading } = useProviderConfig();
|
|
13614
|
-
const [error, setError] =
|
|
13585
|
+
const [error, setError] = React55.useState(null);
|
|
13615
13586
|
const primaryId = config?.kyc.primary;
|
|
13616
13587
|
const allowedIdentityProviders = userIdentityStatusScopes(config);
|
|
13617
13588
|
const gate = useOnboardingState(
|
|
@@ -15065,20 +15036,20 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15065
15036
|
const navigate = useWizardNavigate();
|
|
15066
15037
|
const { bootstrapSession, user } = useAuth();
|
|
15067
15038
|
const { config } = useProviderConfig();
|
|
15068
|
-
const [keys, setKeys] =
|
|
15069
|
-
const [loading, setLoading] =
|
|
15070
|
-
const [busy, setBusy] =
|
|
15071
|
-
const [error, setError] =
|
|
15072
|
-
const [lastFailedAction, setLastFailedAction] =
|
|
15073
|
-
const [status, setStatus] =
|
|
15074
|
-
const [autoAdvanceArmed, setAutoAdvanceArmed] =
|
|
15075
|
-
const [emailDraft, setEmailDraft] =
|
|
15076
|
-
const [showDynamic, setShowDynamic] =
|
|
15077
|
-
const [walletsOpen, setWalletsOpen] =
|
|
15039
|
+
const [keys, setKeys] = React55.useState([]);
|
|
15040
|
+
const [loading, setLoading] = React55.useState(true);
|
|
15041
|
+
const [busy, setBusy] = React55.useState(null);
|
|
15042
|
+
const [error, setError] = React55.useState(null);
|
|
15043
|
+
const [lastFailedAction, setLastFailedAction] = React55.useState(null);
|
|
15044
|
+
const [status, setStatus] = React55.useState(null);
|
|
15045
|
+
const [autoAdvanceArmed, setAutoAdvanceArmed] = React55.useState(false);
|
|
15046
|
+
const [emailDraft, setEmailDraft] = React55.useState("");
|
|
15047
|
+
const [showDynamic, setShowDynamic] = React55.useState(false);
|
|
15048
|
+
const [walletsOpen, setWalletsOpen] = React55.useState(false);
|
|
15078
15049
|
const hasSyntheticEmail = !!user?.email && user.email.toLowerCase().endsWith("@external.yieldfabric.local");
|
|
15079
15050
|
const { snapshot: gateSnapshot } = useOnboardingState();
|
|
15080
15051
|
const emailOk = !!gateSnapshot && snapshotEmailOk(gateSnapshot);
|
|
15081
|
-
const refresh =
|
|
15052
|
+
const refresh = React55.useCallback(async (opts = {}) => {
|
|
15082
15053
|
try {
|
|
15083
15054
|
if (opts.invalidate ?? !opts.silent) {
|
|
15084
15055
|
invalidateWalletCount();
|
|
@@ -15096,7 +15067,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15096
15067
|
setLoading(false);
|
|
15097
15068
|
}
|
|
15098
15069
|
}, []);
|
|
15099
|
-
|
|
15070
|
+
React55.useEffect(() => {
|
|
15100
15071
|
refresh({ invalidate: true });
|
|
15101
15072
|
}, [refresh]);
|
|
15102
15073
|
const keyCount = keys.length;
|
|
@@ -15231,7 +15202,7 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15231
15202
|
setBusy(null);
|
|
15232
15203
|
}
|
|
15233
15204
|
}
|
|
15234
|
-
const goOn =
|
|
15205
|
+
const goOn = React55.useCallback(async () => {
|
|
15235
15206
|
setBusy("continue");
|
|
15236
15207
|
setLastFailedAction(null);
|
|
15237
15208
|
try {
|
|
@@ -15259,16 +15230,16 @@ function AddWalletsStep({ chrome } = {}) {
|
|
|
15259
15230
|
setBusy(null);
|
|
15260
15231
|
}
|
|
15261
15232
|
}, [bootstrapSession, config, navigate, user?.role]);
|
|
15262
|
-
const onContinue =
|
|
15233
|
+
const onContinue = React55.useCallback(async () => {
|
|
15263
15234
|
if (!canContinue) return;
|
|
15264
15235
|
await goOn();
|
|
15265
15236
|
}, [canContinue, goOn]);
|
|
15266
|
-
const onSkip =
|
|
15237
|
+
const onSkip = React55.useCallback(async () => {
|
|
15267
15238
|
if (!user?.id) return;
|
|
15268
15239
|
deferKeyStep(user.id);
|
|
15269
15240
|
await goOn();
|
|
15270
15241
|
}, [goOn, user?.id]);
|
|
15271
|
-
|
|
15242
|
+
React55.useEffect(() => {
|
|
15272
15243
|
if (!autoAdvanceArmed || !canContinue || busy) return;
|
|
15273
15244
|
const timeout = window.setTimeout(() => {
|
|
15274
15245
|
setAutoAdvanceArmed(false);
|
|
@@ -15502,10 +15473,10 @@ var Drawer = ({
|
|
|
15502
15473
|
panelStyle,
|
|
15503
15474
|
contentStyle
|
|
15504
15475
|
}) => {
|
|
15505
|
-
const titleId =
|
|
15506
|
-
const panelRef =
|
|
15507
|
-
const closeButtonRef =
|
|
15508
|
-
|
|
15476
|
+
const titleId = React55.useId();
|
|
15477
|
+
const panelRef = React55.useRef(null);
|
|
15478
|
+
const closeButtonRef = React55.useRef(null);
|
|
15479
|
+
React55.useEffect(() => {
|
|
15509
15480
|
if (!isOpen || typeof document === "undefined") return;
|
|
15510
15481
|
const previouslyFocused = document.activeElement;
|
|
15511
15482
|
const bodyOverflow = document.body.style.overflow;
|
|
@@ -15776,12 +15747,12 @@ var EXPLANATIONS = {
|
|
|
15776
15747
|
manual: "Save a card for this billing profile. It is only charged for metered usage \u2014 nothing is charged now."
|
|
15777
15748
|
};
|
|
15778
15749
|
var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) => {
|
|
15779
|
-
const mountRef =
|
|
15780
|
-
const stripeRef =
|
|
15781
|
-
const elementsRef =
|
|
15782
|
-
const [ready, setReady] =
|
|
15783
|
-
const [submitting, setSubmitting] =
|
|
15784
|
-
|
|
15750
|
+
const mountRef = React55.useRef(null);
|
|
15751
|
+
const stripeRef = React55.useRef(null);
|
|
15752
|
+
const elementsRef = React55.useRef(null);
|
|
15753
|
+
const [ready, setReady] = React55.useState(false);
|
|
15754
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
15755
|
+
React55.useEffect(() => {
|
|
15785
15756
|
let cancelled = false;
|
|
15786
15757
|
let element = null;
|
|
15787
15758
|
(async () => {
|
|
@@ -15811,7 +15782,7 @@ var CardCollectForm = ({ stripeLoader, session, onSaved, onError, groupId }) =>
|
|
|
15811
15782
|
}
|
|
15812
15783
|
};
|
|
15813
15784
|
}, [session.client_secret]);
|
|
15814
|
-
const submit =
|
|
15785
|
+
const submit = React55.useCallback(async () => {
|
|
15815
15786
|
const stripe = stripeRef.current;
|
|
15816
15787
|
const elements = elementsRef.current;
|
|
15817
15788
|
if (!stripe || !elements || submitting) return;
|
|
@@ -15866,9 +15837,9 @@ var AddCardDialog = ({
|
|
|
15866
15837
|
groupId,
|
|
15867
15838
|
source = "manual"
|
|
15868
15839
|
}) => {
|
|
15869
|
-
const [stage, setStage] =
|
|
15870
|
-
const [attempt, setAttempt] =
|
|
15871
|
-
|
|
15840
|
+
const [stage, setStage] = React55.useState({ kind: "creating" });
|
|
15841
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
15842
|
+
React55.useEffect(() => {
|
|
15872
15843
|
if (!isOpen) return;
|
|
15873
15844
|
let cancelled = false;
|
|
15874
15845
|
setStage({ kind: "creating" });
|
|
@@ -15897,7 +15868,7 @@ var AddCardDialog = ({
|
|
|
15897
15868
|
cancelled = true;
|
|
15898
15869
|
};
|
|
15899
15870
|
}, [isOpen, groupId, attempt]);
|
|
15900
|
-
const openPortal =
|
|
15871
|
+
const openPortal = React55.useCallback(async () => {
|
|
15901
15872
|
try {
|
|
15902
15873
|
const url = await exports.billingService.createPortalSession(void 0, groupId);
|
|
15903
15874
|
window.location.assign(url);
|
|
@@ -15976,8 +15947,8 @@ var AddCardDialog = ({
|
|
|
15976
15947
|
};
|
|
15977
15948
|
function AddCardStep({ chrome } = {}) {
|
|
15978
15949
|
const navigate = useWizardNavigate();
|
|
15979
|
-
const [dialogOpen, setDialogOpen] =
|
|
15980
|
-
const [saved, setSaved] =
|
|
15950
|
+
const [dialogOpen, setDialogOpen] = React55.useState(true);
|
|
15951
|
+
const [saved, setSaved] = React55.useState(false);
|
|
15981
15952
|
const handleSuccess = () => {
|
|
15982
15953
|
setSaved(true);
|
|
15983
15954
|
setDialogOpen(false);
|
|
@@ -16055,7 +16026,7 @@ function Field({
|
|
|
16055
16026
|
value,
|
|
16056
16027
|
copyable
|
|
16057
16028
|
}) {
|
|
16058
|
-
const [copied, setCopied] =
|
|
16029
|
+
const [copied, setCopied] = React55__default.default.useState(false);
|
|
16059
16030
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
16060
16031
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] uppercase tracking-wider text-text-secondary", children: label }),
|
|
16061
16032
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-0.5 flex items-center gap-2", children: [
|
|
@@ -16119,14 +16090,14 @@ var STAGE_COPY = {
|
|
|
16119
16090
|
not_applicable: { title: "Finishing up", body: "" }
|
|
16120
16091
|
};
|
|
16121
16092
|
var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
|
|
16122
|
-
const [status, setStatus] =
|
|
16123
|
-
const [impatient, setImpatient] =
|
|
16124
|
-
const activationStarted =
|
|
16125
|
-
const onContinueRef =
|
|
16126
|
-
|
|
16093
|
+
const [status, setStatus] = React55__default.default.useState(null);
|
|
16094
|
+
const [impatient, setImpatient] = React55__default.default.useState(false);
|
|
16095
|
+
const activationStarted = React55__default.default.useRef(false);
|
|
16096
|
+
const onContinueRef = React55__default.default.useRef(onContinue);
|
|
16097
|
+
React55__default.default.useEffect(() => {
|
|
16127
16098
|
onContinueRef.current = onContinue;
|
|
16128
16099
|
}, [onContinue]);
|
|
16129
|
-
|
|
16100
|
+
React55__default.default.useEffect(() => {
|
|
16130
16101
|
let cancelled = false;
|
|
16131
16102
|
let timer;
|
|
16132
16103
|
const startedAt = Date.now();
|
|
@@ -16225,11 +16196,11 @@ var TOTAL_MS = 3e3;
|
|
|
16225
16196
|
function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
16226
16197
|
const navigate = useWizardNavigate();
|
|
16227
16198
|
const { messages } = useBranding();
|
|
16228
|
-
const [name, setName] =
|
|
16229
|
-
const [walletShort, setWalletShort] =
|
|
16230
|
-
const [phase, setPhase] =
|
|
16231
|
-
const [accountOpened, setAccountOpened] =
|
|
16232
|
-
|
|
16199
|
+
const [name, setName] = React55.useState("");
|
|
16200
|
+
const [walletShort, setWalletShort] = React55.useState(null);
|
|
16201
|
+
const [phase, setPhase] = React55.useState("wallet");
|
|
16202
|
+
const [accountOpened, setAccountOpened] = React55.useState(false);
|
|
16203
|
+
React55.useEffect(() => {
|
|
16233
16204
|
let cancelled = false;
|
|
16234
16205
|
(async () => {
|
|
16235
16206
|
const token = exports.authService.getAccessToken();
|
|
@@ -16262,7 +16233,7 @@ function OnboardingWelcomeMoment({ chrome } = {}) {
|
|
|
16262
16233
|
cancelled = true;
|
|
16263
16234
|
};
|
|
16264
16235
|
}, []);
|
|
16265
|
-
|
|
16236
|
+
React55.useEffect(() => {
|
|
16266
16237
|
if (!accountOpened) return;
|
|
16267
16238
|
const swap = window.setTimeout(() => setPhase("welcome"), WALLET_AWAKENING_MS);
|
|
16268
16239
|
const route = window.setTimeout(() => navigate("/home"), TOTAL_MS);
|
|
@@ -16472,39 +16443,39 @@ function ChoosePlan({
|
|
|
16472
16443
|
hydratePlanSelection,
|
|
16473
16444
|
clearPlanSelection
|
|
16474
16445
|
} = useWizardPlanIntent();
|
|
16475
|
-
const [catalog, setCatalog] =
|
|
16476
|
-
const [selected, setSelected] =
|
|
16477
|
-
const [selectedCatalogVersion, setSelectedCatalogVersion] =
|
|
16478
|
-
const [loading, setLoading] =
|
|
16479
|
-
const [busy, setBusy] =
|
|
16480
|
-
const [error, setError] =
|
|
16481
|
-
const [loadAttempt, setLoadAttempt] =
|
|
16482
|
-
const [completed, setCompleted] =
|
|
16483
|
-
const [leave, setLeave] =
|
|
16484
|
-
const [serverRequired, setServerRequired] =
|
|
16485
|
-
const [returnPending, setReturnPending] =
|
|
16446
|
+
const [catalog, setCatalog] = React55.useState(null);
|
|
16447
|
+
const [selected, setSelected] = React55.useState(null);
|
|
16448
|
+
const [selectedCatalogVersion, setSelectedCatalogVersion] = React55.useState(null);
|
|
16449
|
+
const [loading, setLoading] = React55.useState(true);
|
|
16450
|
+
const [busy, setBusy] = React55.useState(false);
|
|
16451
|
+
const [error, setError] = React55.useState(null);
|
|
16452
|
+
const [loadAttempt, setLoadAttempt] = React55.useState(0);
|
|
16453
|
+
const [completed, setCompleted] = React55.useState(false);
|
|
16454
|
+
const [leave, setLeave] = React55.useState(false);
|
|
16455
|
+
const [serverRequired, setServerRequired] = React55.useState(false);
|
|
16456
|
+
const [returnPending, setReturnPending] = React55.useState(() => {
|
|
16486
16457
|
const marker = readCreditCheckoutReturnMarker();
|
|
16487
16458
|
return marker?.kind === "plan" && !marker.groupId;
|
|
16488
16459
|
});
|
|
16489
|
-
const [returnRetryRequired, setReturnRetryRequired] =
|
|
16490
|
-
const initialAppliedProofRef =
|
|
16491
|
-
const appliedProofRef =
|
|
16492
|
-
const appliedPlanIdRef =
|
|
16460
|
+
const [returnRetryRequired, setReturnRetryRequired] = React55.useState(false);
|
|
16461
|
+
const initialAppliedProofRef = React55.useRef(readAppliedPlanProof());
|
|
16462
|
+
const appliedProofRef = React55.useRef(initialAppliedProofRef.current);
|
|
16463
|
+
const appliedPlanIdRef = React55.useRef(
|
|
16493
16464
|
initialAppliedProofRef.current?.purchasedPlanId ?? null
|
|
16494
16465
|
);
|
|
16495
|
-
const expectedPlanIdRef =
|
|
16466
|
+
const expectedPlanIdRef = React55.useRef(null);
|
|
16496
16467
|
const initialMismatch = initialAppliedProofRef.current?.intendedPlanId && initialAppliedProofRef.current.intendedPlanId !== initialAppliedProofRef.current.purchasedPlanId ? {
|
|
16497
16468
|
purchasedPlanId: initialAppliedProofRef.current.purchasedPlanId,
|
|
16498
16469
|
intendedPlanId: initialAppliedProofRef.current.intendedPlanId
|
|
16499
16470
|
} : null;
|
|
16500
|
-
const [appliedMismatch, setAppliedMismatch] =
|
|
16471
|
+
const [appliedMismatch, setAppliedMismatch] = React55.useState(
|
|
16501
16472
|
initialMismatch
|
|
16502
16473
|
);
|
|
16503
|
-
const appliedMismatchRef =
|
|
16474
|
+
const appliedMismatchRef = React55.useRef(initialMismatch);
|
|
16504
16475
|
expectedPlanIdRef.current = selected?.id ?? planSelection?.planId ?? null;
|
|
16505
16476
|
const directSelfPayApplicable = !(wizardPlatform ?? config?.platform?.group_id) && !personalSessionHasGroupPayer();
|
|
16506
16477
|
const planRequired = required || serverRequired;
|
|
16507
|
-
|
|
16478
|
+
React55.useEffect(() => {
|
|
16508
16479
|
if (!directSelfPayApplicable) return;
|
|
16509
16480
|
let disposed = false;
|
|
16510
16481
|
setLoading(true);
|
|
@@ -16594,7 +16565,7 @@ function ChoosePlan({
|
|
|
16594
16565
|
required,
|
|
16595
16566
|
returnPending
|
|
16596
16567
|
]);
|
|
16597
|
-
|
|
16568
|
+
React55.useEffect(() => {
|
|
16598
16569
|
const handleApplied = (event) => {
|
|
16599
16570
|
const detail = event.detail;
|
|
16600
16571
|
if (detail.kind !== "plan" || detail.groupId || !detail.creditPlanId) return;
|
|
@@ -16628,7 +16599,7 @@ function ChoosePlan({
|
|
|
16628
16599
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16629
16600
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
|
|
16630
16601
|
}, []);
|
|
16631
|
-
|
|
16602
|
+
React55.useEffect(() => {
|
|
16632
16603
|
const matchesPersonalPlanReturn = (event) => {
|
|
16633
16604
|
const detail = event.detail;
|
|
16634
16605
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -16659,7 +16630,7 @@ function ChoosePlan({
|
|
|
16659
16630
|
);
|
|
16660
16631
|
};
|
|
16661
16632
|
}, []);
|
|
16662
|
-
|
|
16633
|
+
React55.useEffect(() => {
|
|
16663
16634
|
if (!returnPending) return;
|
|
16664
16635
|
const timer = window.setInterval(() => {
|
|
16665
16636
|
const marker = readCreditCheckoutReturnMarker();
|
|
@@ -17161,20 +17132,20 @@ function SponsorshipConsent({
|
|
|
17161
17132
|
stageSponsorship,
|
|
17162
17133
|
finishSponsorship
|
|
17163
17134
|
} = useWizardAuthentication();
|
|
17164
|
-
const [sponsorship, setSponsorship] =
|
|
17165
|
-
const [exactSession, setExactSession] =
|
|
17166
|
-
const [agreed, setAgreed] =
|
|
17167
|
-
const [loading, setLoading] =
|
|
17168
|
-
const [busy, setBusy] =
|
|
17169
|
-
const [error, setError] =
|
|
17170
|
-
const [loadAttempt, setLoadAttempt] =
|
|
17171
|
-
const destination =
|
|
17135
|
+
const [sponsorship, setSponsorship] = React55.useState(null);
|
|
17136
|
+
const [exactSession, setExactSession] = React55.useState(false);
|
|
17137
|
+
const [agreed, setAgreed] = React55.useState(false);
|
|
17138
|
+
const [loading, setLoading] = React55.useState(true);
|
|
17139
|
+
const [busy, setBusy] = React55.useState(false);
|
|
17140
|
+
const [error, setError] = React55.useState(null);
|
|
17141
|
+
const [loadAttempt, setLoadAttempt] = React55.useState(0);
|
|
17142
|
+
const destination = React55.useMemo(() => {
|
|
17172
17143
|
if (pendingSponsorship?.groupId === groupId) {
|
|
17173
17144
|
return pendingSponsorship.destination;
|
|
17174
17145
|
}
|
|
17175
17146
|
return fallbackDestination;
|
|
17176
17147
|
}, [fallbackDestination, groupId, pendingSponsorship]);
|
|
17177
|
-
const loadCurrent =
|
|
17148
|
+
const loadCurrent = React55.useCallback(async (driftMessage) => {
|
|
17178
17149
|
setLoading(true);
|
|
17179
17150
|
if (!driftMessage) setError(null);
|
|
17180
17151
|
try {
|
|
@@ -17197,7 +17168,7 @@ function SponsorshipConsent({
|
|
|
17197
17168
|
setLoading(false);
|
|
17198
17169
|
}
|
|
17199
17170
|
}, [destination, groupId, stageSponsorship]);
|
|
17200
|
-
|
|
17171
|
+
React55.useEffect(() => {
|
|
17201
17172
|
let cancelled = false;
|
|
17202
17173
|
setLoading(true);
|
|
17203
17174
|
setError(null);
|
|
@@ -17464,7 +17435,7 @@ function WizardRouter({
|
|
|
17464
17435
|
identityRequired && primaryKycVerifiesEmail(config)
|
|
17465
17436
|
);
|
|
17466
17437
|
const hostOwnsSponsorshipConsent = sponsorshipConsent === "host";
|
|
17467
|
-
|
|
17438
|
+
React55__default.default.useEffect(() => {
|
|
17468
17439
|
if (hostOwnsSponsorshipConsent && pendingSponsorship) {
|
|
17469
17440
|
discardSponsorship();
|
|
17470
17441
|
}
|
|
@@ -17680,7 +17651,7 @@ function builtinProviderDisplayName(id) {
|
|
|
17680
17651
|
}
|
|
17681
17652
|
}
|
|
17682
17653
|
function useProviderDisplayName(config) {
|
|
17683
|
-
return
|
|
17654
|
+
return React55__default.default.useCallback(
|
|
17684
17655
|
(id) => {
|
|
17685
17656
|
const labelled = config?.kyc?.settings?.[id]?.label ?? config?.auth?.settings?.[id]?.label;
|
|
17686
17657
|
const trimmed = typeof labelled === "string" ? labelled.trim() : "";
|
|
@@ -17750,26 +17721,26 @@ var OnboardingPolicySection = ({
|
|
|
17750
17721
|
groupId,
|
|
17751
17722
|
sponsorshipEpoch = 0
|
|
17752
17723
|
}) => {
|
|
17753
|
-
const [deployConfig, setDeployConfig] =
|
|
17724
|
+
const [deployConfig, setDeployConfig] = React55.useState(null);
|
|
17754
17725
|
const providerDisplayName = useProviderDisplayName(deployConfig);
|
|
17755
|
-
const [deployLoading, setDeployLoading] =
|
|
17756
|
-
const [profiles, setProfiles] =
|
|
17757
|
-
const [catalogRefreshed, setCatalogRefreshed] =
|
|
17758
|
-
const [loading, setLoading] =
|
|
17759
|
-
const [hidden, setHidden] =
|
|
17760
|
-
const [platformActive, setPlatformActive] =
|
|
17761
|
-
const [loadError, setLoadError] =
|
|
17762
|
-
const [saving, setSaving] =
|
|
17763
|
-
const [saved, setSaved] =
|
|
17764
|
-
const [saveError, setSaveError] =
|
|
17765
|
-
const [profileName, setProfileName] =
|
|
17766
|
-
const [requireEmail, setRequireEmail] =
|
|
17767
|
-
const [customize, setCustomize] =
|
|
17768
|
-
const [selectedProviders, setSelectedProviders] =
|
|
17769
|
-
const [authPrimary, setAuthPrimary] =
|
|
17770
|
-
const [kycPrimary, setKycPrimary] =
|
|
17771
|
-
const [uxSteps, setUxSteps] =
|
|
17772
|
-
|
|
17726
|
+
const [deployLoading, setDeployLoading] = React55.useState(true);
|
|
17727
|
+
const [profiles, setProfiles] = React55.useState([]);
|
|
17728
|
+
const [catalogRefreshed, setCatalogRefreshed] = React55.useState(false);
|
|
17729
|
+
const [loading, setLoading] = React55.useState(true);
|
|
17730
|
+
const [hidden, setHidden] = React55.useState(false);
|
|
17731
|
+
const [platformActive, setPlatformActive] = React55.useState(null);
|
|
17732
|
+
const [loadError, setLoadError] = React55.useState(null);
|
|
17733
|
+
const [saving, setSaving] = React55.useState(false);
|
|
17734
|
+
const [saved, setSaved] = React55.useState(false);
|
|
17735
|
+
const [saveError, setSaveError] = React55.useState(null);
|
|
17736
|
+
const [profileName, setProfileName] = React55.useState("");
|
|
17737
|
+
const [requireEmail, setRequireEmail] = React55.useState(false);
|
|
17738
|
+
const [customize, setCustomize] = React55.useState(false);
|
|
17739
|
+
const [selectedProviders, setSelectedProviders] = React55.useState([]);
|
|
17740
|
+
const [authPrimary, setAuthPrimary] = React55.useState("");
|
|
17741
|
+
const [kycPrimary, setKycPrimary] = React55.useState("");
|
|
17742
|
+
const [uxSteps, setUxSteps] = React55.useState({});
|
|
17743
|
+
React55.useEffect(() => {
|
|
17773
17744
|
let cancelled = false;
|
|
17774
17745
|
(async () => {
|
|
17775
17746
|
try {
|
|
@@ -17788,7 +17759,7 @@ var OnboardingPolicySection = ({
|
|
|
17788
17759
|
cancelled = true;
|
|
17789
17760
|
};
|
|
17790
17761
|
}, []);
|
|
17791
|
-
const applyResponse =
|
|
17762
|
+
const applyResponse = React55.useCallback((p) => {
|
|
17792
17763
|
const pol = p.policy;
|
|
17793
17764
|
setProfileName(p.verification_profile ?? "");
|
|
17794
17765
|
setRequireEmail(pol?.require_email ?? false);
|
|
@@ -17798,8 +17769,8 @@ var OnboardingPolicySection = ({
|
|
|
17798
17769
|
setKycPrimary(pol?.kyc_primary ?? "");
|
|
17799
17770
|
setUxSteps(pol?.ux_steps ?? {});
|
|
17800
17771
|
}, []);
|
|
17801
|
-
const loadGen =
|
|
17802
|
-
const load =
|
|
17772
|
+
const loadGen = React55.useRef(0);
|
|
17773
|
+
const load = React55.useCallback(async () => {
|
|
17803
17774
|
const gen = ++loadGen.current;
|
|
17804
17775
|
setLoading(true);
|
|
17805
17776
|
setLoadError(null);
|
|
@@ -17822,16 +17793,16 @@ var OnboardingPolicySection = ({
|
|
|
17822
17793
|
if (gen === loadGen.current) setLoading(false);
|
|
17823
17794
|
}
|
|
17824
17795
|
}, [groupId, applyResponse]);
|
|
17825
|
-
|
|
17796
|
+
React55.useEffect(() => {
|
|
17826
17797
|
setHidden(false);
|
|
17827
17798
|
setSaved(false);
|
|
17828
17799
|
setSaveError(null);
|
|
17829
17800
|
setCatalogRefreshed(false);
|
|
17830
17801
|
void load();
|
|
17831
17802
|
}, [load]);
|
|
17832
|
-
const [probeRetry, setProbeRetry] =
|
|
17833
|
-
const probedGroupRef =
|
|
17834
|
-
|
|
17803
|
+
const [probeRetry, setProbeRetry] = React55.useState(0);
|
|
17804
|
+
const probedGroupRef = React55.useRef(null);
|
|
17805
|
+
React55.useEffect(() => {
|
|
17835
17806
|
let cancelled = false;
|
|
17836
17807
|
if (probedGroupRef.current !== groupId) {
|
|
17837
17808
|
setPlatformActive(null);
|
|
@@ -17846,7 +17817,7 @@ var OnboardingPolicySection = ({
|
|
|
17846
17817
|
cancelled = true;
|
|
17847
17818
|
};
|
|
17848
17819
|
}, [groupId, sponsorshipEpoch, probeRetry]);
|
|
17849
|
-
const markDirty =
|
|
17820
|
+
const markDirty = React55.useCallback(() => {
|
|
17850
17821
|
setSaved(false);
|
|
17851
17822
|
setSaveError(null);
|
|
17852
17823
|
}, []);
|
|
@@ -17897,7 +17868,7 @@ var OnboardingPolicySection = ({
|
|
|
17897
17868
|
return null;
|
|
17898
17869
|
};
|
|
17899
17870
|
const anyBlockedToggle = !loading && profileGroups.some((g) => groupVendors(g).some((v) => vendorToggleTarget(g, v) === null));
|
|
17900
|
-
|
|
17871
|
+
React55.useEffect(() => {
|
|
17901
17872
|
if (!anyBlockedToggle || catalogRefreshed) return;
|
|
17902
17873
|
setCatalogRefreshed(true);
|
|
17903
17874
|
onboardingPolicyService.listVerificationProfiles().then((v) => setProfiles(v.profiles)).catch(() => {
|
|
@@ -17936,7 +17907,7 @@ var OnboardingPolicySection = ({
|
|
|
17936
17907
|
...requireEmail ? [{ label: "Verify email" }] : [],
|
|
17937
17908
|
...profileName && identityStepLabel ? [{ label: identityStepLabel, detail: identityStepDetail }] : []
|
|
17938
17909
|
];
|
|
17939
|
-
const save =
|
|
17910
|
+
const save = React55.useCallback(async () => {
|
|
17940
17911
|
if (customize && selectedProviders.length === 0) {
|
|
17941
17912
|
setSaveError("Select at least one sign-in method, or turn customization off.");
|
|
17942
17913
|
return;
|
|
@@ -18016,7 +17987,7 @@ var OnboardingPolicySection = ({
|
|
|
18016
17987
|
)
|
|
18017
17988
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
18018
17989
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-2.5 gap-y-1.5 rounded-lg border border-primary/20 bg-primary/[0.04] px-3.5 py-2.5", children: [
|
|
18019
|
-
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17990
|
+
journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
18020
17991
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-[12px] text-text-muted/60", children: "\u203A" }),
|
|
18021
17992
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
18022
17993
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-primary/20 text-[9px] font-bold text-primary", children: i + 1 }),
|
|
@@ -18875,7 +18846,7 @@ function formatBigNumberString(value) {
|
|
|
18875
18846
|
return { withSeparators, sci: `~${mantissa}e${exp}` };
|
|
18876
18847
|
}
|
|
18877
18848
|
function ExpandableString({ value }) {
|
|
18878
|
-
const [expanded, setExpanded] =
|
|
18849
|
+
const [expanded, setExpanded] = React55.useState(false);
|
|
18879
18850
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex flex-wrap items-baseline gap-2", children: [
|
|
18880
18851
|
expanded ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-[10px] text-text-secondary break-all", children: value }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-text-muted", children: [
|
|
18881
18852
|
"[",
|
|
@@ -18961,7 +18932,7 @@ function PrettyObject({
|
|
|
18961
18932
|
depth,
|
|
18962
18933
|
keyHint
|
|
18963
18934
|
}) {
|
|
18964
|
-
const [showEmpty, setShowEmpty] =
|
|
18935
|
+
const [showEmpty, setShowEmpty] = React55.useState(false);
|
|
18965
18936
|
const entries = Object.entries(value);
|
|
18966
18937
|
const present = entries.filter(([, v]) => !isEmptyValue(v));
|
|
18967
18938
|
const empty = entries.filter(([, v]) => isEmptyValue(v));
|
|
@@ -19049,24 +19020,24 @@ function PrettyJson({
|
|
|
19049
19020
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary", children: String(value) });
|
|
19050
19021
|
}
|
|
19051
19022
|
function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId, entityType = "user", selectorRegistry, addressLabels, renderSimpleSummary, mode = "sign", onRetry, onSwitchToSign }) {
|
|
19052
|
-
const [unsignedTransaction, setUnsignedTransaction] =
|
|
19053
|
-
const [loading, setLoading] =
|
|
19054
|
-
const [error, setError] =
|
|
19055
|
-
const [reviewWarning, setReviewWarning] =
|
|
19056
|
-
const [signing, setSigning] =
|
|
19057
|
-
const [selectedKey, setSelectedKey] =
|
|
19058
|
-
const [availableKeys, setAvailableKeys] =
|
|
19059
|
-
const [keysLoading, setKeysLoading] =
|
|
19060
|
-
const [keysError, setKeysError] =
|
|
19061
|
-
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] =
|
|
19062
|
-
const [expandedTxData, setExpandedTxData] =
|
|
19063
|
-
const [view, setView] =
|
|
19064
|
-
const [cancelling, setCancelling] =
|
|
19065
|
-
const [cancelError, setCancelError] =
|
|
19023
|
+
const [unsignedTransaction, setUnsignedTransaction] = React55.useState(null);
|
|
19024
|
+
const [loading, setLoading] = React55.useState(true);
|
|
19025
|
+
const [error, setError] = React55.useState(null);
|
|
19026
|
+
const [reviewWarning, setReviewWarning] = React55.useState(null);
|
|
19027
|
+
const [signing, setSigning] = React55.useState(false);
|
|
19028
|
+
const [selectedKey, setSelectedKey] = React55.useState(null);
|
|
19029
|
+
const [availableKeys, setAvailableKeys] = React55.useState([]);
|
|
19030
|
+
const [keysLoading, setKeysLoading] = React55.useState(false);
|
|
19031
|
+
const [keysError, setKeysError] = React55.useState(null);
|
|
19032
|
+
const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] = React55.useState([]);
|
|
19033
|
+
const [expandedTxData, setExpandedTxData] = React55.useState(/* @__PURE__ */ new Set());
|
|
19034
|
+
const [view, setView] = React55.useState("simple");
|
|
19035
|
+
const [cancelling, setCancelling] = React55.useState(false);
|
|
19036
|
+
const [cancelError, setCancelError] = React55.useState(null);
|
|
19066
19037
|
const walletSigner = useWalletSigner();
|
|
19067
19038
|
const tokenStore = useTokenStore();
|
|
19068
19039
|
const delegationTokenForSigning = tokenStore.getDelegationToken();
|
|
19069
|
-
const ownedSignerState =
|
|
19040
|
+
const ownedSignerState = React55.useMemo(() => {
|
|
19070
19041
|
try {
|
|
19071
19042
|
return {
|
|
19072
19043
|
binding: nftOwnedSignerBinding(delegationTokenForSigning),
|
|
@@ -19095,7 +19066,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19095
19066
|
setCancelling(false);
|
|
19096
19067
|
}
|
|
19097
19068
|
};
|
|
19098
|
-
|
|
19069
|
+
React55.useEffect(() => {
|
|
19099
19070
|
setError(null);
|
|
19100
19071
|
setReviewWarning(null);
|
|
19101
19072
|
setKeysError(null);
|
|
@@ -19105,7 +19076,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19105
19076
|
setKeysError(null);
|
|
19106
19077
|
};
|
|
19107
19078
|
}, [message.id]);
|
|
19108
|
-
|
|
19079
|
+
React55.useEffect(() => {
|
|
19109
19080
|
const fetchUnsignedTransaction = async () => {
|
|
19110
19081
|
try {
|
|
19111
19082
|
setLoading(true);
|
|
@@ -19228,7 +19199,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19228
19199
|
mode,
|
|
19229
19200
|
delegationTokenForSigning
|
|
19230
19201
|
]);
|
|
19231
|
-
|
|
19202
|
+
React55.useEffect(() => {
|
|
19232
19203
|
if (mode === "inspect") {
|
|
19233
19204
|
setKeysLoading(false);
|
|
19234
19205
|
return;
|
|
@@ -19293,7 +19264,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19293
19264
|
ownedSignerBinding,
|
|
19294
19265
|
ownedSignerState.error
|
|
19295
19266
|
]);
|
|
19296
|
-
|
|
19267
|
+
React55.useEffect(() => {
|
|
19297
19268
|
if (mode === "inspect") {
|
|
19298
19269
|
setPolicyAuthorizedKeyIds([]);
|
|
19299
19270
|
return;
|
|
@@ -19317,7 +19288,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
|
|
|
19317
19288
|
cancelled = true;
|
|
19318
19289
|
};
|
|
19319
19290
|
}, [message?.id, mode]);
|
|
19320
|
-
|
|
19291
|
+
React55.useEffect(() => {
|
|
19321
19292
|
if (availableKeys.length === 0) {
|
|
19322
19293
|
if (selectedKey) setSelectedKey(null);
|
|
19323
19294
|
return;
|
|
@@ -20135,8 +20106,8 @@ function InspectFooter({
|
|
|
20135
20106
|
onRetry,
|
|
20136
20107
|
onSwitchToSign
|
|
20137
20108
|
}) {
|
|
20138
|
-
const [retrying, setRetrying] =
|
|
20139
|
-
const [actionError, setActionError] =
|
|
20109
|
+
const [retrying, setRetrying] = React55.useState(false);
|
|
20110
|
+
const [actionError, setActionError] = React55.useState(null);
|
|
20140
20111
|
const status = effectiveStatus(message);
|
|
20141
20112
|
const color = statusToColor(status);
|
|
20142
20113
|
const txHash = message.response?.deployment_tx_hash || message.response?.transaction_hash;
|
|
@@ -20275,8 +20246,8 @@ var GWEI_DISPLAY_THRESHOLD = BigInt("100000000000000");
|
|
|
20275
20246
|
var NATIVE_SYMBOL = "ETH";
|
|
20276
20247
|
var USD_PER_GAS = 0.01 / 21e3;
|
|
20277
20248
|
function useGasPricing() {
|
|
20278
|
-
const [pricing, setPricing] =
|
|
20279
|
-
|
|
20249
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
20250
|
+
React55.useEffect(() => {
|
|
20280
20251
|
let mounted = true;
|
|
20281
20252
|
void exports.billingService.getGasPricing().then((p) => {
|
|
20282
20253
|
if (mounted) setPricing(p);
|
|
@@ -20410,12 +20381,12 @@ var Toast = ({
|
|
|
20410
20381
|
icon,
|
|
20411
20382
|
action
|
|
20412
20383
|
}) => {
|
|
20413
|
-
const [progress, setProgress] =
|
|
20414
|
-
const [isVisible, setIsVisible] =
|
|
20415
|
-
|
|
20384
|
+
const [progress, setProgress] = React55.useState(100);
|
|
20385
|
+
const [isVisible, setIsVisible] = React55.useState(false);
|
|
20386
|
+
React55.useEffect(() => {
|
|
20416
20387
|
requestAnimationFrame(() => setIsVisible(true));
|
|
20417
20388
|
}, []);
|
|
20418
|
-
|
|
20389
|
+
React55.useEffect(() => {
|
|
20419
20390
|
if (duration > 0) {
|
|
20420
20391
|
const interval = setInterval(() => {
|
|
20421
20392
|
setProgress((prev) => {
|
|
@@ -20560,7 +20531,7 @@ function SignatureWorkflow({
|
|
|
20560
20531
|
dismissPending,
|
|
20561
20532
|
refreshPending
|
|
20562
20533
|
} = useSignatureQueue();
|
|
20563
|
-
|
|
20534
|
+
React55.useEffect(() => {
|
|
20564
20535
|
if (!notify || !pending) return;
|
|
20565
20536
|
const cleanup = notify({
|
|
20566
20537
|
id: `signature-${pending.id}`,
|
|
@@ -20710,7 +20681,7 @@ async function resolveKey(userId, selection) {
|
|
|
20710
20681
|
function useGenericSigner() {
|
|
20711
20682
|
const { user } = useAuth();
|
|
20712
20683
|
const { signMessage: signWithWallet } = useWalletSigner();
|
|
20713
|
-
const sign =
|
|
20684
|
+
const sign = React55.useCallback(
|
|
20714
20685
|
async (hash32Hex, opts = {}) => {
|
|
20715
20686
|
if (!user) throw new Error("useGenericSigner: no authenticated user");
|
|
20716
20687
|
const selection = opts.keySelection ?? { mode: "default" };
|
|
@@ -20777,10 +20748,10 @@ function PhoneVerification({
|
|
|
20777
20748
|
readOnly = false,
|
|
20778
20749
|
valueClassName
|
|
20779
20750
|
}) {
|
|
20780
|
-
const [phone, setPhone] =
|
|
20781
|
-
const [editing, setEditing] =
|
|
20782
|
-
const [saving, setSaving] =
|
|
20783
|
-
const [error, setError] =
|
|
20751
|
+
const [phone, setPhone] = React55.useState(profile.phone_e164 ?? "");
|
|
20752
|
+
const [editing, setEditing] = React55.useState(!profile.phone_e164);
|
|
20753
|
+
const [saving, setSaving] = React55.useState(false);
|
|
20754
|
+
const [error, setError] = React55.useState(null);
|
|
20784
20755
|
async function save() {
|
|
20785
20756
|
if (!isValidE164(phone)) {
|
|
20786
20757
|
setError("Please enter a phone number in E.164 format (e.g. +14155550101).");
|
|
@@ -20908,10 +20879,10 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20908
20879
|
...propClassNames ?? {}
|
|
20909
20880
|
});
|
|
20910
20881
|
const { isLoading: configLoading } = useProviderConfig();
|
|
20911
|
-
const [profile, setProfile] =
|
|
20912
|
-
const [loading, setLoading] =
|
|
20913
|
-
const [topError, setTopError] =
|
|
20914
|
-
|
|
20882
|
+
const [profile, setProfile] = React55.useState(null);
|
|
20883
|
+
const [loading, setLoading] = React55.useState(true);
|
|
20884
|
+
const [topError, setTopError] = React55.useState(null);
|
|
20885
|
+
React55.useEffect(() => {
|
|
20915
20886
|
let cancelled = false;
|
|
20916
20887
|
(async () => {
|
|
20917
20888
|
try {
|
|
@@ -20956,13 +20927,13 @@ function Profile({ classNames: propClassNames } = {}) {
|
|
|
20956
20927
|
] });
|
|
20957
20928
|
}
|
|
20958
20929
|
var IdentitySection = ({ profile, onSaved, classNames }) => {
|
|
20959
|
-
const [displayName, setDisplayName] =
|
|
20930
|
+
const [displayName, setDisplayName] = React55.useState(
|
|
20960
20931
|
profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name
|
|
20961
20932
|
);
|
|
20962
|
-
const [avatarChoice, setAvatarChoice] =
|
|
20963
|
-
const [avatarUrl, setAvatarUrl] =
|
|
20964
|
-
const [busy, setBusy] =
|
|
20965
|
-
const [err, setErr] =
|
|
20933
|
+
const [avatarChoice, setAvatarChoice] = React55.useState(profile.avatar_choice);
|
|
20934
|
+
const [avatarUrl, setAvatarUrl] = React55.useState(profile.avatar_url);
|
|
20935
|
+
const [busy, setBusy] = React55.useState(false);
|
|
20936
|
+
const [err, setErr] = React55.useState(null);
|
|
20966
20937
|
const [saved, flashSaved] = useSavedFlash();
|
|
20967
20938
|
const dirty = displayName !== (profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name) || avatarChoice !== profile.avatar_choice || (avatarUrl ?? "") !== (profile.avatar_url ?? "");
|
|
20968
20939
|
async function save() {
|
|
@@ -21203,12 +21174,12 @@ var SaveButton = ({ onClick, busy, disabled, saved = false, classNames }) => /*
|
|
|
21203
21174
|
}
|
|
21204
21175
|
);
|
|
21205
21176
|
function useSavedFlash(ms = 1800) {
|
|
21206
|
-
const [saved, setSaved] =
|
|
21207
|
-
const timer =
|
|
21208
|
-
|
|
21177
|
+
const [saved, setSaved] = React55.useState(false);
|
|
21178
|
+
const timer = React55__default.default.useRef(null);
|
|
21179
|
+
React55.useEffect(() => () => {
|
|
21209
21180
|
if (timer.current) clearTimeout(timer.current);
|
|
21210
21181
|
}, []);
|
|
21211
|
-
const flash =
|
|
21182
|
+
const flash = React55__default.default.useCallback(() => {
|
|
21212
21183
|
setSaved(true);
|
|
21213
21184
|
if (timer.current) clearTimeout(timer.current);
|
|
21214
21185
|
timer.current = setTimeout(() => setSaved(false), ms);
|
|
@@ -21477,14 +21448,14 @@ function isEoaKey(key) {
|
|
|
21477
21448
|
function useKeyBalance(handle, options = {}) {
|
|
21478
21449
|
const { pollIntervalMs = 15e3, enabled = true } = options;
|
|
21479
21450
|
const { request } = useWalletSigner();
|
|
21480
|
-
const [wei, setWei] =
|
|
21481
|
-
const [loading, setLoading] =
|
|
21482
|
-
const [error, setError] =
|
|
21483
|
-
const requestRef =
|
|
21451
|
+
const [wei, setWei] = React55.useState(null);
|
|
21452
|
+
const [loading, setLoading] = React55.useState(false);
|
|
21453
|
+
const [error, setError] = React55.useState(null);
|
|
21454
|
+
const requestRef = React55.useRef(request);
|
|
21484
21455
|
requestRef.current = request;
|
|
21485
|
-
const handleRef =
|
|
21456
|
+
const handleRef = React55.useRef(handle);
|
|
21486
21457
|
handleRef.current = handle;
|
|
21487
|
-
const fetchOnce =
|
|
21458
|
+
const fetchOnce = React55.useCallback(async () => {
|
|
21488
21459
|
const h = handleRef.current;
|
|
21489
21460
|
if (!h) {
|
|
21490
21461
|
setWei(null);
|
|
@@ -21504,7 +21475,7 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21504
21475
|
setLoading(false);
|
|
21505
21476
|
}
|
|
21506
21477
|
}, []);
|
|
21507
|
-
|
|
21478
|
+
React55.useEffect(() => {
|
|
21508
21479
|
if (!enabled || !handle) {
|
|
21509
21480
|
setWei(null);
|
|
21510
21481
|
setError(null);
|
|
@@ -21522,17 +21493,17 @@ function useKeyBalance(handle, options = {}) {
|
|
|
21522
21493
|
function useEoaSend(handle, options = {}) {
|
|
21523
21494
|
const { timeoutMs = 9e4, pollIntervalMs = 3e3, onConfirmed } = options;
|
|
21524
21495
|
const { sendTransaction, request } = useWalletSigner();
|
|
21525
|
-
const [status, setStatus] =
|
|
21526
|
-
const [txHash, setTxHash] =
|
|
21527
|
-
const [error, setError] =
|
|
21528
|
-
const abortRef =
|
|
21529
|
-
const reset =
|
|
21496
|
+
const [status, setStatus] = React55.useState("idle");
|
|
21497
|
+
const [txHash, setTxHash] = React55.useState(null);
|
|
21498
|
+
const [error, setError] = React55.useState(null);
|
|
21499
|
+
const abortRef = React55.useRef(false);
|
|
21500
|
+
const reset = React55.useCallback(() => {
|
|
21530
21501
|
abortRef.current = true;
|
|
21531
21502
|
setStatus("idle");
|
|
21532
21503
|
setTxHash(null);
|
|
21533
21504
|
setError(null);
|
|
21534
21505
|
}, []);
|
|
21535
|
-
const send =
|
|
21506
|
+
const send = React55.useCallback(
|
|
21536
21507
|
async (input) => {
|
|
21537
21508
|
if (!handle) {
|
|
21538
21509
|
setError("No EOA selected.");
|
|
@@ -21623,14 +21594,14 @@ var SendFromKey = ({
|
|
|
21623
21594
|
maxWei,
|
|
21624
21595
|
onClose
|
|
21625
21596
|
}) => {
|
|
21626
|
-
const [to, setTo] =
|
|
21627
|
-
const [amount, setAmount] =
|
|
21597
|
+
const [to, setTo] = React55.useState("");
|
|
21598
|
+
const [amount, setAmount] = React55.useState("");
|
|
21628
21599
|
const { status, txHash, error, send, reset } = useEoaSend(handle, {
|
|
21629
21600
|
onConfirmed: () => {
|
|
21630
21601
|
}
|
|
21631
21602
|
});
|
|
21632
21603
|
const toValid = ADDRESS_RE2.test(to);
|
|
21633
|
-
const amountValid =
|
|
21604
|
+
const amountValid = React55.useMemo(() => {
|
|
21634
21605
|
if (!amount) return false;
|
|
21635
21606
|
if (!/^\d*\.?\d*$/.test(amount.trim())) return false;
|
|
21636
21607
|
return Number(amount) > 0;
|
|
@@ -21855,7 +21826,7 @@ var KeyBalances = ({
|
|
|
21855
21826
|
}) => {
|
|
21856
21827
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
21857
21828
|
const classNames = { ...configuredClassNames ?? {}, ...propClassNames ?? {} };
|
|
21858
|
-
const [sendOpen, setSendOpen] =
|
|
21829
|
+
const [sendOpen, setSendOpen] = React55.useState(false);
|
|
21859
21830
|
const { wei, loading, error } = useKeyBalance(handle);
|
|
21860
21831
|
const formatted = wei === null ? null : formatUnits(wei, 18, 6);
|
|
21861
21832
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -21905,13 +21876,13 @@ var ChangePasswordModal = ({
|
|
|
21905
21876
|
onClose,
|
|
21906
21877
|
onChanged
|
|
21907
21878
|
}) => {
|
|
21908
|
-
const [current, setCurrent] =
|
|
21909
|
-
const [next, setNext] =
|
|
21910
|
-
const [confirm, setConfirm] =
|
|
21911
|
-
const [submitting, setSubmitting] =
|
|
21912
|
-
const [serverError, setServerError] =
|
|
21913
|
-
const [success, setSuccess] =
|
|
21914
|
-
const issues =
|
|
21879
|
+
const [current, setCurrent] = React55.useState("");
|
|
21880
|
+
const [next, setNext] = React55.useState("");
|
|
21881
|
+
const [confirm, setConfirm] = React55.useState("");
|
|
21882
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
21883
|
+
const [serverError, setServerError] = React55.useState(null);
|
|
21884
|
+
const [success, setSuccess] = React55.useState(false);
|
|
21885
|
+
const issues = React55.useMemo(() => {
|
|
21915
21886
|
const out = [];
|
|
21916
21887
|
if (!current) out.push({ field: "current", message: "Required." });
|
|
21917
21888
|
if (!next) {
|
|
@@ -22074,7 +22045,7 @@ function PasswordField({
|
|
|
22074
22045
|
autoComplete,
|
|
22075
22046
|
autoFocus
|
|
22076
22047
|
}) {
|
|
22077
|
-
const [reveal, setReveal] =
|
|
22048
|
+
const [reveal, setReveal] = React55.useState(false);
|
|
22078
22049
|
const touched = value.length > 0;
|
|
22079
22050
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
22080
22051
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-[10px] uppercase tracking-wide text-text-muted", children: label }),
|
|
@@ -22204,32 +22175,32 @@ function SecurityPage() {
|
|
|
22204
22175
|
const configuredClassNames = useWalletConfig().ui?.security;
|
|
22205
22176
|
const classNames = resolveSecurityClasses(configuredClassNames);
|
|
22206
22177
|
const navigate = useWalletNavigate();
|
|
22207
|
-
const [keys, setKeys] =
|
|
22208
|
-
const [loading, setLoading] =
|
|
22209
|
-
const [error, setError] =
|
|
22210
|
-
const [info, setInfo] =
|
|
22211
|
-
const [showAdvanced, setShowAdvanced] =
|
|
22212
|
-
const [lockdown, setLockdown] =
|
|
22213
|
-
const [busy, setBusy] =
|
|
22214
|
-
const [rotateTarget, setRotateTarget] =
|
|
22215
|
-
const [rotateNewKind, setRotateNewKind] =
|
|
22216
|
-
const [rotateStep, setRotateStep] =
|
|
22217
|
-
const [rotateNewAddress, setRotateNewAddress] =
|
|
22218
|
-
const [rotateNewKeyId, setRotateNewKeyId] =
|
|
22219
|
-
const [rotateAccount, setRotateAccount] =
|
|
22220
|
-
const [rotateAddStatus, setRotateAddStatus] =
|
|
22221
|
-
const [rotateOperationMessageId, setRotateOperationMessageId] =
|
|
22222
|
-
const [passwordModalOpen, setPasswordModalOpen] =
|
|
22223
|
-
const [editingLabelKeyId, setEditingLabelKeyId] =
|
|
22224
|
-
const [labelDraft, setLabelDraft] =
|
|
22225
|
-
const [apiKeys, setApiKeys] =
|
|
22226
|
-
const [apiKeysLoading, setApiKeysLoading] =
|
|
22227
|
-
const [generateOpen, setGenerateOpen] =
|
|
22228
|
-
const [generateName, setGenerateName] =
|
|
22229
|
-
const [generateDescription, setGenerateDescription] =
|
|
22230
|
-
const [freshApiKey, setFreshApiKey] =
|
|
22231
|
-
const [freshApiKeyCopied, setFreshApiKeyCopied] =
|
|
22232
|
-
const refresh =
|
|
22178
|
+
const [keys, setKeys] = React55.useState([]);
|
|
22179
|
+
const [loading, setLoading] = React55.useState(true);
|
|
22180
|
+
const [error, setError] = React55.useState(null);
|
|
22181
|
+
const [info, setInfo] = React55.useState(null);
|
|
22182
|
+
const [showAdvanced, setShowAdvanced] = React55.useState(false);
|
|
22183
|
+
const [lockdown, setLockdown] = React55.useState(null);
|
|
22184
|
+
const [busy, setBusy] = React55.useState(null);
|
|
22185
|
+
const [rotateTarget, setRotateTarget] = React55.useState(null);
|
|
22186
|
+
const [rotateNewKind, setRotateNewKind] = React55.useState(null);
|
|
22187
|
+
const [rotateStep, setRotateStep] = React55.useState("pick");
|
|
22188
|
+
const [rotateNewAddress, setRotateNewAddress] = React55.useState(null);
|
|
22189
|
+
const [rotateNewKeyId, setRotateNewKeyId] = React55.useState(null);
|
|
22190
|
+
const [rotateAccount, setRotateAccount] = React55.useState(null);
|
|
22191
|
+
const [rotateAddStatus, setRotateAddStatus] = React55.useState(null);
|
|
22192
|
+
const [rotateOperationMessageId, setRotateOperationMessageId] = React55.useState(null);
|
|
22193
|
+
const [passwordModalOpen, setPasswordModalOpen] = React55.useState(false);
|
|
22194
|
+
const [editingLabelKeyId, setEditingLabelKeyId] = React55.useState(null);
|
|
22195
|
+
const [labelDraft, setLabelDraft] = React55.useState("");
|
|
22196
|
+
const [apiKeys, setApiKeys] = React55.useState([]);
|
|
22197
|
+
const [apiKeysLoading, setApiKeysLoading] = React55.useState(true);
|
|
22198
|
+
const [generateOpen, setGenerateOpen] = React55.useState(false);
|
|
22199
|
+
const [generateName, setGenerateName] = React55.useState("");
|
|
22200
|
+
const [generateDescription, setGenerateDescription] = React55.useState("");
|
|
22201
|
+
const [freshApiKey, setFreshApiKey] = React55.useState(null);
|
|
22202
|
+
const [freshApiKeyCopied, setFreshApiKeyCopied] = React55.useState(false);
|
|
22203
|
+
const refresh = React55.useCallback(async (opts) => {
|
|
22233
22204
|
setError(null);
|
|
22234
22205
|
try {
|
|
22235
22206
|
if (opts?.invalidate !== false) invalidateWalletCount();
|
|
@@ -22245,10 +22216,10 @@ function SecurityPage() {
|
|
|
22245
22216
|
setLoading(false);
|
|
22246
22217
|
}
|
|
22247
22218
|
}, []);
|
|
22248
|
-
|
|
22219
|
+
React55.useEffect(() => {
|
|
22249
22220
|
void refresh({ invalidate: false });
|
|
22250
22221
|
}, [refresh]);
|
|
22251
|
-
const refreshApiKeys =
|
|
22222
|
+
const refreshApiKeys = React55.useCallback(async () => {
|
|
22252
22223
|
try {
|
|
22253
22224
|
const list = await apiKeysService.list();
|
|
22254
22225
|
setApiKeys(list);
|
|
@@ -22258,7 +22229,7 @@ function SecurityPage() {
|
|
|
22258
22229
|
setApiKeysLoading(false);
|
|
22259
22230
|
}
|
|
22260
22231
|
}, []);
|
|
22261
|
-
|
|
22232
|
+
React55.useEffect(() => {
|
|
22262
22233
|
refreshApiKeys();
|
|
22263
22234
|
}, [refreshApiKeys]);
|
|
22264
22235
|
const userControlledCount = keys.length;
|
|
@@ -23542,42 +23513,42 @@ var GroupsView = ({
|
|
|
23542
23513
|
clearDelegationToken,
|
|
23543
23514
|
user
|
|
23544
23515
|
} = useAuthContext();
|
|
23545
|
-
const [busyId, setBusyId] =
|
|
23546
|
-
const [error, setError] =
|
|
23547
|
-
const [refreshing, setRefreshing] =
|
|
23548
|
-
const [creating, setCreating] =
|
|
23549
|
-
const [createOpen, setCreateOpen] =
|
|
23550
|
-
const [newGroupName, setNewGroupName] =
|
|
23551
|
-
const [newGroupDescription, setNewGroupDescription] =
|
|
23552
|
-
const [newGroupType, setNewGroupType] =
|
|
23553
|
-
const [newGroupLegalEntity, setNewGroupLegalEntity] =
|
|
23554
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
23555
|
-
const [ownedGroups, setOwnedGroups] =
|
|
23556
|
-
const [ownedGroupsLoading, setOwnedGroupsLoading] =
|
|
23557
|
-
const [ownedGroupsError, setOwnedGroupsError] =
|
|
23558
|
-
const [activeOwnedGroup, setActiveOwnedGroup] =
|
|
23559
|
-
const [operatorKeys, setOperatorKeys] =
|
|
23560
|
-
const [operatorKeysLoading, setOperatorKeysLoading] =
|
|
23561
|
-
const [selectedOperatorKeyId, setSelectedOperatorKeyId] =
|
|
23562
|
-
const [relationshipChildGroupId, setRelationshipChildGroupId] =
|
|
23563
|
-
const [relationshipAdvancing, setRelationshipAdvancing] =
|
|
23564
|
-
const [relationshipProgress, setRelationshipProgress] =
|
|
23516
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
23517
|
+
const [error, setError] = React55.useState(null);
|
|
23518
|
+
const [refreshing, setRefreshing] = React55.useState(false);
|
|
23519
|
+
const [creating, setCreating] = React55.useState(false);
|
|
23520
|
+
const [createOpen, setCreateOpen] = React55.useState(false);
|
|
23521
|
+
const [newGroupName, setNewGroupName] = React55.useState("");
|
|
23522
|
+
const [newGroupDescription, setNewGroupDescription] = React55.useState("");
|
|
23523
|
+
const [newGroupType, setNewGroupType] = React55.useState("Team");
|
|
23524
|
+
const [newGroupLegalEntity, setNewGroupLegalEntity] = React55.useState(false);
|
|
23525
|
+
const [selectedGroupId, setSelectedGroupId] = React55.useState(null);
|
|
23526
|
+
const [ownedGroups, setOwnedGroups] = React55.useState([]);
|
|
23527
|
+
const [ownedGroupsLoading, setOwnedGroupsLoading] = React55.useState(false);
|
|
23528
|
+
const [ownedGroupsError, setOwnedGroupsError] = React55.useState(null);
|
|
23529
|
+
const [activeOwnedGroup, setActiveOwnedGroup] = React55.useState(null);
|
|
23530
|
+
const [operatorKeys, setOperatorKeys] = React55.useState([]);
|
|
23531
|
+
const [operatorKeysLoading, setOperatorKeysLoading] = React55.useState(false);
|
|
23532
|
+
const [selectedOperatorKeyId, setSelectedOperatorKeyId] = React55.useState("");
|
|
23533
|
+
const [relationshipChildGroupId, setRelationshipChildGroupId] = React55.useState("");
|
|
23534
|
+
const [relationshipAdvancing, setRelationshipAdvancing] = React55.useState(false);
|
|
23535
|
+
const [relationshipProgress, setRelationshipProgress] = React55.useState(null);
|
|
23565
23536
|
const actingAsAnyGroup = !!delegationToken;
|
|
23566
|
-
const selectedGroup =
|
|
23537
|
+
const selectedGroup = React55.useMemo(
|
|
23567
23538
|
() => groups.find((group) => group.id === selectedGroupId) ?? null,
|
|
23568
23539
|
[groups, selectedGroupId]
|
|
23569
23540
|
);
|
|
23570
23541
|
const sourceGroupId = delegationSession?.kind === "owned" ? delegationSession.parentGroupId : delegationSession?.currentGroupId ?? null;
|
|
23571
|
-
const sourceGroup =
|
|
23542
|
+
const sourceGroup = React55.useMemo(
|
|
23572
23543
|
() => groups.find((group) => group.id === sourceGroupId) ?? null,
|
|
23573
23544
|
[groups, sourceGroupId]
|
|
23574
23545
|
);
|
|
23575
23546
|
const canAdvanceRelationshipAsParent = sourceGroup?.role === "owner";
|
|
23576
|
-
|
|
23547
|
+
React55.useEffect(() => {
|
|
23577
23548
|
setRelationshipChildGroupId("");
|
|
23578
23549
|
setRelationshipProgress(null);
|
|
23579
23550
|
}, [delegationSession?.kind, delegationSession?.currentGroupId]);
|
|
23580
|
-
|
|
23551
|
+
React55.useEffect(() => {
|
|
23581
23552
|
let cancelled = false;
|
|
23582
23553
|
if (!delegationToken || delegationSession?.kind !== "direct") {
|
|
23583
23554
|
setOwnedGroups([]);
|
|
@@ -23605,7 +23576,7 @@ var GroupsView = ({
|
|
|
23605
23576
|
cancelled = true;
|
|
23606
23577
|
};
|
|
23607
23578
|
}, [delegationSession, delegationToken]);
|
|
23608
|
-
|
|
23579
|
+
React55.useEffect(() => {
|
|
23609
23580
|
let cancelled = false;
|
|
23610
23581
|
if (delegationSession?.kind !== "direct" || !user?.id) {
|
|
23611
23582
|
setOperatorKeys([]);
|
|
@@ -23642,7 +23613,7 @@ var GroupsView = ({
|
|
|
23642
23613
|
cancelled = true;
|
|
23643
23614
|
};
|
|
23644
23615
|
}, [delegationSession, user?.id]);
|
|
23645
|
-
|
|
23616
|
+
React55.useEffect(() => {
|
|
23646
23617
|
let cancelled = false;
|
|
23647
23618
|
if (!delegationToken || delegationSession?.kind !== "owned") {
|
|
23648
23619
|
setActiveOwnedGroup(null);
|
|
@@ -24392,22 +24363,22 @@ function GroupDetailView({
|
|
|
24392
24363
|
onOpenBilling,
|
|
24393
24364
|
onRefreshed
|
|
24394
24365
|
}) {
|
|
24395
|
-
const [details, setDetails] =
|
|
24396
|
-
const [accountStatus, setAccountStatus] =
|
|
24397
|
-
const [members, setMembers] =
|
|
24398
|
-
const [loading, setLoading] =
|
|
24399
|
-
const [membersLoading, setMembersLoading] =
|
|
24400
|
-
const [error, setError] =
|
|
24401
|
-
const [showAddMember, setShowAddMember] =
|
|
24402
|
-
const [newMemberId, setNewMemberId] =
|
|
24403
|
-
const [newMemberRole, setNewMemberRole] =
|
|
24404
|
-
const [editingMemberId, setEditingMemberId] =
|
|
24405
|
-
const [editingRole, setEditingRole] =
|
|
24406
|
-
const [submitting, setSubmitting] =
|
|
24407
|
-
const [deploying, setDeploying] =
|
|
24366
|
+
const [details, setDetails] = React55.useState(group);
|
|
24367
|
+
const [accountStatus, setAccountStatus] = React55.useState(null);
|
|
24368
|
+
const [members, setMembers] = React55.useState([]);
|
|
24369
|
+
const [loading, setLoading] = React55.useState(true);
|
|
24370
|
+
const [membersLoading, setMembersLoading] = React55.useState(true);
|
|
24371
|
+
const [error, setError] = React55.useState(null);
|
|
24372
|
+
const [showAddMember, setShowAddMember] = React55.useState(false);
|
|
24373
|
+
const [newMemberId, setNewMemberId] = React55.useState("");
|
|
24374
|
+
const [newMemberRole, setNewMemberRole] = React55.useState("member");
|
|
24375
|
+
const [editingMemberId, setEditingMemberId] = React55.useState(null);
|
|
24376
|
+
const [editingRole, setEditingRole] = React55.useState("member");
|
|
24377
|
+
const [submitting, setSubmitting] = React55.useState(false);
|
|
24378
|
+
const [deploying, setDeploying] = React55.useState(false);
|
|
24408
24379
|
const role = details.role ?? group.role ?? "member";
|
|
24409
24380
|
const canManageMembers = role === "owner" || role === "admin";
|
|
24410
|
-
const loadDetails =
|
|
24381
|
+
const loadDetails = React55.useCallback(async () => {
|
|
24411
24382
|
setLoading(true);
|
|
24412
24383
|
setMembersLoading(true);
|
|
24413
24384
|
setError(null);
|
|
@@ -24427,7 +24398,7 @@ function GroupDetailView({
|
|
|
24427
24398
|
setMembersLoading(false);
|
|
24428
24399
|
}
|
|
24429
24400
|
}, [group]);
|
|
24430
|
-
|
|
24401
|
+
React55.useEffect(() => {
|
|
24431
24402
|
setDetails(group);
|
|
24432
24403
|
void loadDetails();
|
|
24433
24404
|
}, [group, loadDetails]);
|
|
@@ -24961,17 +24932,17 @@ function ActiveEnvironmentBadge({
|
|
|
24961
24932
|
configuredTestChains
|
|
24962
24933
|
);
|
|
24963
24934
|
const canChoose = Boolean(activeChainId && options.length > 1);
|
|
24964
|
-
const [busyChainId, setBusyChainId] =
|
|
24965
|
-
const [pendingLiveChainId, setPendingLiveChainId] =
|
|
24966
|
-
const [error, setError] =
|
|
24967
|
-
const switchingRef =
|
|
24968
|
-
const confirmLiveRef =
|
|
24969
|
-
const liveWarningId =
|
|
24935
|
+
const [busyChainId, setBusyChainId] = React55__default.default.useState(null);
|
|
24936
|
+
const [pendingLiveChainId, setPendingLiveChainId] = React55__default.default.useState(null);
|
|
24937
|
+
const [error, setError] = React55__default.default.useState(null);
|
|
24938
|
+
const switchingRef = React55__default.default.useRef(false);
|
|
24939
|
+
const confirmLiveRef = React55__default.default.useRef(null);
|
|
24940
|
+
const liveWarningId = React55__default.default.useId();
|
|
24970
24941
|
const label = modeLabel(environment.mode);
|
|
24971
24942
|
const modeCounts = { test: 0, live: 0, unknown: 0 };
|
|
24972
24943
|
for (const option of options) modeCounts[option.mode] += 1;
|
|
24973
24944
|
const pendingLive = options.find((option) => option.chainId === pendingLiveChainId) ?? null;
|
|
24974
|
-
|
|
24945
|
+
React55__default.default.useEffect(() => {
|
|
24975
24946
|
if (pendingLiveChainId) confirmLiveRef.current?.focus();
|
|
24976
24947
|
}, [pendingLiveChainId]);
|
|
24977
24948
|
async function switchTo(option) {
|
|
@@ -25242,26 +25213,26 @@ var WalletCenterSurface = ({
|
|
|
25242
25213
|
} = useAuthContext();
|
|
25243
25214
|
const walletConfig = useWalletConfig();
|
|
25244
25215
|
const walletCenterUi = walletConfig.ui?.walletCenter;
|
|
25245
|
-
const [section, setSection] =
|
|
25246
|
-
const [historyFilter, setHistoryFilter] =
|
|
25247
|
-
const [historyItems, setHistoryItems] =
|
|
25248
|
-
const [historyOffset, setHistoryOffset] =
|
|
25249
|
-
const [historyHasMore, setHistoryHasMore] =
|
|
25250
|
-
const [historyLoading, setHistoryLoading] =
|
|
25251
|
-
const [historyError, setHistoryError] =
|
|
25252
|
-
const [historyLoadedOnce, setHistoryLoadedOnce] =
|
|
25253
|
-
const [selected, setSelected] =
|
|
25254
|
-
const [selectedSource, setSelectedSource] =
|
|
25255
|
-
const [busyId, setBusyId] =
|
|
25256
|
-
const [actionError, setActionError] =
|
|
25257
|
-
const cancelGuardRef =
|
|
25258
|
-
const wasOpenRef =
|
|
25259
|
-
const walletRootRef =
|
|
25260
|
-
const leaveSection =
|
|
25216
|
+
const [section, setSection] = React55.useState("menu");
|
|
25217
|
+
const [historyFilter, setHistoryFilter] = React55.useState("all");
|
|
25218
|
+
const [historyItems, setHistoryItems] = React55.useState([]);
|
|
25219
|
+
const [historyOffset, setHistoryOffset] = React55.useState(0);
|
|
25220
|
+
const [historyHasMore, setHistoryHasMore] = React55.useState(false);
|
|
25221
|
+
const [historyLoading, setHistoryLoading] = React55.useState(false);
|
|
25222
|
+
const [historyError, setHistoryError] = React55.useState(null);
|
|
25223
|
+
const [historyLoadedOnce, setHistoryLoadedOnce] = React55.useState(false);
|
|
25224
|
+
const [selected, setSelected] = React55.useState(null);
|
|
25225
|
+
const [selectedSource, setSelectedSource] = React55.useState("pending");
|
|
25226
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
25227
|
+
const [actionError, setActionError] = React55.useState(null);
|
|
25228
|
+
const cancelGuardRef = React55.useRef(/* @__PURE__ */ new Map());
|
|
25229
|
+
const wasOpenRef = React55.useRef(false);
|
|
25230
|
+
const walletRootRef = React55.useRef(null);
|
|
25231
|
+
const leaveSection = React55.useCallback(() => {
|
|
25261
25232
|
if (embedded && initialView !== "menu") onClose();
|
|
25262
25233
|
else setSection("menu");
|
|
25263
25234
|
}, [embedded, initialView, onClose]);
|
|
25264
|
-
|
|
25235
|
+
React55.useEffect(() => {
|
|
25265
25236
|
const justOpened = isOpen && !wasOpenRef.current;
|
|
25266
25237
|
wasOpenRef.current = isOpen;
|
|
25267
25238
|
if (!justOpened) return;
|
|
@@ -25275,24 +25246,24 @@ var WalletCenterSurface = ({
|
|
|
25275
25246
|
setHistoryHasMore(false);
|
|
25276
25247
|
setHistoryLoadedOnce(false);
|
|
25277
25248
|
}, [initialView, isOpen, refreshPending]);
|
|
25278
|
-
|
|
25249
|
+
React55.useEffect(() => {
|
|
25279
25250
|
if (!isOpen) return;
|
|
25280
25251
|
if (activeBuiltinFor(section, modules) === "transactions" && pendingList.length === 0) {
|
|
25281
25252
|
leaveSection();
|
|
25282
25253
|
}
|
|
25283
25254
|
}, [isOpen, leaveSection, modules, pendingList.length, section]);
|
|
25284
|
-
const delegatedGroupId =
|
|
25255
|
+
const delegatedGroupId = React55.useMemo(() => {
|
|
25285
25256
|
if (!delegationToken || typeof window === "undefined") return null;
|
|
25286
25257
|
return window.localStorage.getItem("delegation_group_id");
|
|
25287
25258
|
}, [delegationToken]);
|
|
25288
|
-
const configuredModules =
|
|
25259
|
+
const configuredModules = React55.useMemo(() => {
|
|
25289
25260
|
return validateWalletCenterModules(modules ?? defaultWalletCenterModules());
|
|
25290
25261
|
}, [modules]);
|
|
25291
|
-
const runtime =
|
|
25262
|
+
const runtime = React55.useMemo(
|
|
25292
25263
|
() => ({ pendingCount: pendingList.length, isAuthenticated: !!user }),
|
|
25293
25264
|
[pendingList.length, user]
|
|
25294
25265
|
);
|
|
25295
|
-
const visibleModules =
|
|
25266
|
+
const visibleModules = React55.useMemo(
|
|
25296
25267
|
() => configuredModules.filter((module) => {
|
|
25297
25268
|
if (module.kind === "builtin" && module.builtin === "transactions" && pendingList.length === 0) {
|
|
25298
25269
|
return false;
|
|
@@ -25301,16 +25272,16 @@ var WalletCenterSurface = ({
|
|
|
25301
25272
|
}),
|
|
25302
25273
|
[configuredModules, pendingList.length, runtime]
|
|
25303
25274
|
);
|
|
25304
|
-
const activeModule =
|
|
25275
|
+
const activeModule = React55.useMemo(
|
|
25305
25276
|
() => configuredModules.find((module) => module.id === section) ?? null,
|
|
25306
25277
|
[configuredModules, section]
|
|
25307
25278
|
);
|
|
25308
25279
|
const activeBuiltin = activeModule?.kind === "builtin" ? activeModule.builtin : null;
|
|
25309
|
-
const menuItems =
|
|
25280
|
+
const menuItems = React55.useMemo(
|
|
25310
25281
|
() => buildWalletMenuItems(visibleModules, runtime, groups.length),
|
|
25311
25282
|
[groups.length, runtime, visibleModules]
|
|
25312
25283
|
);
|
|
25313
|
-
|
|
25284
|
+
React55.useEffect(() => {
|
|
25314
25285
|
if (!isOpen) return;
|
|
25315
25286
|
const onVis = () => {
|
|
25316
25287
|
if (document.visibilityState === "visible") {
|
|
@@ -25320,11 +25291,11 @@ var WalletCenterSurface = ({
|
|
|
25320
25291
|
document.addEventListener("visibilitychange", onVis);
|
|
25321
25292
|
return () => document.removeEventListener("visibilitychange", onVis);
|
|
25322
25293
|
}, [isOpen, refreshPending]);
|
|
25323
|
-
|
|
25294
|
+
React55.useEffect(() => {
|
|
25324
25295
|
const scrollContainer = walletRootRef.current?.parentElement;
|
|
25325
25296
|
if (scrollContainer) scrollContainer.scrollTop = 0;
|
|
25326
25297
|
}, [section, selected]);
|
|
25327
|
-
const fetchHistory =
|
|
25298
|
+
const fetchHistory = React55.useCallback(
|
|
25328
25299
|
async (offset, append) => {
|
|
25329
25300
|
setHistoryLoading(true);
|
|
25330
25301
|
setHistoryError(null);
|
|
@@ -25347,7 +25318,7 @@ var WalletCenterSurface = ({
|
|
|
25347
25318
|
},
|
|
25348
25319
|
[userId]
|
|
25349
25320
|
);
|
|
25350
|
-
|
|
25321
|
+
React55.useEffect(() => {
|
|
25351
25322
|
if (!isOpen) return;
|
|
25352
25323
|
if (activeBuiltin !== "history") return;
|
|
25353
25324
|
if (historyLoadedOnce) return;
|
|
@@ -25362,7 +25333,7 @@ var WalletCenterSurface = ({
|
|
|
25362
25333
|
if (historyItems.length >= HISTORY_MAX_ITEMS) return;
|
|
25363
25334
|
void fetchHistory(historyOffset, true);
|
|
25364
25335
|
};
|
|
25365
|
-
const filteredHistoryItems =
|
|
25336
|
+
const filteredHistoryItems = React55.useMemo(() => {
|
|
25366
25337
|
if (historyFilter === "all") return historyItems;
|
|
25367
25338
|
const want = historyFilter === "Completed" /* Completed */ ? /* @__PURE__ */ new Set(["completed", "success"]) : historyFilter === "Failed" /* Failed */ ? /* @__PURE__ */ new Set(["failed", "error"]) : /* @__PURE__ */ new Set(["canceled", "cancelled"]);
|
|
25368
25339
|
return historyItems.filter(
|
|
@@ -25435,7 +25406,7 @@ var WalletCenterSurface = ({
|
|
|
25435
25406
|
setActionError(e?.message ?? "Failed to retry message.");
|
|
25436
25407
|
}
|
|
25437
25408
|
};
|
|
25438
|
-
const handleMenuActAsSelf =
|
|
25409
|
+
const handleMenuActAsSelf = React55.useCallback(async () => {
|
|
25439
25410
|
setActionError(null);
|
|
25440
25411
|
try {
|
|
25441
25412
|
clearDelegationToken();
|
|
@@ -25443,7 +25414,7 @@ var WalletCenterSurface = ({
|
|
|
25443
25414
|
setActionError(e?.message ?? "Failed to switch entity.");
|
|
25444
25415
|
}
|
|
25445
25416
|
}, [clearDelegationToken]);
|
|
25446
|
-
const handleMenuActAsGroup =
|
|
25417
|
+
const handleMenuActAsGroup = React55.useCallback(
|
|
25447
25418
|
async (group) => {
|
|
25448
25419
|
setActionError(null);
|
|
25449
25420
|
try {
|
|
@@ -25454,7 +25425,7 @@ var WalletCenterSurface = ({
|
|
|
25454
25425
|
},
|
|
25455
25426
|
[createDelegationToken]
|
|
25456
25427
|
);
|
|
25457
|
-
const handleSignOut =
|
|
25428
|
+
const handleSignOut = React55.useCallback(async () => {
|
|
25458
25429
|
setActionError(null);
|
|
25459
25430
|
try {
|
|
25460
25431
|
await logout();
|
|
@@ -25468,7 +25439,7 @@ var WalletCenterSurface = ({
|
|
|
25468
25439
|
setActionError(e?.message ?? "Failed to sign out.");
|
|
25469
25440
|
}
|
|
25470
25441
|
}, [logout, onClose, walletConfig]);
|
|
25471
|
-
const navigateFromCenter =
|
|
25442
|
+
const navigateFromCenter = React55.useCallback(
|
|
25472
25443
|
(href, options) => {
|
|
25473
25444
|
if (walletConfig.onNavigate) {
|
|
25474
25445
|
walletConfig.onNavigate(href, options);
|
|
@@ -25479,7 +25450,7 @@ var WalletCenterSurface = ({
|
|
|
25479
25450
|
},
|
|
25480
25451
|
[walletConfig]
|
|
25481
25452
|
);
|
|
25482
|
-
const panelContext =
|
|
25453
|
+
const panelContext = React55.useMemo(
|
|
25483
25454
|
() => ({
|
|
25484
25455
|
close: onClose,
|
|
25485
25456
|
back: () => setSection("menu"),
|
|
@@ -25490,7 +25461,7 @@ var WalletCenterSurface = ({
|
|
|
25490
25461
|
}),
|
|
25491
25462
|
[navigateFromCenter, onClose]
|
|
25492
25463
|
);
|
|
25493
|
-
const resolvedActors =
|
|
25464
|
+
const resolvedActors = React55.useMemo(() => {
|
|
25494
25465
|
if (actors) return actors;
|
|
25495
25466
|
return [
|
|
25496
25467
|
{
|
|
@@ -25517,7 +25488,7 @@ var WalletCenterSurface = ({
|
|
|
25517
25488
|
status: identity?.status ?? { label: "Online", color: "#4ade80" },
|
|
25518
25489
|
actions: identity?.actions ?? []
|
|
25519
25490
|
};
|
|
25520
|
-
const handleSelectModule =
|
|
25491
|
+
const handleSelectModule = React55.useCallback(
|
|
25521
25492
|
(module) => {
|
|
25522
25493
|
setActionError(null);
|
|
25523
25494
|
if (module.kind === "route") {
|
|
@@ -25529,7 +25500,7 @@ var WalletCenterSurface = ({
|
|
|
25529
25500
|
},
|
|
25530
25501
|
[navigateFromCenter, onClose]
|
|
25531
25502
|
);
|
|
25532
|
-
const handleSelectActor =
|
|
25503
|
+
const handleSelectActor = React55.useCallback(async (actor) => {
|
|
25533
25504
|
setActionError(null);
|
|
25534
25505
|
try {
|
|
25535
25506
|
await actor.onSelect();
|
|
@@ -25538,7 +25509,7 @@ var WalletCenterSurface = ({
|
|
|
25538
25509
|
setActionError(error?.message ?? "Failed to switch signing context.");
|
|
25539
25510
|
}
|
|
25540
25511
|
}, [leaveSection]);
|
|
25541
|
-
const drawerTitle =
|
|
25512
|
+
const drawerTitle = React55.useMemo(() => {
|
|
25542
25513
|
if (selected) {
|
|
25543
25514
|
const label = humanizeMessageType(selected.data?.message_type);
|
|
25544
25515
|
return selectedSource === "pending" ? `${label} \u2014 Sign` : label;
|
|
@@ -25546,7 +25517,7 @@ var WalletCenterSurface = ({
|
|
|
25546
25517
|
return "Wallet";
|
|
25547
25518
|
}, [selected, selectedSource]);
|
|
25548
25519
|
const hostedTitle = !embedded ? null : selected ? drawerTitle : section === "actors" ? "Signing context" : activeModule?.label ?? null;
|
|
25549
|
-
|
|
25520
|
+
React55.useEffect(() => {
|
|
25550
25521
|
if (!embedded) return void 0;
|
|
25551
25522
|
onTitle?.(hostedTitle);
|
|
25552
25523
|
return () => onTitle?.(null);
|
|
@@ -25731,7 +25702,7 @@ function WalletMenu({
|
|
|
25731
25702
|
const secondaryItems = items.filter((item) => item.placement === "secondary");
|
|
25732
25703
|
const activeActor = actors.find((actor) => actor.active) ?? actors[0];
|
|
25733
25704
|
const userName = identity.name ?? "You";
|
|
25734
|
-
const renderCard = (cardItems) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25705
|
+
const renderCard = (cardItems) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
25735
25706
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25736
25707
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25737
25708
|
WalletMenuRow,
|
|
@@ -25975,13 +25946,13 @@ function ActorsPane({
|
|
|
25975
25946
|
error,
|
|
25976
25947
|
onSelect
|
|
25977
25948
|
}) {
|
|
25978
|
-
const [busyId, setBusyId] =
|
|
25949
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
25979
25950
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [
|
|
25980
25951
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 text-[11px] leading-5 text-text-muted", children: "Choose the identity used for signing and entity-owned actions." }),
|
|
25981
25952
|
error && /* @__PURE__ */ jsxRuntime.jsx(ErrorBanner, { children: error }),
|
|
25982
25953
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[22px] border border-border-light bg-raised", children: actors.map((actor, index) => {
|
|
25983
25954
|
const ActorIcon = actor.icon;
|
|
25984
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25955
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React55__default.default.Fragment, { children: [
|
|
25985
25956
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
|
|
25986
25957
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25987
25958
|
"button",
|
|
@@ -26016,10 +25987,10 @@ function DirectoryPane({
|
|
|
26016
25987
|
module,
|
|
26017
25988
|
context
|
|
26018
25989
|
}) {
|
|
26019
|
-
const [query, setQuery] =
|
|
25990
|
+
const [query, setQuery] = React55.useState("");
|
|
26020
25991
|
const isMobile = useWalletCenterMobile();
|
|
26021
25992
|
const normalizedQuery = normalizeSearchText(query);
|
|
26022
|
-
const visibleGroups =
|
|
25993
|
+
const visibleGroups = React55.useMemo(
|
|
26023
25994
|
() => module.groups.filter((group) => {
|
|
26024
25995
|
if (!group.visibility || group.visibility === "always") return true;
|
|
26025
25996
|
return group.visibility === (isMobile ? "mobile" : "desktop");
|
|
@@ -26120,10 +26091,10 @@ function normalizeSearchText(value) {
|
|
|
26120
26091
|
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLocaleLowerCase();
|
|
26121
26092
|
}
|
|
26122
26093
|
function useWalletCenterMobile() {
|
|
26123
|
-
const [isMobile, setIsMobile] =
|
|
26094
|
+
const [isMobile, setIsMobile] = React55.useState(
|
|
26124
26095
|
() => typeof window !== "undefined" && window.matchMedia("(max-width: 639px)").matches
|
|
26125
26096
|
);
|
|
26126
|
-
|
|
26097
|
+
React55.useEffect(() => {
|
|
26127
26098
|
if (typeof window === "undefined") return;
|
|
26128
26099
|
const media = window.matchMedia("(max-width: 639px)");
|
|
26129
26100
|
const update = () => setIsMobile(media.matches);
|
|
@@ -26663,10 +26634,10 @@ function messageText(content) {
|
|
|
26663
26634
|
return JSON.stringify(content, null, 2);
|
|
26664
26635
|
}
|
|
26665
26636
|
var PromptTranscript = ({ usageEventId }) => {
|
|
26666
|
-
const [log, setLog] =
|
|
26667
|
-
const [note, setNote] =
|
|
26668
|
-
const [loading, setLoading] =
|
|
26669
|
-
|
|
26637
|
+
const [log, setLog] = React55.useState(null);
|
|
26638
|
+
const [note, setNote] = React55.useState(null);
|
|
26639
|
+
const [loading, setLoading] = React55.useState(true);
|
|
26640
|
+
React55.useEffect(() => {
|
|
26670
26641
|
let cancelled = false;
|
|
26671
26642
|
const base = getAgentsServiceUrl();
|
|
26672
26643
|
setLoading(true);
|
|
@@ -26831,13 +26802,13 @@ var LineItemsTable = ({
|
|
|
26831
26802
|
caption,
|
|
26832
26803
|
showActor
|
|
26833
26804
|
}) => {
|
|
26834
|
-
const [selected, setSelected] =
|
|
26835
|
-
const [gasPricing, setGasPricing] =
|
|
26805
|
+
const [selected, setSelected] = React55.useState(null);
|
|
26806
|
+
const [gasPricing, setGasPricing] = React55.useState(null);
|
|
26836
26807
|
const minuteRate = gasPricing?.agent_minute_usd ?? 0;
|
|
26837
|
-
|
|
26808
|
+
React55.useEffect(() => {
|
|
26838
26809
|
void exports.billingService.getGasPricing().then(setGasPricing);
|
|
26839
26810
|
}, []);
|
|
26840
|
-
const columns =
|
|
26811
|
+
const columns = React55.useMemo(
|
|
26841
26812
|
() => [
|
|
26842
26813
|
{
|
|
26843
26814
|
header: "When",
|
|
@@ -27096,12 +27067,12 @@ var BuyCreditsDialog = ({
|
|
|
27096
27067
|
source = "manual",
|
|
27097
27068
|
reason
|
|
27098
27069
|
}) => {
|
|
27099
|
-
const [stage, setStage] =
|
|
27100
|
-
const [attempt, setAttempt] =
|
|
27070
|
+
const [stage, setStage] = React55.useState({ kind: "loading" });
|
|
27071
|
+
const [attempt, setAttempt] = React55.useState(0);
|
|
27101
27072
|
const activeGate = creditGateInfoForActiveToken();
|
|
27102
27073
|
const effectiveReason = reason ?? activeGate.reason ?? void 0;
|
|
27103
27074
|
const effectiveGroupId = resolveBuyCreditsTargetGroupId(target, activeGate);
|
|
27104
|
-
|
|
27075
|
+
React55.useEffect(() => {
|
|
27105
27076
|
if (!isOpen) return;
|
|
27106
27077
|
let cancelled = false;
|
|
27107
27078
|
setStage({ kind: "loading" });
|
|
@@ -27140,7 +27111,7 @@ var BuyCreditsDialog = ({
|
|
|
27140
27111
|
cancelled = true;
|
|
27141
27112
|
};
|
|
27142
27113
|
}, [isOpen, effectiveGroupId, effectiveReason, target.kind, attempt]);
|
|
27143
|
-
const redirectTo =
|
|
27114
|
+
const redirectTo = React55.useCallback(
|
|
27144
27115
|
async (open) => {
|
|
27145
27116
|
setStage({ kind: "redirecting" });
|
|
27146
27117
|
try {
|
|
@@ -27159,7 +27130,7 @@ var BuyCreditsDialog = ({
|
|
|
27159
27130
|
},
|
|
27160
27131
|
[effectiveGroupId]
|
|
27161
27132
|
);
|
|
27162
|
-
const buyPlan =
|
|
27133
|
+
const buyPlan = React55.useCallback(
|
|
27163
27134
|
(planId) => {
|
|
27164
27135
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27165
27136
|
kind: "plan",
|
|
@@ -27176,7 +27147,7 @@ var BuyCreditsDialog = ({
|
|
|
27176
27147
|
},
|
|
27177
27148
|
[redirectTo, effectiveGroupId]
|
|
27178
27149
|
);
|
|
27179
|
-
const buyTopup =
|
|
27150
|
+
const buyTopup = React55.useCallback(
|
|
27180
27151
|
(topupId) => {
|
|
27181
27152
|
const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
|
|
27182
27153
|
kind: "topup",
|
|
@@ -27353,11 +27324,11 @@ var shareKindLabel = (share) => {
|
|
|
27353
27324
|
return KIND_LABELS[kind] ?? (share.entry_kind === "clawback" ? "Adjustment" : "Earnings");
|
|
27354
27325
|
};
|
|
27355
27326
|
var EarningsSection = ({ dense = false }) => {
|
|
27356
|
-
const [summary, setSummary] =
|
|
27357
|
-
const [loaded, setLoaded] =
|
|
27358
|
-
const [connectBusy, setConnectBusy] =
|
|
27359
|
-
const [error, setError] =
|
|
27360
|
-
const load =
|
|
27327
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27328
|
+
const [loaded, setLoaded] = React55.useState(false);
|
|
27329
|
+
const [connectBusy, setConnectBusy] = React55.useState(false);
|
|
27330
|
+
const [error, setError] = React55.useState(null);
|
|
27331
|
+
const load = React55.useCallback(async () => {
|
|
27361
27332
|
try {
|
|
27362
27333
|
const s = await exports.billingService.getMyEarnings();
|
|
27363
27334
|
setSummary(s);
|
|
@@ -27367,10 +27338,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27367
27338
|
setLoaded(true);
|
|
27368
27339
|
}
|
|
27369
27340
|
}, []);
|
|
27370
|
-
|
|
27341
|
+
React55.useEffect(() => {
|
|
27371
27342
|
void load();
|
|
27372
27343
|
}, [load]);
|
|
27373
|
-
const openConnectOnboarding =
|
|
27344
|
+
const openConnectOnboarding = React55.useCallback(async () => {
|
|
27374
27345
|
setConnectBusy(true);
|
|
27375
27346
|
setError(null);
|
|
27376
27347
|
try {
|
|
@@ -27482,10 +27453,10 @@ var EarningsSection = ({ dense = false }) => {
|
|
|
27482
27453
|
init_billingService();
|
|
27483
27454
|
init_creditCheckoutReturn();
|
|
27484
27455
|
var GroupBillingSection = ({ groupId }) => {
|
|
27485
|
-
const [summary, setSummary] =
|
|
27486
|
-
const [portalBusy, setPortalBusy] =
|
|
27487
|
-
const [portalError, setPortalError] =
|
|
27488
|
-
const openGroupPortal =
|
|
27456
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27457
|
+
const [portalBusy, setPortalBusy] = React55.useState(false);
|
|
27458
|
+
const [portalError, setPortalError] = React55.useState(null);
|
|
27459
|
+
const openGroupPortal = React55.useCallback(async () => {
|
|
27489
27460
|
setPortalBusy(true);
|
|
27490
27461
|
setPortalError(null);
|
|
27491
27462
|
try {
|
|
@@ -27501,21 +27472,21 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27501
27472
|
setPortalBusy(false);
|
|
27502
27473
|
}
|
|
27503
27474
|
}, [groupId]);
|
|
27504
|
-
const [pricing, setPricing] =
|
|
27505
|
-
const [items, setItems] =
|
|
27506
|
-
const [hasMore, setHasMore] =
|
|
27507
|
-
const [moreBusy, setMoreBusy] =
|
|
27508
|
-
const [loading, setLoading] =
|
|
27509
|
-
const [hidden, setHidden] =
|
|
27510
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27511
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27512
|
-
const [earnings, setEarnings] =
|
|
27513
|
-
const [reactivating, setReactivating] =
|
|
27514
|
-
const [reactivationError, setReactivationError] =
|
|
27515
|
-
|
|
27475
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
27476
|
+
const [items, setItems] = React55.useState([]);
|
|
27477
|
+
const [hasMore, setHasMore] = React55.useState(false);
|
|
27478
|
+
const [moreBusy, setMoreBusy] = React55.useState(false);
|
|
27479
|
+
const [loading, setLoading] = React55.useState(true);
|
|
27480
|
+
const [hidden, setHidden] = React55.useState(false);
|
|
27481
|
+
const [addCardOpen, setAddCardOpen] = React55.useState(false);
|
|
27482
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React55.useState(false);
|
|
27483
|
+
const [earnings, setEarnings] = React55.useState(null);
|
|
27484
|
+
const [reactivating, setReactivating] = React55.useState(false);
|
|
27485
|
+
const [reactivationError, setReactivationError] = React55.useState(null);
|
|
27486
|
+
React55.useEffect(() => {
|
|
27516
27487
|
void exports.billingService.getGasPricing().then(setPricing);
|
|
27517
27488
|
}, []);
|
|
27518
|
-
|
|
27489
|
+
React55.useEffect(() => {
|
|
27519
27490
|
let cancelled = false;
|
|
27520
27491
|
exports.billingService.getGroupEarnings(groupId).then((e) => {
|
|
27521
27492
|
if (!cancelled) setEarnings(e);
|
|
@@ -27525,7 +27496,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27525
27496
|
cancelled = true;
|
|
27526
27497
|
};
|
|
27527
27498
|
}, [groupId]);
|
|
27528
|
-
const load =
|
|
27499
|
+
const load = React55.useCallback(async () => {
|
|
27529
27500
|
setLoading(true);
|
|
27530
27501
|
try {
|
|
27531
27502
|
const s = await exports.billingService.getGroupBilling(groupId);
|
|
@@ -27538,10 +27509,10 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27538
27509
|
setLoading(false);
|
|
27539
27510
|
}
|
|
27540
27511
|
}, [groupId]);
|
|
27541
|
-
|
|
27512
|
+
React55.useEffect(() => {
|
|
27542
27513
|
void load();
|
|
27543
27514
|
}, [load]);
|
|
27544
|
-
|
|
27515
|
+
React55.useEffect(() => {
|
|
27545
27516
|
const reloadMatchingGroup = (event) => {
|
|
27546
27517
|
const detail = event.detail;
|
|
27547
27518
|
if (detail?.groupId === groupId) void load();
|
|
@@ -27549,7 +27520,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27549
27520
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27550
27521
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
|
|
27551
27522
|
}, [groupId, load]);
|
|
27552
|
-
const loadMore =
|
|
27523
|
+
const loadMore = React55.useCallback(async () => {
|
|
27553
27524
|
const last = items[items.length - 1];
|
|
27554
27525
|
if (!last || moreBusy) return;
|
|
27555
27526
|
setMoreBusy(true);
|
|
@@ -27566,7 +27537,7 @@ var GroupBillingSection = ({ groupId }) => {
|
|
|
27566
27537
|
setMoreBusy(false);
|
|
27567
27538
|
}
|
|
27568
27539
|
}, [groupId, items, moreBusy]);
|
|
27569
|
-
const reactivate =
|
|
27540
|
+
const reactivate = React55.useCallback(async () => {
|
|
27570
27541
|
setReactivating(true);
|
|
27571
27542
|
setReactivationError(null);
|
|
27572
27543
|
try {
|
|
@@ -27785,8 +27756,8 @@ var SeriesLine = ({
|
|
|
27785
27756
|
formatUsdMicros(Math.round(usd2 * 1e6))
|
|
27786
27757
|
] });
|
|
27787
27758
|
var DailySpendChart = ({ summary }) => {
|
|
27788
|
-
const [hovered, setHovered] =
|
|
27789
|
-
const rows =
|
|
27759
|
+
const [hovered, setHovered] = React55.useState(null);
|
|
27760
|
+
const rows = React55.useMemo(() => {
|
|
27790
27761
|
const byDay = /* @__PURE__ */ new Map();
|
|
27791
27762
|
for (const p of summary.daily ?? []) {
|
|
27792
27763
|
const parsed = new Date(p.day);
|
|
@@ -27894,7 +27865,7 @@ var BTN = "inline-flex h-8 shrink-0 items-center rounded-md border border-border
|
|
|
27894
27865
|
var BTN_STRONG = "inline-flex h-8 shrink-0 items-center rounded-md border border-border-default bg-surface px-3 text-[12px] font-medium text-text-primary transition-colors hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50";
|
|
27895
27866
|
var METER_TRACK = "h-1 overflow-hidden rounded-full bg-raised";
|
|
27896
27867
|
var BreakdownCard = ({ title, rows, color, minuteRate, labelFor: labelFor2, countNoun }) => {
|
|
27897
|
-
const displayRows =
|
|
27868
|
+
const displayRows = React55.useMemo(() => {
|
|
27898
27869
|
if (!labelFor2) return rows;
|
|
27899
27870
|
const merged = /* @__PURE__ */ new Map();
|
|
27900
27871
|
for (const r of rows) {
|
|
@@ -27957,27 +27928,28 @@ var Banner = ({
|
|
|
27957
27928
|
);
|
|
27958
27929
|
};
|
|
27959
27930
|
var BillingCenter = ({ dense = false }) => {
|
|
27960
|
-
const [summary, setSummary] =
|
|
27961
|
-
const [pricing, setPricing] =
|
|
27962
|
-
const [items, setItems] =
|
|
27963
|
-
const [hasMore, setHasMore] =
|
|
27964
|
-
const [moreBusy, setMoreBusy] =
|
|
27965
|
-
const [expandedGroup, setExpandedGroup] =
|
|
27966
|
-
const [notConfigured, setNotConfigured] =
|
|
27967
|
-
const [loading, setLoading] =
|
|
27968
|
-
const [loadError, setLoadError] =
|
|
27969
|
-
const [portalBusy, setPortalBusy] =
|
|
27970
|
-
const [portalError, setPortalError] =
|
|
27971
|
-
const [reactivating, setReactivating] =
|
|
27972
|
-
const [addCardOpen, setAddCardOpen] =
|
|
27973
|
-
const [buyCreditsOpen, setBuyCreditsOpen] =
|
|
27974
|
-
const load =
|
|
27931
|
+
const [summary, setSummary] = React55.useState(null);
|
|
27932
|
+
const [pricing, setPricing] = React55.useState(null);
|
|
27933
|
+
const [items, setItems] = React55.useState([]);
|
|
27934
|
+
const [hasMore, setHasMore] = React55.useState(false);
|
|
27935
|
+
const [moreBusy, setMoreBusy] = React55.useState(false);
|
|
27936
|
+
const [expandedGroup, setExpandedGroup] = React55.useState(null);
|
|
27937
|
+
const [notConfigured, setNotConfigured] = React55.useState(false);
|
|
27938
|
+
const [loading, setLoading] = React55.useState(true);
|
|
27939
|
+
const [loadError, setLoadError] = React55.useState(null);
|
|
27940
|
+
const [portalBusy, setPortalBusy] = React55.useState(false);
|
|
27941
|
+
const [portalError, setPortalError] = React55.useState(null);
|
|
27942
|
+
const [reactivating, setReactivating] = React55.useState(false);
|
|
27943
|
+
const [addCardOpen, setAddCardOpen] = React55.useState(false);
|
|
27944
|
+
const [buyCreditsOpen, setBuyCreditsOpen] = React55.useState(false);
|
|
27945
|
+
const load = React55.useCallback(async () => {
|
|
27975
27946
|
setLoading(true);
|
|
27976
27947
|
setLoadError(null);
|
|
27977
27948
|
try {
|
|
27978
27949
|
const s = await exports.billingService.getMyBilling();
|
|
27950
|
+
setNotConfigured(s === null);
|
|
27979
27951
|
if (s === null) {
|
|
27980
|
-
|
|
27952
|
+
setSummary(null);
|
|
27981
27953
|
} else {
|
|
27982
27954
|
setSummary(s);
|
|
27983
27955
|
setItems(s.recent_line_items);
|
|
@@ -27989,16 +27961,16 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
27989
27961
|
setLoading(false);
|
|
27990
27962
|
}
|
|
27991
27963
|
}, []);
|
|
27992
|
-
|
|
27964
|
+
React55.useEffect(() => {
|
|
27993
27965
|
void load();
|
|
27994
|
-
void exports.billingService.getGasPricing().then(setPricing);
|
|
27966
|
+
void exports.billingService.getGasPricing().then(setPricing).catch(() => setPricing(null));
|
|
27995
27967
|
}, [load]);
|
|
27996
|
-
|
|
27968
|
+
React55.useEffect(() => {
|
|
27997
27969
|
const reloadAfterCheckout = () => void load();
|
|
27998
27970
|
window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
27999
27971
|
return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
|
|
28000
27972
|
}, [load]);
|
|
28001
|
-
const loadMore =
|
|
27973
|
+
const loadMore = React55.useCallback(async () => {
|
|
28002
27974
|
const last = items[items.length - 1];
|
|
28003
27975
|
if (!last || moreBusy) return;
|
|
28004
27976
|
setMoreBusy(true);
|
|
@@ -28012,7 +27984,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28012
27984
|
setMoreBusy(false);
|
|
28013
27985
|
}
|
|
28014
27986
|
}, [items, moreBusy]);
|
|
28015
|
-
const openPortal =
|
|
27987
|
+
const openPortal = React55.useCallback(async () => {
|
|
28016
27988
|
setPortalBusy(true);
|
|
28017
27989
|
setPortalError(null);
|
|
28018
27990
|
try {
|
|
@@ -28023,7 +27995,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28023
27995
|
setPortalBusy(false);
|
|
28024
27996
|
}
|
|
28025
27997
|
}, []);
|
|
28026
|
-
const reactivate =
|
|
27998
|
+
const reactivate = React55.useCallback(async () => {
|
|
28027
27999
|
setReactivating(true);
|
|
28028
28000
|
setPortalError(null);
|
|
28029
28001
|
try {
|
|
@@ -28036,18 +28008,6 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28036
28008
|
}
|
|
28037
28009
|
}, [load]);
|
|
28038
28010
|
const outerClass = dense ? "px-1 py-2" : "mx-auto max-w-5xl px-4 py-6";
|
|
28039
|
-
if (notConfigured) {
|
|
28040
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28041
|
-
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28042
|
-
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
28043
|
-
"Usage & billing",
|
|
28044
|
-
!isLiveMode() && paymentsUrlMap() && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 align-middle inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wider bg-amber-500/15 text-amber-600 ring-1 ring-amber-500/40", children: "Test mode" })
|
|
28045
|
-
] }),
|
|
28046
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-text-muted", children: "Metered AI and on-chain usage." })
|
|
28047
|
-
] }),
|
|
28048
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${CARD} px-4 py-10 text-center text-[13px] text-text-muted`, children: "Billing is not enabled on this deployment." })
|
|
28049
|
-
] });
|
|
28050
|
-
}
|
|
28051
28011
|
const totals = summary?.period_totals ?? [];
|
|
28052
28012
|
const payableTotal = totals.reduce((acc, t) => acc + t.amount_usd_micros, 0);
|
|
28053
28013
|
const personalTotal = summary?.spend?.period_usd_micros ?? payableTotal;
|
|
@@ -28064,7 +28024,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28064
28024
|
const breakdownCount = [llmBreakdown, gasBreakdown, knowledgeBreakdown].filter(
|
|
28065
28025
|
(rows) => rows.length > 0
|
|
28066
28026
|
).length;
|
|
28067
|
-
const meterKeys =
|
|
28027
|
+
const meterKeys = React55.useMemo(
|
|
28068
28028
|
() => [
|
|
28069
28029
|
"llm_usage_usd",
|
|
28070
28030
|
"gas_usage_usd",
|
|
@@ -28078,10 +28038,10 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28078
28038
|
(g) => g.credit_plan_id && g.status === "active"
|
|
28079
28039
|
) ?? null;
|
|
28080
28040
|
const tokenCardGated = billingGateInfoForActiveToken().cardRequired;
|
|
28081
|
-
const [sponsorBusy, setSponsorBusy] =
|
|
28082
|
-
const [sponsorError, setSponsorError] =
|
|
28083
|
-
const [autoBind, setAutoBind] =
|
|
28084
|
-
|
|
28041
|
+
const [sponsorBusy, setSponsorBusy] = React55.useState(false);
|
|
28042
|
+
const [sponsorError, setSponsorError] = React55.useState(null);
|
|
28043
|
+
const [autoBind, setAutoBind] = React55.useState("idle");
|
|
28044
|
+
React55.useEffect(() => {
|
|
28085
28045
|
if (autoBind !== "idle") return;
|
|
28086
28046
|
if (!summary?.card_required || !tokenCardGated || !platformGroup) return;
|
|
28087
28047
|
setAutoBind("trying");
|
|
@@ -28089,7 +28049,7 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28089
28049
|
if (bound) await load();
|
|
28090
28050
|
}).finally(() => setAutoBind("settled"));
|
|
28091
28051
|
}, [summary, tokenCardGated, platformGroup, autoBind]);
|
|
28092
|
-
const billViaGroup =
|
|
28052
|
+
const billViaGroup = React55.useCallback(async () => {
|
|
28093
28053
|
if (!platformGroup || sponsorBusy) return;
|
|
28094
28054
|
setSponsorBusy(true);
|
|
28095
28055
|
setSponsorError(null);
|
|
@@ -28123,6 +28083,18 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28123
28083
|
const creditExhausted = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros <= 0;
|
|
28124
28084
|
const creditLow = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros > 0 && creditGrantMicros != null && creditBalanceMicros < creditGrantMicros * 0.15;
|
|
28125
28085
|
const recoveryAction = summary ? billingRecoveryAction(summary) : null;
|
|
28086
|
+
if (notConfigured) {
|
|
28087
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28088
|
+
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
28090
|
+
"Usage & billing",
|
|
28091
|
+
!isLiveMode() && paymentsUrlMap() && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 align-middle inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wider bg-amber-500/15 text-amber-600 ring-1 ring-amber-500/40", children: "Test mode" })
|
|
28092
|
+
] }),
|
|
28093
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-text-muted", children: "Metered AI and on-chain usage." })
|
|
28094
|
+
] }),
|
|
28095
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${CARD} px-4 py-10 text-center text-[13px] text-text-muted`, children: "Billing is not enabled on this deployment." })
|
|
28096
|
+
] });
|
|
28097
|
+
}
|
|
28126
28098
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
|
|
28127
28099
|
!dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
28128
28100
|
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
|
|
@@ -28461,9 +28433,9 @@ var BillingCenter = ({ dense = false }) => {
|
|
|
28461
28433
|
init_cardRequired();
|
|
28462
28434
|
init_billingService();
|
|
28463
28435
|
var CardRequiredHost = () => {
|
|
28464
|
-
const [request, setRequest] =
|
|
28465
|
-
|
|
28466
|
-
|
|
28436
|
+
const [request, setRequest] = React55.useState(null);
|
|
28437
|
+
React55.useEffect(() => exports.cardRequiredGate.subscribe(setRequest), []);
|
|
28438
|
+
React55.useEffect(() => {
|
|
28467
28439
|
let inFlight = false;
|
|
28468
28440
|
const heal = async () => {
|
|
28469
28441
|
if (inFlight) return;
|
|
@@ -28547,11 +28519,11 @@ var PENDING_RETURN_NOTICE = {
|
|
|
28547
28519
|
message: "Stripe confirmation is taking longer than usual, so this purchase is not confirmed yet. Check again now or return to this page shortly. To avoid a duplicate charge, don\u2019t purchase again until Billing shows the final result."
|
|
28548
28520
|
};
|
|
28549
28521
|
var CreditExhaustedHost = () => {
|
|
28550
|
-
const [request, setRequest] =
|
|
28551
|
-
const [checkoutNotice, setCheckoutNotice] =
|
|
28552
|
-
const [retryMarker, setRetryMarker] =
|
|
28553
|
-
|
|
28554
|
-
|
|
28522
|
+
const [request, setRequest] = React55.useState(null);
|
|
28523
|
+
const [checkoutNotice, setCheckoutNotice] = React55.useState(null);
|
|
28524
|
+
const [retryMarker, setRetryMarker] = React55.useState(null);
|
|
28525
|
+
React55.useEffect(() => creditRequiredGate.subscribe(setRequest), []);
|
|
28526
|
+
React55.useEffect(() => {
|
|
28555
28527
|
const parsedMarker = readCreditCheckoutReturnMarker();
|
|
28556
28528
|
if (!parsedMarker) return;
|
|
28557
28529
|
const marker = parsedMarker;
|
|
@@ -28757,12 +28729,12 @@ function VerifiedBadge({
|
|
|
28757
28729
|
}
|
|
28758
28730
|
function IdentityCard() {
|
|
28759
28731
|
const { config, isLoading: configLoading } = useProviderConfig();
|
|
28760
|
-
const [credentials, setCredentials] =
|
|
28761
|
-
const [profile, setProfile] =
|
|
28762
|
-
const [loading, setLoading] =
|
|
28763
|
-
const [activeKyc, setActiveKyc] =
|
|
28764
|
-
const [error, setError] =
|
|
28765
|
-
|
|
28732
|
+
const [credentials, setCredentials] = React55.useState([]);
|
|
28733
|
+
const [profile, setProfile] = React55.useState(null);
|
|
28734
|
+
const [loading, setLoading] = React55.useState(true);
|
|
28735
|
+
const [activeKyc, setActiveKyc] = React55.useState(null);
|
|
28736
|
+
const [error, setError] = React55.useState(null);
|
|
28737
|
+
React55.useEffect(() => {
|
|
28766
28738
|
let cancelled = false;
|
|
28767
28739
|
(async () => {
|
|
28768
28740
|
try {
|
|
@@ -28899,10 +28871,10 @@ function LoginAltMethods({ exclude, platform, onSuccess } = {}) {
|
|
|
28899
28871
|
const navigate = useWalletNavigate();
|
|
28900
28872
|
const { bootstrapSession } = useAuth();
|
|
28901
28873
|
const { config, isLoading } = useProviderConfig();
|
|
28902
|
-
const [busyId, setBusyId] =
|
|
28903
|
-
const [error, setError] =
|
|
28904
|
-
const [passkeySupported, setPasskeySupported] =
|
|
28905
|
-
|
|
28874
|
+
const [busyId, setBusyId] = React55.useState(null);
|
|
28875
|
+
const [error, setError] = React55.useState(null);
|
|
28876
|
+
const [passkeySupported, setPasskeySupported] = React55.useState(false);
|
|
28877
|
+
React55.useEffect(() => {
|
|
28906
28878
|
setPasskeySupported(typeof window !== "undefined" && !!window.PublicKeyCredential);
|
|
28907
28879
|
}, []);
|
|
28908
28880
|
if (isLoading || !config) return null;
|
|
@@ -29068,25 +29040,25 @@ function useForm({
|
|
|
29068
29040
|
schema,
|
|
29069
29041
|
onSubmit
|
|
29070
29042
|
}) {
|
|
29071
|
-
const [state, setState] =
|
|
29043
|
+
const [state, setState] = React55.useState({
|
|
29072
29044
|
values: initialValues,
|
|
29073
29045
|
errors: {},
|
|
29074
29046
|
touched: {}
|
|
29075
29047
|
});
|
|
29076
|
-
const handleChange =
|
|
29048
|
+
const handleChange = React55.useCallback((name, value) => {
|
|
29077
29049
|
setState((prev) => ({
|
|
29078
29050
|
...prev,
|
|
29079
29051
|
values: { ...prev.values, [name]: value },
|
|
29080
29052
|
touched: { ...prev.touched, [name]: true }
|
|
29081
29053
|
}));
|
|
29082
29054
|
}, []);
|
|
29083
|
-
const handleBlur =
|
|
29055
|
+
const handleBlur = React55.useCallback((name) => {
|
|
29084
29056
|
setState((prev) => ({
|
|
29085
29057
|
...prev,
|
|
29086
29058
|
touched: { ...prev.touched, [name]: true }
|
|
29087
29059
|
}));
|
|
29088
29060
|
}, []);
|
|
29089
|
-
const validate =
|
|
29061
|
+
const validate = React55.useCallback(() => {
|
|
29090
29062
|
try {
|
|
29091
29063
|
schema.parse(state.values);
|
|
29092
29064
|
setState((prev) => ({ ...prev, errors: {} }));
|
|
@@ -29102,13 +29074,13 @@ function useForm({
|
|
|
29102
29074
|
return false;
|
|
29103
29075
|
}
|
|
29104
29076
|
}, [schema, state.values]);
|
|
29105
|
-
const handleSubmit =
|
|
29077
|
+
const handleSubmit = React55.useCallback(async (e) => {
|
|
29106
29078
|
e.preventDefault();
|
|
29107
29079
|
if (validate()) {
|
|
29108
29080
|
await onSubmit(state.values);
|
|
29109
29081
|
}
|
|
29110
29082
|
}, [onSubmit, state.values, validate]);
|
|
29111
|
-
const reset =
|
|
29083
|
+
const reset = React55.useCallback(() => {
|
|
29112
29084
|
setState({
|
|
29113
29085
|
values: initialValues,
|
|
29114
29086
|
errors: {},
|
|
@@ -29153,9 +29125,9 @@ var defaultFormConfig = {
|
|
|
29153
29125
|
function useLogin(options = {}) {
|
|
29154
29126
|
const navigate = useWalletNavigate();
|
|
29155
29127
|
const { login: contextLogin, isLoading: contextLoading, error: contextError, clearError: contextClearError, user } = useAuth();
|
|
29156
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29157
|
-
const [error, setError] =
|
|
29158
|
-
const [isAuthenticated, setIsAuthenticated] =
|
|
29128
|
+
const [isSubmitting, setIsSubmitting] = React55.useState(false);
|
|
29129
|
+
const [error, setError] = React55.useState(null);
|
|
29130
|
+
const [isAuthenticated, setIsAuthenticated] = React55.useState(exports.authService.isAuthenticated());
|
|
29159
29131
|
const {
|
|
29160
29132
|
services = ["vault", "payments"],
|
|
29161
29133
|
redirectPath = "/dashboard",
|
|
@@ -29165,11 +29137,11 @@ function useLogin(options = {}) {
|
|
|
29165
29137
|
showErrorMessages = true,
|
|
29166
29138
|
platform: optionsPlatform
|
|
29167
29139
|
} = options;
|
|
29168
|
-
const clearError =
|
|
29140
|
+
const clearError = React55.useCallback(() => {
|
|
29169
29141
|
setError(null);
|
|
29170
29142
|
contextClearError();
|
|
29171
29143
|
}, [contextClearError]);
|
|
29172
|
-
const login =
|
|
29144
|
+
const login = React55.useCallback(async (credentials) => {
|
|
29173
29145
|
try {
|
|
29174
29146
|
setIsSubmitting(true);
|
|
29175
29147
|
setError(null);
|
|
@@ -29423,8 +29395,8 @@ function AccessFlowBody({
|
|
|
29423
29395
|
onSelectPlatform
|
|
29424
29396
|
}) {
|
|
29425
29397
|
const { isAuthenticated } = useAuth();
|
|
29426
|
-
const [mode, setMode] =
|
|
29427
|
-
const handleWizardComplete =
|
|
29398
|
+
const [mode, setMode] = React55.useState(initialMode);
|
|
29399
|
+
const handleWizardComplete = React55.useCallback(
|
|
29428
29400
|
(destination) => {
|
|
29429
29401
|
if (destination === "/login") {
|
|
29430
29402
|
setMode("login");
|
|
@@ -29477,8 +29449,8 @@ init_chainAccountRequired();
|
|
|
29477
29449
|
// src/ui/account/ChainAccountRequiredHost.tsx
|
|
29478
29450
|
init_chainAccountRequired();
|
|
29479
29451
|
var ChainAccountRequiredHost = () => {
|
|
29480
|
-
const [request, setRequest] =
|
|
29481
|
-
|
|
29452
|
+
const [request, setRequest] = React55.useState(null);
|
|
29453
|
+
React55.useEffect(() => exports.chainAccountRequiredGate.subscribe(setRequest), []);
|
|
29482
29454
|
if (!request) return null;
|
|
29483
29455
|
const key = `${request.context.entityKind}:${request.context.entityId}:${request.context.chainId}`;
|
|
29484
29456
|
return /* @__PURE__ */ jsxRuntime.jsx(ChainAccountActivationDialog, { request }, key);
|
|
@@ -29486,10 +29458,10 @@ var ChainAccountRequiredHost = () => {
|
|
|
29486
29458
|
var ChainAccountActivationDialog = ({ request }) => {
|
|
29487
29459
|
const mode = chainAccountMode(request.context);
|
|
29488
29460
|
const label = mode === "test" ? "Test" : "Live";
|
|
29489
|
-
const [started, setStarted] =
|
|
29490
|
-
const [waitingForVerification, setWaitingForVerification] =
|
|
29491
|
-
const [status, setStatus] =
|
|
29492
|
-
const [error, setError] =
|
|
29461
|
+
const [started, setStarted] = React55.useState(false);
|
|
29462
|
+
const [waitingForVerification, setWaitingForVerification] = React55.useState(false);
|
|
29463
|
+
const [status, setStatus] = React55.useState(null);
|
|
29464
|
+
const [error, setError] = React55.useState(null);
|
|
29493
29465
|
async function activate(verificationAttempted = false) {
|
|
29494
29466
|
setStarted(true);
|
|
29495
29467
|
setError(null);
|
|
@@ -29612,8 +29584,8 @@ init_walletIdentity();
|
|
|
29612
29584
|
init_verificationsService();
|
|
29613
29585
|
init_ProviderConfigContext();
|
|
29614
29586
|
var VerificationRequiredHost = () => {
|
|
29615
|
-
const [request, setRequest] =
|
|
29616
|
-
|
|
29587
|
+
const [request, setRequest] = React55.useState(null);
|
|
29588
|
+
React55.useEffect(() => verificationRequiredGate.subscribe(setRequest), []);
|
|
29617
29589
|
if (!request) return null;
|
|
29618
29590
|
return /* @__PURE__ */ jsxRuntime.jsx(VerificationDialog, { request }, request.context.profile ?? "default");
|
|
29619
29591
|
};
|
|
@@ -29622,12 +29594,12 @@ var VerificationDialog = ({
|
|
|
29622
29594
|
}) => {
|
|
29623
29595
|
const { context } = request;
|
|
29624
29596
|
const { config } = useProviderConfig();
|
|
29625
|
-
const [activeProvider, setActiveProvider] =
|
|
29626
|
-
const [checking, setChecking] =
|
|
29627
|
-
const [error, setError] =
|
|
29628
|
-
const [isGroupManager, setIsGroupManager] =
|
|
29597
|
+
const [activeProvider, setActiveProvider] = React55.useState(null);
|
|
29598
|
+
const [checking, setChecking] = React55.useState(false);
|
|
29599
|
+
const [error, setError] = React55.useState(null);
|
|
29600
|
+
const [isGroupManager, setIsGroupManager] = React55.useState(null);
|
|
29629
29601
|
const hasGroupMiss = context.missing.some((m) => m.subject_kind === "group");
|
|
29630
|
-
|
|
29602
|
+
React55.useEffect(() => {
|
|
29631
29603
|
if (!hasGroupMiss || !context.groupId) return;
|
|
29632
29604
|
let cancelled = false;
|
|
29633
29605
|
groupsService.getGroupDetails(context.groupId).then((g) => {
|
|
@@ -29804,25 +29776,25 @@ function BusinessVerificationSection({
|
|
|
29804
29776
|
initialStatus
|
|
29805
29777
|
}) {
|
|
29806
29778
|
const { config } = useProviderConfig();
|
|
29807
|
-
const [status, setStatus] =
|
|
29808
|
-
const [flowInstance, setFlowInstance] =
|
|
29809
|
-
const [error, setError] =
|
|
29810
|
-
const [busy, setBusy] =
|
|
29811
|
-
const kybInstances =
|
|
29779
|
+
const [status, setStatus] = React55__default.default.useState(initialStatus ?? "not_required");
|
|
29780
|
+
const [flowInstance, setFlowInstance] = React55__default.default.useState(null);
|
|
29781
|
+
const [error, setError] = React55__default.default.useState(null);
|
|
29782
|
+
const [busy, setBusy] = React55__default.default.useState(false);
|
|
29783
|
+
const kybInstances = React55__default.default.useMemo(
|
|
29812
29784
|
() => (config?.kyc.enabled ?? []).filter(
|
|
29813
29785
|
(id) => config?.kyc.settings[id]?.subject === "group"
|
|
29814
29786
|
),
|
|
29815
29787
|
[config]
|
|
29816
29788
|
);
|
|
29817
29789
|
const entityDefault = config?.kyc.entity_default_profile ?? null;
|
|
29818
|
-
const refreshStatus =
|
|
29790
|
+
const refreshStatus = React55__default.default.useCallback(async () => {
|
|
29819
29791
|
try {
|
|
29820
29792
|
const s = await getIdentityStatus({ groupId });
|
|
29821
29793
|
setStatus(s.status === "unverified" ? "unverified" : s.status);
|
|
29822
29794
|
} catch {
|
|
29823
29795
|
}
|
|
29824
29796
|
}, [groupId]);
|
|
29825
|
-
|
|
29797
|
+
React55__default.default.useEffect(() => {
|
|
29826
29798
|
if (initialStatus !== void 0) setStatus(initialStatus);
|
|
29827
29799
|
}, [initialStatus]);
|
|
29828
29800
|
const startFlow = async (bindFirst) => {
|
|
@@ -30558,31 +30530,31 @@ function readDelegationGroupId() {
|
|
|
30558
30530
|
function useIncomingPayments(options = {}) {
|
|
30559
30531
|
const { entityId: entityIdOverride, walletId: walletIdOverride, disableLiveRefresh } = options;
|
|
30560
30532
|
const { user, isAuthenticated } = useAuth();
|
|
30561
|
-
const [delegationGroupId, setDelegationGroupId] =
|
|
30533
|
+
const [delegationGroupId, setDelegationGroupId] = React55.useState(
|
|
30562
30534
|
() => readDelegationGroupId()
|
|
30563
30535
|
);
|
|
30564
|
-
|
|
30536
|
+
React55.useEffect(() => {
|
|
30565
30537
|
setDelegationGroupId(readDelegationGroupId());
|
|
30566
30538
|
}, [isAuthenticated, user?.id]);
|
|
30567
|
-
const activeEntityId =
|
|
30539
|
+
const activeEntityId = React55.useMemo(() => {
|
|
30568
30540
|
if (entityIdOverride !== void 0) return entityIdOverride;
|
|
30569
30541
|
if (delegationGroupId) return delegationGroupId;
|
|
30570
30542
|
return user?.id ?? null;
|
|
30571
30543
|
}, [entityIdOverride, delegationGroupId, user?.id]);
|
|
30572
30544
|
const activeWalletId = walletIdOverride ?? user?.default_wallet_id ?? null;
|
|
30573
|
-
const [payments, setPayments] =
|
|
30574
|
-
const [contracts, setContracts] =
|
|
30575
|
-
const [swaps, setSwaps] =
|
|
30576
|
-
const [loading, setLoading] =
|
|
30577
|
-
const [error, setError] =
|
|
30578
|
-
const [acceptState, setAcceptState] =
|
|
30579
|
-
const inflightRef =
|
|
30580
|
-
const activeEntityIdRef =
|
|
30581
|
-
|
|
30545
|
+
const [payments, setPayments] = React55.useState([]);
|
|
30546
|
+
const [contracts, setContracts] = React55.useState([]);
|
|
30547
|
+
const [swaps, setSwaps] = React55.useState([]);
|
|
30548
|
+
const [loading, setLoading] = React55.useState(false);
|
|
30549
|
+
const [error, setError] = React55.useState(null);
|
|
30550
|
+
const [acceptState, setAcceptState] = React55.useState({ itemKey: null, error: null });
|
|
30551
|
+
const inflightRef = React55.useRef(null);
|
|
30552
|
+
const activeEntityIdRef = React55.useRef(activeEntityId);
|
|
30553
|
+
React55.useEffect(() => {
|
|
30582
30554
|
activeEntityIdRef.current = activeEntityId;
|
|
30583
30555
|
setDelegationGroupId(readDelegationGroupId());
|
|
30584
30556
|
});
|
|
30585
|
-
const fetchAll =
|
|
30557
|
+
const fetchAll = React55.useCallback(async () => {
|
|
30586
30558
|
if (!isAuthenticated || !activeEntityId) {
|
|
30587
30559
|
setPayments([]);
|
|
30588
30560
|
setContracts([]);
|
|
@@ -30633,10 +30605,10 @@ function useIncomingPayments(options = {}) {
|
|
|
30633
30605
|
inflightRef.current = work;
|
|
30634
30606
|
return work;
|
|
30635
30607
|
}, [isAuthenticated, activeEntityId, activeWalletId]);
|
|
30636
|
-
|
|
30608
|
+
React55.useEffect(() => {
|
|
30637
30609
|
void fetchAll();
|
|
30638
30610
|
}, [fetchAll]);
|
|
30639
|
-
|
|
30611
|
+
React55.useEffect(() => {
|
|
30640
30612
|
if (disableLiveRefresh) return;
|
|
30641
30613
|
if (!isAuthenticated || !activeEntityId) return;
|
|
30642
30614
|
const unsub = subscribeEntityEvents(activeEntityId, (event) => {
|
|
@@ -30648,12 +30620,12 @@ function useIncomingPayments(options = {}) {
|
|
|
30648
30620
|
unsub();
|
|
30649
30621
|
};
|
|
30650
30622
|
}, [isAuthenticated, activeEntityId, disableLiveRefresh, fetchAll]);
|
|
30651
|
-
const items =
|
|
30623
|
+
const items = React55.useMemo(
|
|
30652
30624
|
() => buildInbox({ payments, contracts, swaps, activeEntityId }),
|
|
30653
30625
|
[payments, contracts, swaps, activeEntityId]
|
|
30654
30626
|
);
|
|
30655
|
-
const groups =
|
|
30656
|
-
const accept =
|
|
30627
|
+
const groups = React55.useMemo(() => groupInbox(items), [items]);
|
|
30628
|
+
const accept = React55.useCallback(
|
|
30657
30629
|
async (item) => {
|
|
30658
30630
|
setAcceptState({ itemKey: item.key, error: null });
|
|
30659
30631
|
try {
|
|
@@ -30678,7 +30650,7 @@ function useIncomingPayments(options = {}) {
|
|
|
30678
30650
|
},
|
|
30679
30651
|
[]
|
|
30680
30652
|
);
|
|
30681
|
-
const cancel =
|
|
30653
|
+
const cancel = React55.useCallback(async (paymentId) => {
|
|
30682
30654
|
try {
|
|
30683
30655
|
await paymentsService.cancelPayment({ paymentId });
|
|
30684
30656
|
setPayments((prev) => prev.filter((p) => p.id !== paymentId));
|
|
@@ -30707,14 +30679,14 @@ function resetDecimalsWarningCache() {
|
|
|
30707
30679
|
warnedTokenIds.clear();
|
|
30708
30680
|
}
|
|
30709
30681
|
function useDecimalsCore(payments, walletAddress) {
|
|
30710
|
-
const [cache2, setCache] =
|
|
30711
|
-
const [cacheErrors, setCacheErrors] =
|
|
30712
|
-
const fetchingRef =
|
|
30713
|
-
const cacheRef =
|
|
30714
|
-
|
|
30682
|
+
const [cache2, setCache] = React55.useState(/* @__PURE__ */ new Map());
|
|
30683
|
+
const [cacheErrors, setCacheErrors] = React55.useState(/* @__PURE__ */ new Map());
|
|
30684
|
+
const fetchingRef = React55.useRef(/* @__PURE__ */ new Set());
|
|
30685
|
+
const cacheRef = React55.useRef(cache2);
|
|
30686
|
+
React55.useEffect(() => {
|
|
30715
30687
|
cacheRef.current = cache2;
|
|
30716
30688
|
}, [cache2]);
|
|
30717
|
-
|
|
30689
|
+
React55.useEffect(() => {
|
|
30718
30690
|
if (!payments || payments.length === 0) return;
|
|
30719
30691
|
const todo = /* @__PURE__ */ new Set();
|
|
30720
30692
|
for (const payment of payments) {
|
|
@@ -30805,7 +30777,7 @@ function useDecimalsCore(payments, walletAddress) {
|
|
|
30805
30777
|
todo.forEach((id) => fetchingRef.current.delete(id));
|
|
30806
30778
|
};
|
|
30807
30779
|
}, [payments, walletAddress]);
|
|
30808
|
-
return
|
|
30780
|
+
return React55.useMemo(() => ({ cache: cache2, cacheErrors }), [cache2, cacheErrors]);
|
|
30809
30781
|
}
|
|
30810
30782
|
function usePaymentDecimals(payments, walletAddress) {
|
|
30811
30783
|
const { cache: cache2 } = useDecimalsCore(payments, walletAddress);
|
|
@@ -31010,7 +30982,7 @@ var IncomingPaymentsInbox = ({
|
|
|
31010
30982
|
...hookOptions
|
|
31011
30983
|
}) => {
|
|
31012
30984
|
const inbox = useIncomingPayments(hookOptions);
|
|
31013
|
-
const allPayments =
|
|
30985
|
+
const allPayments = React55__default.default.useMemo(
|
|
31014
30986
|
() => [
|
|
31015
30987
|
...inbox.payments,
|
|
31016
30988
|
...inbox.contracts.flatMap((c) => c.payments ?? [])
|
|
@@ -31171,7 +31143,7 @@ var IncomingPaymentsLauncher = ({
|
|
|
31171
31143
|
}) => {
|
|
31172
31144
|
const { isAuthenticated } = useAuth();
|
|
31173
31145
|
const inbox = useIncomingPayments(hookOptions);
|
|
31174
|
-
const [open, setOpen] =
|
|
31146
|
+
const [open, setOpen] = React55.useState(false);
|
|
31175
31147
|
if (hideWhenSignedOut && !isAuthenticated) return null;
|
|
31176
31148
|
const handleClick = onClick ?? (() => setOpen(true));
|
|
31177
31149
|
const count = inbox.items.length;
|
|
@@ -31301,11 +31273,11 @@ function SummaryTile({ label, count }) {
|
|
|
31301
31273
|
] });
|
|
31302
31274
|
}
|
|
31303
31275
|
function useSendPayment() {
|
|
31304
|
-
const [sending, setSending] =
|
|
31305
|
-
const [error, setError] =
|
|
31306
|
-
const [lastResponse, setLastResponse] =
|
|
31307
|
-
const inflightRef =
|
|
31308
|
-
const send =
|
|
31276
|
+
const [sending, setSending] = React55.useState(false);
|
|
31277
|
+
const [error, setError] = React55.useState(null);
|
|
31278
|
+
const [lastResponse, setLastResponse] = React55.useState(null);
|
|
31279
|
+
const inflightRef = React55.useRef(null);
|
|
31280
|
+
const send = React55.useCallback(async (args) => {
|
|
31309
31281
|
if (inflightRef.current) {
|
|
31310
31282
|
return inflightRef.current;
|
|
31311
31283
|
}
|
|
@@ -31333,7 +31305,7 @@ function useSendPayment() {
|
|
|
31333
31305
|
inflightRef.current = work;
|
|
31334
31306
|
return work;
|
|
31335
31307
|
}, []);
|
|
31336
|
-
const reset =
|
|
31308
|
+
const reset = React55.useCallback(() => {
|
|
31337
31309
|
setError(null);
|
|
31338
31310
|
setLastResponse(null);
|
|
31339
31311
|
}, []);
|
|
@@ -31351,13 +31323,13 @@ var SendPaymentForm = ({
|
|
|
31351
31323
|
className = ""
|
|
31352
31324
|
}) => {
|
|
31353
31325
|
const initialAssetId = (defaultAssetId && assets.find((a) => a.id === defaultAssetId)?.id) ?? assets[0]?.id ?? "";
|
|
31354
|
-
const [assetId, setAssetId] =
|
|
31355
|
-
const [amount, setAmount] =
|
|
31356
|
-
const [recipient, setRecipient] =
|
|
31357
|
-
const [recipientMode, setRecipientMode] =
|
|
31358
|
-
const [description, setDescription] =
|
|
31359
|
-
const [validationError, setValidationError] =
|
|
31360
|
-
|
|
31326
|
+
const [assetId, setAssetId] = React55.useState(initialAssetId);
|
|
31327
|
+
const [amount, setAmount] = React55.useState(defaultAmount);
|
|
31328
|
+
const [recipient, setRecipient] = React55.useState(defaultRecipient);
|
|
31329
|
+
const [recipientMode, setRecipientMode] = React55.useState("entity");
|
|
31330
|
+
const [description, setDescription] = React55.useState("");
|
|
31331
|
+
const [validationError, setValidationError] = React55.useState(null);
|
|
31332
|
+
React55.useEffect(() => {
|
|
31361
31333
|
if (assetId === "" && assets.length > 0) {
|
|
31362
31334
|
setAssetId(assets[0].id);
|
|
31363
31335
|
} else if (assetId && !assets.find((a) => a.id === assetId)) {
|