@yieldfabric/wallet 0.2.5 → 0.2.7

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  'use strict';
9
9
 
10
- var React54 = require('react');
10
+ var React39 = require('react');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var avererWebsdk = require('@averer/averer-websdk');
13
13
  var sha3 = require('js-sha3');
@@ -20,7 +20,7 @@ var zod = require('zod');
20
20
 
21
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
22
22
 
23
- var React54__default = /*#__PURE__*/_interopDefault(React54);
23
+ var React39__default = /*#__PURE__*/_interopDefault(React39);
24
24
  var sha3__default = /*#__PURE__*/_interopDefault(sha3);
25
25
  var theme__default = /*#__PURE__*/_interopDefault(theme);
26
26
 
@@ -4966,7 +4966,7 @@ function WalletConfigProvider({ config, children }) {
4966
4966
  return /* @__PURE__ */ jsxRuntime.jsx(WalletConfigContext.Provider, { value: config, children });
4967
4967
  }
4968
4968
  function useWalletConfig() {
4969
- return React54.useContext(WalletConfigContext);
4969
+ return React39.useContext(WalletConfigContext);
4970
4970
  }
4971
4971
  function useTokenStore() {
4972
4972
  const { tokenStore } = useWalletConfig();
@@ -4993,19 +4993,19 @@ var WalletConfigContext;
4993
4993
  var init_WalletConfigContext = __esm({
4994
4994
  "src/providers/WalletConfigContext.tsx"() {
4995
4995
  init_jwtClaims();
4996
- WalletConfigContext = React54.createContext({});
4996
+ WalletConfigContext = React39.createContext({});
4997
4997
  }
4998
4998
  });
4999
4999
  function ProviderConfigProvider({
5000
5000
  children,
5001
5001
  platform
5002
5002
  }) {
5003
- const [state, setState] = React54.useState({
5003
+ const [state, setState] = React39.useState({
5004
5004
  config: null,
5005
5005
  isLoading: true,
5006
5006
  error: null
5007
5007
  });
5008
- React54.useEffect(() => {
5008
+ React39.useEffect(() => {
5009
5009
  let cancelled = false;
5010
5010
  (async () => {
5011
5011
  try {
@@ -5046,12 +5046,12 @@ function ProviderConfigProvider({
5046
5046
  return /* @__PURE__ */ jsxRuntime.jsx(ProviderConfigContext.Provider, { value: state, children });
5047
5047
  }
5048
5048
  function useProviderConfig() {
5049
- return React54.useContext(ProviderConfigContext);
5049
+ return React39.useContext(ProviderConfigContext);
5050
5050
  }
5051
5051
  var ProviderConfigContext, AUTH_BASE5;
5052
5052
  var init_ProviderConfigContext = __esm({
5053
5053
  "src/providers/ProviderConfigContext.tsx"() {
5054
- ProviderConfigContext = React54.createContext({
5054
+ ProviderConfigContext = React39.createContext({
5055
5055
  config: null,
5056
5056
  isLoading: true,
5057
5057
  error: null
@@ -5261,7 +5261,7 @@ __export(SignupFlow_exports, {
5261
5261
  default: () => SignupFlow_default
5262
5262
  });
5263
5263
  function useRegisterConflictPatch() {
5264
- React54.useEffect(() => {
5264
+ React39.useEffect(() => {
5265
5265
  const original = window.fetch;
5266
5266
  window.fetch = async function patchedFetch(input, init) {
5267
5267
  const response = await original.call(window, input, init);
@@ -5284,7 +5284,7 @@ function useRegisterConflictPatch() {
5284
5284
  }, []);
5285
5285
  }
5286
5286
  function useAvererCssVars() {
5287
- React54.useEffect(() => {
5287
+ React39.useEffect(() => {
5288
5288
  const root = document.documentElement;
5289
5289
  const prior = [];
5290
5290
  for (const [name, value] of Object.entries(AVERER_CSS_VARS)) {
@@ -5416,12 +5416,12 @@ var init_SignupFlow = __esm({
5416
5416
  };
5417
5417
  AvererSigninConsumer = ({ appName, onComplete, onError, platform }) => {
5418
5418
  const wallet = avererWebsdk.useAvererWallet();
5419
- const walletRef = React54.useRef(wallet);
5420
- React54.useEffect(() => {
5419
+ const walletRef = React39.useRef(wallet);
5420
+ React39.useEffect(() => {
5421
5421
  walletRef.current = wallet;
5422
5422
  }, [wallet]);
5423
- const widgetWrapRef = React54.useRef(null);
5424
- React54.useEffect(() => {
5423
+ const widgetWrapRef = React39.useRef(null);
5424
+ React39.useEffect(() => {
5425
5425
  const root = widgetWrapRef.current;
5426
5426
  if (!root) return;
5427
5427
  const OVERRIDE_CSS = `
@@ -5916,8 +5916,8 @@ function decide(snapshot, ctx) {
5916
5916
  }
5917
5917
  function useOnboardingState(identityRequired = false, planApplicable = false, identityProviders = [], kycVerifiesEmail = false) {
5918
5918
  const identityProvidersKey = JSON.stringify(identityProviders);
5919
- const previousIdentityProvidersKey = React54.useRef(identityProvidersKey);
5920
- const [state, setState] = React54.useState(() => {
5919
+ const previousIdentityProvidersKey = React39.useRef(identityProvidersKey);
5920
+ const [state, setState] = React39.useState(() => {
5921
5921
  const cached = cachedSnapshotFor(identityProvidersKey, identityProviders);
5922
5922
  if (cached) {
5923
5923
  return {
@@ -5932,7 +5932,7 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
5932
5932
  }
5933
5933
  return { status: "checking", snapshot: null };
5934
5934
  });
5935
- React54.useEffect(() => {
5935
+ React39.useEffect(() => {
5936
5936
  if (state.status !== "checking") return;
5937
5937
  let cancelled = false;
5938
5938
  (async () => {
@@ -5967,14 +5967,14 @@ function useOnboardingState(identityRequired = false, planApplicable = false, id
5967
5967
  cancelled = true;
5968
5968
  };
5969
5969
  }, [state.status, identityRequired, identityProvidersKey, planApplicable]);
5970
- React54.useEffect(() => {
5970
+ React39.useEffect(() => {
5971
5971
  const notify = () => setState({ status: "checking", snapshot: null });
5972
5972
  subscribers.add(notify);
5973
5973
  return () => {
5974
5974
  subscribers.delete(notify);
5975
5975
  };
5976
5976
  }, []);
5977
- React54.useEffect(() => {
5977
+ React39.useEffect(() => {
5978
5978
  if (previousIdentityProvidersKey.current !== identityProvidersKey) {
5979
5979
  previousIdentityProvidersKey.current = identityProvidersKey;
5980
5980
  setState({ status: "checking", snapshot: null });
@@ -6018,14 +6018,14 @@ function clearDynamicSession() {
6018
6018
 
6019
6019
  // src/react/AuthContext.tsx
6020
6020
  init_WalletConfigContext();
6021
- var WalletAuthContext = React54.createContext(void 0);
6021
+ var WalletAuthContext = React39.createContext(void 0);
6022
6022
  function WalletAuthProvider({ children }) {
6023
6023
  const { onSessionBootstrapped, onBeforeLogout } = useWalletConfig();
6024
- const [user, setUser] = React54.useState(null);
6025
- const [isLoading, setIsLoading] = React54.useState(true);
6026
- const [error, setError] = React54.useState(null);
6027
- const [retryTick, setRetryTick] = React54.useState(0);
6028
- const retryWhenOnline = React54.useCallback(() => {
6024
+ const [user, setUser] = React39.useState(null);
6025
+ const [isLoading, setIsLoading] = React39.useState(true);
6026
+ const [error, setError] = React39.useState(null);
6027
+ const [retryTick, setRetryTick] = React39.useState(0);
6028
+ const retryWhenOnline = React39.useCallback(() => {
6029
6029
  if (typeof window === "undefined") return;
6030
6030
  const once = () => {
6031
6031
  window.removeEventListener("online", once);
@@ -6034,7 +6034,7 @@ function WalletAuthProvider({ children }) {
6034
6034
  window.addEventListener("online", once);
6035
6035
  }, []);
6036
6036
  const isAuthenticated = exports.authService.isAuthenticated();
6037
- React54.useEffect(() => {
6037
+ React39.useEffect(() => {
6038
6038
  const loadUserData = async () => {
6039
6039
  if (isAuthenticated) {
6040
6040
  try {
@@ -6064,12 +6064,12 @@ function WalletAuthProvider({ children }) {
6064
6064
  };
6065
6065
  loadUserData();
6066
6066
  }, [isAuthenticated, retryTick]);
6067
- React54.useEffect(() => {
6067
+ React39.useEffect(() => {
6068
6068
  if (user?.id) {
6069
6069
  invalidateWalletCount();
6070
6070
  }
6071
6071
  }, [user?.id]);
6072
- React54.useEffect(() => {
6072
+ React39.useEffect(() => {
6073
6073
  return () => {
6074
6074
  tokenRenewalService.stopRenewal();
6075
6075
  };
@@ -6166,7 +6166,7 @@ function WalletAuthProvider({ children }) {
6166
6166
  return /* @__PURE__ */ jsxRuntime.jsx(WalletAuthContext.Provider, { value, children });
6167
6167
  }
6168
6168
  function useAuth() {
6169
- const context = React54.useContext(WalletAuthContext);
6169
+ const context = React39.useContext(WalletAuthContext);
6170
6170
  if (context === void 0) {
6171
6171
  throw new Error("useAuth must be used within a <WalletAuthProvider>");
6172
6172
  }
@@ -6469,8 +6469,8 @@ function loadModule() {
6469
6469
  return inflight;
6470
6470
  }
6471
6471
  function useAvererModule() {
6472
- const [mod, setMod] = React54.useState(cachedModule);
6473
- React54.useEffect(() => {
6472
+ const [mod, setMod] = React39.useState(cachedModule);
6473
+ React39.useEffect(() => {
6474
6474
  if (mod) return;
6475
6475
  let cancelled = false;
6476
6476
  loadModule().then((resolved) => {
@@ -6489,7 +6489,7 @@ function AvererWalletBridgeInner({
6489
6489
  children
6490
6490
  }) {
6491
6491
  const wallet = mod.useAvererWallet();
6492
- React54.useEffect(() => {
6492
+ React39.useEffect(() => {
6493
6493
  walletRef.current = wallet ?? null;
6494
6494
  }, [wallet, walletRef]);
6495
6495
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
@@ -6504,8 +6504,8 @@ function LazyAvererSdkGate({
6504
6504
  const { AvererSdkProvider: AvererSdkProvider3 } = mod;
6505
6505
  return /* @__PURE__ */ jsxRuntime.jsx(AvererSdkProvider3, { configId, children: /* @__PURE__ */ jsxRuntime.jsx(AvererWalletBridgeInner, { mod, walletRef, children }) });
6506
6506
  }
6507
- var WalletSignerContext = React54.createContext(null);
6508
- var SilentSdkBoundary = class extends React54.Component {
6507
+ var WalletSignerContext = React39.createContext(null);
6508
+ var SilentSdkBoundary = class extends React39.Component {
6509
6509
  constructor() {
6510
6510
  super(...arguments);
6511
6511
  this.state = { hasError: false };
@@ -6525,10 +6525,10 @@ var SilentSdkBoundary = class extends React54.Component {
6525
6525
  }
6526
6526
  };
6527
6527
  function usePathname() {
6528
- const [path, setPath] = React54.useState(
6528
+ const [path, setPath] = React39.useState(
6529
6529
  () => typeof window !== "undefined" ? window.location.pathname : "/"
6530
6530
  );
6531
- React54.useEffect(() => {
6531
+ React39.useEffect(() => {
6532
6532
  if (typeof window === "undefined") return;
6533
6533
  const onChange = () => setPath(window.location.pathname);
6534
6534
  window.addEventListener("popstate", onChange);
@@ -6574,10 +6574,10 @@ function WalletSignerProvider({ children }) {
6574
6574
  const { isAuthenticated } = useAuth();
6575
6575
  const { disableGlobalSigner } = useWalletConfig();
6576
6576
  const configId = config?.auth?.settings?.averer?.config_id ?? "";
6577
- const walletRef = React54.useRef(null);
6577
+ const walletRef = React39.useRef(null);
6578
6578
  const pathname = usePathname();
6579
6579
  const skipSdkRoute = pathname === "/login" || pathname === "/mcp/login" || pathname.startsWith("/onboarding");
6580
- const signMessage = React54.useCallback(
6580
+ const signMessage = React39.useCallback(
6581
6581
  async (messageHex, providerHint, ctxOrAddress) => {
6582
6582
  const ctx = typeof ctxOrAddress === "string" ? { address: ctxOrAddress } : ctxOrAddress ?? {};
6583
6583
  const hint = (providerHint || "").toLowerCase();
@@ -6625,7 +6625,7 @@ function WalletSignerProvider({ children }) {
6625
6625
  },
6626
6626
  []
6627
6627
  );
6628
- const getEoaTransport = React54.useCallback(
6628
+ const getEoaTransport = React39.useCallback(
6629
6629
  async (providerHint) => {
6630
6630
  if (providerHint === "passkey") {
6631
6631
  throw new Error("EOA operations are not supported for passkey keys.");
@@ -6653,7 +6653,7 @@ function WalletSignerProvider({ children }) {
6653
6653
  },
6654
6654
  []
6655
6655
  );
6656
- const sendTransaction = React54.useCallback(
6656
+ const sendTransaction = React39.useCallback(
6657
6657
  async (tx, providerHint) => {
6658
6658
  const transport = await getEoaTransport(providerHint);
6659
6659
  const txHash = await transport.request("eth_sendTransaction", [tx]);
@@ -6664,14 +6664,14 @@ function WalletSignerProvider({ children }) {
6664
6664
  },
6665
6665
  [getEoaTransport]
6666
6666
  );
6667
- const request = React54.useCallback(
6667
+ const request = React39.useCallback(
6668
6668
  async (method, params, providerHint) => {
6669
6669
  const transport = await getEoaTransport(providerHint);
6670
6670
  return transport.request(method, params);
6671
6671
  },
6672
6672
  [getEoaTransport]
6673
6673
  );
6674
- const value = React54.useMemo(
6674
+ const value = React39.useMemo(
6675
6675
  () => ({ signMessage, sendTransaction, request }),
6676
6676
  [signMessage, sendTransaction, request]
6677
6677
  );
@@ -6681,7 +6681,7 @@ function WalletSignerProvider({ children }) {
6681
6681
  return /* @__PURE__ */ jsxRuntime.jsx(WalletSignerContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(SilentSdkBoundary, { fallback: children, children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvererSdkGate, { configId, walletRef, children }) }) });
6682
6682
  }
6683
6683
  function useWalletSigner() {
6684
- const ctx = React54.useContext(WalletSignerContext);
6684
+ const ctx = React39.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 = React54.createContext(null);
7827
+ var SignatureQueueContext = React39.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 = React54.useContext(SignatureQueueContext);
7833
+ const ctx = React39.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] = React54.useState(null);
7842
- const [pendingList, setPendingList] = React54.useState([]);
7843
- const [currentMessage, setCurrentMessage] = React54.useState(null);
7844
- const [drawerOpen, setDrawerOpen] = React54.useState(false);
7845
- const surfacedRef = React54.useRef(/* @__PURE__ */ new Set());
7846
- const fetchAndSetPending = React54.useCallback(async () => {
7841
+ const [pending, setPending] = React39.useState(null);
7842
+ const [pendingList, setPendingList] = React39.useState([]);
7843
+ const [currentMessage, setCurrentMessage] = React39.useState(null);
7844
+ const [drawerOpen, setDrawerOpen] = React39.useState(false);
7845
+ const surfacedRef = React39.useRef(/* @__PURE__ */ new Set());
7846
+ const fetchAndSetPending = React39.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
- React54.useEffect(() => {
7868
+ React39.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 = React54.useCallback(
7924
+ const openSigner = React39.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 = React54.useCallback(() => {
7933
+ const closeSigner = React39.useCallback(() => {
7934
7934
  setDrawerOpen(false);
7935
7935
  setCurrentMessage(null);
7936
7936
  }, []);
7937
- const dismissPending = React54.useCallback(() => {
7937
+ const dismissPending = React39.useCallback(() => {
7938
7938
  setPending(null);
7939
7939
  }, []);
7940
- React54.useEffect(() => {
7940
+ React39.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 = React54.createContext(void 0);
8684
+ var AppAuthContext = React39.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] = React54.useState([]);
8689
- const [groupsLoaded, setGroupsLoaded] = React54.useState(false);
8690
- const [delegationToken, setDelegationToken] = React54.useState(null);
8691
- const [delegationSession, setDelegationSession] = React54.useState(null);
8692
- React54.useEffect(() => {
8688
+ const [groups, setGroups] = React39.useState([]);
8689
+ const [groupsLoaded, setGroupsLoaded] = React39.useState(false);
8690
+ const [delegationToken, setDelegationToken] = React39.useState(null);
8691
+ const [delegationSession, setDelegationSession] = React39.useState(null);
8692
+ React39.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
- React54.useEffect(() => {
8723
+ React39.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 = React54.useCallback(async () => {
8736
+ const refreshGroups = React39.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 = React54.useCallback(async (group) => {
8746
+ const createDelegationToken = React39.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 = React54.useCallback(async (group, signerKeyId, delegationScope = exports.DEFAULT_OWNED_GROUP_DELEGATION_SCOPE) => {
8763
+ const assumeOwnedGroup = React39.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 = React54.useCallback(() => exports.tokenManager.restoreParentDelegationSession(), []);
8815
- const clearDelegationToken = React54.useCallback(() => {
8814
+ const returnToParent = React39.useCallback(() => exports.tokenManager.restoreParentDelegationSession(), []);
8815
+ const clearDelegationToken = React39.useCallback(() => {
8816
8816
  exports.tokenManager.clearDelegationToken();
8817
8817
  }, []);
8818
- const value = React54.useMemo(
8818
+ const value = React39.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 = React54.useContext(AppAuthContext);
8847
+ const ctx = React39.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 = React54.createContext(null);
8853
+ var WalletCenterContext = React39.createContext(null);
8854
8854
  function WalletCenterProvider({ children }) {
8855
- const [isOpen, setIsOpen] = React54.useState(false);
8856
- const [requestedView, setRequestedView] = React54.useState("menu");
8857
- const [host, setHostElement] = React54.useState(null);
8858
- const [hostOptions, setHostOptions] = React54.useState({});
8859
- const [hostTitle, setHostTitle] = React54.useState(null);
8860
- const setHost = React54.useCallback((next) => {
8855
+ const [isOpen, setIsOpen] = React39.useState(false);
8856
+ const [requestedView, setRequestedView] = React39.useState("menu");
8857
+ const [host, setHostElement] = React39.useState(null);
8858
+ const [hostOptions, setHostOptions] = React39.useState({});
8859
+ const [hostTitle, setHostTitle] = React39.useState(null);
8860
+ const setHost = React39.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 = React54.useCallback((view = "menu") => {
8867
+ const openWalletCenter = React39.useCallback((view = "menu") => {
8868
8868
  setRequestedView(view);
8869
8869
  setIsOpen(true);
8870
8870
  }, []);
8871
- const closeWalletCenter = React54.useCallback(() => {
8871
+ const closeWalletCenter = React39.useCallback(() => {
8872
8872
  setIsOpen(false);
8873
8873
  setRequestedView("menu");
8874
8874
  }, []);
8875
- const value = React54.useMemo(
8875
+ const value = React39.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 = React54.useContext(WalletCenterContext);
8882
+ const value = React39.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
- React54.useEffect(() => {
8899
+ React39.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 = React54.createContext(void 0);
9175
+ var EntitySSEContext = React39.createContext(void 0);
9176
9176
  var EntitySSEProvider = ({ children }) => {
9177
9177
  const { user } = useAuthContext();
9178
- const [connected, setConnected] = React54.useState(false);
9179
- const [currentEntityId, setCurrentEntityId] = React54.useState(user?.id || null);
9180
- const unsubRef = React54.useRef(null);
9181
- const handlersRef = React54.useRef(/* @__PURE__ */ new Map());
9182
- const [activityLog, setActivityLog] = React54.useState(() => {
9178
+ const [connected, setConnected] = React39.useState(false);
9179
+ const [currentEntityId, setCurrentEntityId] = React39.useState(user?.id || null);
9180
+ const unsubRef = React39.useRef(null);
9181
+ const handlersRef = React39.useRef(/* @__PURE__ */ new Map());
9182
+ const [activityLog, setActivityLog] = React39.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
- React54.useEffect(() => {
9190
+ React39.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
- React54.useEffect(() => {
9199
+ React39.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
- React54.useEffect(() => {
9224
+ React39.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 = React54.useCallback(
9324
+ const subscribeToEvent = React39.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 = React54.useContext(EntitySSEContext);
9350
+ const context = React39.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] = React54.useState([]);
9580
- const [parentGroupId, setParentGroupId] = React54.useState("");
9581
- const [loading, setLoading] = React54.useState(false);
9582
- const [submittingId, setSubmittingId] = React54.useState(null);
9583
- const [error, setError] = React54.useState(null);
9579
+ const [relationships, setRelationships] = React39.useState([]);
9580
+ const [parentGroupId, setParentGroupId] = React39.useState("");
9581
+ const [loading, setLoading] = React39.useState(false);
9582
+ const [submittingId, setSubmittingId] = React39.useState(null);
9583
+ const [error, setError] = React39.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 = React54.useMemo(
9587
+ const labelById = React39.useMemo(
9588
9588
  () => new Map(availableParentGroups.map((group) => [group.id, group.name])),
9589
9589
  [availableParentGroups]
9590
9590
  );
9591
- const loadRelationships = React54.useCallback(async () => {
9591
+ const loadRelationships = React39.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
- React54.useEffect(() => {
9611
+ React39.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 = React54.createContext(null);
9978
+ var WizardContext = React39.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] = React54.useState(readStoredPendingSponsorship);
9989
- const [pathname, setPathname] = React54.useState(
9988
+ const [pendingSponsorship, setPendingSponsorship] = React39.useState(readStoredPendingSponsorship);
9989
+ const [pathname, setPathname] = React39.useState(
9990
9990
  () => pendingSponsorship ? "/onboarding/sponsorship" : initialPathname
9991
9991
  );
9992
- const [state, setStateValue] = React54.useState(void 0);
9993
- const [planSelection, setPlanSelection] = React54.useState(
9992
+ const [state, setStateValue] = React39.useState(void 0);
9993
+ const [planSelection, setPlanSelection] = React39.useState(
9994
9994
  readOnboardingPlanSelectionHint
9995
9995
  );
9996
- const pendingSponsorshipRef = React54__default.default.useRef(
9996
+ const pendingSponsorshipRef = React39__default.default.useRef(
9997
9997
  pendingSponsorship
9998
9998
  );
9999
- const stageSponsorship = React54.useCallback((groupId, destination) => {
9999
+ const stageSponsorship = React39.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 = React54.useCallback((plan, catalogVersion) => {
10017
+ const selectPlan = React39.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 = React54.useCallback(
10027
+ const hydratePlanSelection = React39.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 = React54.useCallback(() => {
10039
+ const clearPlanSelection = React39.useCallback(() => {
10040
10040
  setPlanSelection(null);
10041
10041
  clearOnboardingPlanSelectionHint();
10042
10042
  }, []);
10043
- const syncPlanIntent = React54.useCallback(async () => {
10043
+ const syncPlanIntent = React39.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 = React54.useCallback(
10059
+ const navigate = React39.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 = React54.useCallback(async (destination, expectedSponsor) => {
10089
+ const continueAuthenticated = React39.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 = React54.useCallback(() => {
10104
+ const discardSponsorship = React39.useCallback(() => {
10105
10105
  pendingSponsorshipRef.current = null;
10106
10106
  setPendingSponsorship(null);
10107
10107
  clearStoredPendingSponsorship();
10108
10108
  }, []);
10109
- const finishSponsorship = React54.useCallback(async () => {
10109
+ const finishSponsorship = React39.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 = React54.useCallback(async (result, destination, effectivePlatform) => {
10135
+ const completeAuthentication = React39.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 = React54.useMemo(() => {
10173
+ const params = React39.useMemo(() => {
10174
10174
  const provider = matchProviderParam(pathname);
10175
10175
  return provider ? { provider } : {};
10176
10176
  }, [pathname]);
10177
- const wizardValue = React54.useMemo(
10177
+ const wizardValue = React39.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 = React54.useMemo(
10215
+ const overriddenConfig = React39.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 = React54.useContext(WizardContext);
10243
+ const ctx = React39.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
- React54.useEffect(() => {
10261
+ React39.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 = React54.createContext(null);
10378
+ var BrandingContext = React39.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 React54.useContext(BrandingContext) ?? ROOT_BRANDING;
10384
+ return React39.useContext(BrandingContext) ?? ROOT_BRANDING;
10385
10385
  }
10386
10386
  function BrandingProvider({
10387
10387
  branding,
10388
10388
  children
10389
10389
  }) {
10390
- const parent = React54.useContext(BrandingContext) ?? ROOT_BRANDING;
10391
- const value = React54.useMemo(() => {
10390
+ const parent = React39.useContext(BrandingContext) ?? ROOT_BRANDING;
10391
+ const value = React39.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] = React54.useState({
10539
+ const [state, setState] = React39.useState({
10540
10540
  step: "unknown",
10541
10541
  isLoading: true
10542
10542
  });
10543
- React54.useEffect(() => {
10543
+ React39.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] = React54.useState(null);
10720
- const [error, setError] = React54.useState(null);
10721
- const [attempt, setAttempt] = React54.useState(0);
10719
+ const [catalog, setCatalog] = React39.useState(null);
10720
+ const [error, setError] = React39.useState(null);
10721
+ const [attempt, setAttempt] = React39.useState(0);
10722
10722
  const platformTagged = !!(wizardPlatform ?? config?.platform?.group_id);
10723
- React54.useEffect(() => {
10723
+ React39.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
- React54.useEffect(() => {
10739
+ React39.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] = React54.useState(true);
10937
- const [busy, setBusy] = React54.useState(false);
10938
- React54.useEffect(() => {
10936
+ const [supported, setSupported] = React39.useState(true);
10937
+ const [busy, setBusy] = React39.useState(false);
10938
+ React39.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 = React54.lazy(() => Promise.resolve().then(() => (init_SignupFlow(), SignupFlow_exports)));
11029
+ var LazyAvererSignupFlow = React39.lazy(() => Promise.resolve().then(() => (init_SignupFlow(), SignupFlow_exports)));
11030
11030
  var SignupFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
11031
- React54.Suspense,
11031
+ React39.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 = React54.lazy(() => Promise.resolve().then(() => (init_KycFlow(), KycFlow_exports)));
11048
+ var LazyAvererKycFlow = React39.lazy(() => Promise.resolve().then(() => (init_KycFlow(), KycFlow_exports)));
11049
11049
  var KycFlow2 = (props) => /* @__PURE__ */ jsxRuntime.jsx(
11050
- React54.Suspense,
11050
+ React39.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] = React54.useState({ status: "loading" });
11070
- React54.useEffect(() => {
11069
+ const [state, setState] = React39.useState({ status: "loading" });
11070
+ React39.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] = React54__default.default.useState(false);
11211
- React54__default.default.useEffect(() => {
11210
+ const [done, setDone] = React39__default.default.useState(false);
11211
+ React39__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] = React54.useState("");
11307
- const [password, setPassword] = React54.useState("");
11308
- const [submitting, setSubmitting] = React54.useState(false);
11306
+ const [email, setEmail] = React39.useState("");
11307
+ const [password, setPassword] = React39.useState("");
11308
+ const [submitting, setSubmitting] = React39.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] = React54.useState(false);
11464
+ const [busy, setBusy] = React39.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] = React54__default.default.useState({ kind: "idle" });
11637
- React54__default.default.useEffect(() => {
11636
+ const [stage, setStage] = React39__default.default.useState({ kind: "idle" });
11637
+ React39__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
- React54__default.default.useEffect(() => {
11661
+ React39__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] = React54__default.default.useState(false);
11914
- const onVerifiedRef = React54__default.default.useRef(onVerified);
11915
- const onRejectedRef = React54__default.default.useRef(onRejected);
11916
- React54__default.default.useEffect(() => {
11913
+ const [stuckHint, setStuckHint] = React39__default.default.useState(false);
11914
+ const onVerifiedRef = React39__default.default.useRef(onVerified);
11915
+ const onRejectedRef = React39__default.default.useRef(onRejected);
11916
+ React39__default.default.useEffect(() => {
11917
11917
  onVerifiedRef.current = onVerified;
11918
11918
  onRejectedRef.current = onRejected;
11919
11919
  }, [onVerified, onRejected]);
11920
- React54__default.default.useEffect(() => {
11920
+ React39__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] = React54__default.default.useState(null);
12059
- const [stage, setStage] = React54__default.default.useState({ kind: "init" });
12060
- const [attempt, setAttempt] = React54__default.default.useState(0);
12061
- const submittedRef = React54__default.default.useRef(false);
12062
- const applicantIdRef = React54__default.default.useRef(void 0);
12063
- React54__default.default.useEffect(() => {
12058
+ const [token, setToken] = React39__default.default.useState(null);
12059
+ const [stage, setStage] = React39__default.default.useState({ kind: "init" });
12060
+ const [attempt, setAttempt] = React39__default.default.useState(0);
12061
+ const submittedRef = React39__default.default.useRef(false);
12062
+ const applicantIdRef = React39__default.default.useRef(void 0);
12063
+ React39__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] = React54.useState(null);
12294
- const [error, setError] = React54.useState(null);
12293
+ const [busyId, setBusyId] = React39.useState(null);
12294
+ const [error, setError] = React39.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 = React39.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] = React54.useState("");
12403
- const [password, setPassword] = React54.useState("");
12404
- const [confirmPassword, setConfirmPassword] = React54.useState("");
12405
- const [phase, setPhase] = React54.useState(null);
12443
+ const [email, setEmail] = React39.useState("");
12444
+ const [password, setPassword] = React39.useState("");
12445
+ const [confirmPassword, setConfirmPassword] = React39.useState("");
12446
+ const [phase, setPhase] = React39.useState(null);
12406
12447
  const submitting = phase !== null;
12407
- const [error, setError] = React54.useState(null);
12408
- const [emailExists, setEmailExists] = React54.useState(false);
12448
+ const [error, setError] = React39.useState(null);
12449
+ const [emailExists, setEmailExists] = React39.useState(false);
12409
12450
  const invite = useWizardInvite();
12410
12451
  const emailLocked = !!invite?.email;
12411
- React54.useEffect(() => {
12452
+ React39.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] = React54.useState(null);
12659
- const [phase, setPhase] = React54.useState("loading");
12660
- const [code, setCode] = React54.useState("");
12661
- const [newEmail, setNewEmail] = React54.useState("");
12662
- const [notice, setNotice] = React54.useState(null);
12663
- const [error, setError] = React54.useState(null);
12664
- const autoStartRef = React54.useRef(false);
12665
- const completionTimerRef = React54.useRef(null);
12661
+ const [status, setStatus] = React39.useState(null);
12662
+ const [phase, setPhase] = React39.useState("loading");
12663
+ const [code, setCode] = React39.useState("");
12664
+ const [newEmail, setNewEmail] = React39.useState("");
12665
+ const [notice, setNotice] = React39.useState(null);
12666
+ const [error, setError] = React39.useState(null);
12667
+ const autoStartRef = React39.useRef(false);
12668
+ const completionTimerRef = React39.useRef(null);
12666
12669
  const email = status?.email ?? "";
12667
- const maskedEmail = React54.useMemo(() => maskEmail(email), [email]);
12670
+ const maskedEmail = React39.useMemo(() => maskEmail(email), [email]);
12668
12671
  const busy = phase === "sending" || phase === "checking" || phase === "updating-email";
12669
- const completeSoon = React54.useCallback((message) => {
12672
+ const completeSoon = React39.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 = React54.useCallback(async () => {
12682
+ const loadStatus = React39.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 = React54.useCallback(async () => {
12692
+ const sendCode = React39.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
- React54.useEffect(() => {
12718
+ React39.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
- React54.useEffect(() => {
12743
+ React39.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
- FloatField2,
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] = React54.useState(null);
12988
+ const [error, setError] = React39.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 = React54.useRef(null);
13213
- const [error, setError] = React54.useState(null);
13183
+ const inputRef = React39.useRef(null);
13184
+ const [error, setError] = React39.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] = React54.useState(false);
13289
- const timeoutRef = React54.useRef(null);
13290
- const clear = React54.useCallback(() => {
13259
+ const [isCancelling, setIsCancelling] = React39.useState(false);
13260
+ const timeoutRef = React39.useRef(null);
13261
+ const clear = React39.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 = React54.useCallback(() => {
13267
+ const handlePointerDown = React39.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 = React54.useCallback(() => {
13273
+ const handlePointerUp = React39.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 = React54.useCallback(() => {
13280
+ const handlePointerLeave = React39.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] = React54.useState(null);
13341
- const [lastName, setLastName] = React54.useState(null);
13342
- const [dob, setDob] = React54.useState(null);
13343
- const [addressLine1, setAddressLine1] = React54.useState(null);
13344
- const [addressLine2, setAddressLine2] = React54.useState(null);
13345
- const [addressCity, setAddressCity] = React54.useState(null);
13346
- const [addressRegion, setAddressRegion] = React54.useState(null);
13347
- const [addressPostalCode, setAddressPostalCode] = React54.useState(null);
13348
- const [addressCountry, setAddressCountry] = React54.useState(null);
13349
- const [displayName, setDisplayName] = React54.useState("");
13350
- const [displayNameEdited, setDisplayNameEdited] = React54.useState(false);
13351
- const [submitting, setSubmitting] = React54.useState(false);
13352
- const [error, setError] = React54.useState(null);
13353
- const [loaded, setLoaded] = React54.useState(false);
13354
- const [fallbackName, setFallbackName] = React54.useState("You");
13355
- const [avatarChoice, setAvatarChoice] = React54.useState(null);
13356
- const [avatarUrl, setAvatarUrl] = React54.useState(null);
13357
- const [avatarTouched, setAvatarTouched] = React54.useState(false);
13358
- const [avatarUrlTouched, setAvatarUrlTouched] = React54.useState(false);
13359
- const [accountEmail, setAccountEmail] = React54.useState(null);
13360
- React54.useEffect(() => {
13311
+ const [firstName, setFirstName] = React39.useState(null);
13312
+ const [lastName, setLastName] = React39.useState(null);
13313
+ const [dob, setDob] = React39.useState(null);
13314
+ const [addressLine1, setAddressLine1] = React39.useState(null);
13315
+ const [addressLine2, setAddressLine2] = React39.useState(null);
13316
+ const [addressCity, setAddressCity] = React39.useState(null);
13317
+ const [addressRegion, setAddressRegion] = React39.useState(null);
13318
+ const [addressPostalCode, setAddressPostalCode] = React39.useState(null);
13319
+ const [addressCountry, setAddressCountry] = React39.useState(null);
13320
+ const [displayName, setDisplayName] = React39.useState("");
13321
+ const [displayNameEdited, setDisplayNameEdited] = React39.useState(false);
13322
+ const [submitting, setSubmitting] = React39.useState(false);
13323
+ const [error, setError] = React39.useState(null);
13324
+ const [loaded, setLoaded] = React39.useState(false);
13325
+ const [fallbackName, setFallbackName] = React39.useState("You");
13326
+ const [avatarChoice, setAvatarChoice] = React39.useState(null);
13327
+ const [avatarUrl, setAvatarUrl] = React39.useState(null);
13328
+ const [avatarTouched, setAvatarTouched] = React39.useState(false);
13329
+ const [avatarUrlTouched, setAvatarUrlTouched] = React39.useState(false);
13330
+ const [accountEmail, setAccountEmail] = React39.useState(null);
13331
+ React39.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
- React54.useEffect(() => {
13389
+ React39.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] = React54.useState(null);
13585
+ const [error, setError] = React39.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] = React54.useState([]);
15069
- const [loading, setLoading] = React54.useState(true);
15070
- const [busy, setBusy] = React54.useState(null);
15071
- const [error, setError] = React54.useState(null);
15072
- const [lastFailedAction, setLastFailedAction] = React54.useState(null);
15073
- const [status, setStatus] = React54.useState(null);
15074
- const [autoAdvanceArmed, setAutoAdvanceArmed] = React54.useState(false);
15075
- const [emailDraft, setEmailDraft] = React54.useState("");
15076
- const [showDynamic, setShowDynamic] = React54.useState(false);
15077
- const [walletsOpen, setWalletsOpen] = React54.useState(false);
15039
+ const [keys, setKeys] = React39.useState([]);
15040
+ const [loading, setLoading] = React39.useState(true);
15041
+ const [busy, setBusy] = React39.useState(null);
15042
+ const [error, setError] = React39.useState(null);
15043
+ const [lastFailedAction, setLastFailedAction] = React39.useState(null);
15044
+ const [status, setStatus] = React39.useState(null);
15045
+ const [autoAdvanceArmed, setAutoAdvanceArmed] = React39.useState(false);
15046
+ const [emailDraft, setEmailDraft] = React39.useState("");
15047
+ const [showDynamic, setShowDynamic] = React39.useState(false);
15048
+ const [walletsOpen, setWalletsOpen] = React39.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 = React54.useCallback(async (opts = {}) => {
15052
+ const refresh = React39.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
- React54.useEffect(() => {
15070
+ React39.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 = React54.useCallback(async () => {
15205
+ const goOn = React39.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 = React54.useCallback(async () => {
15233
+ const onContinue = React39.useCallback(async () => {
15263
15234
  if (!canContinue) return;
15264
15235
  await goOn();
15265
15236
  }, [canContinue, goOn]);
15266
- const onSkip = React54.useCallback(async () => {
15237
+ const onSkip = React39.useCallback(async () => {
15267
15238
  if (!user?.id) return;
15268
15239
  deferKeyStep(user.id);
15269
15240
  await goOn();
15270
15241
  }, [goOn, user?.id]);
15271
- React54.useEffect(() => {
15242
+ React39.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 = React54.useId();
15506
- const panelRef = React54.useRef(null);
15507
- const closeButtonRef = React54.useRef(null);
15508
- React54.useEffect(() => {
15476
+ const titleId = React39.useId();
15477
+ const panelRef = React39.useRef(null);
15478
+ const closeButtonRef = React39.useRef(null);
15479
+ React39.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 = React54.useRef(null);
15780
- const stripeRef = React54.useRef(null);
15781
- const elementsRef = React54.useRef(null);
15782
- const [ready, setReady] = React54.useState(false);
15783
- const [submitting, setSubmitting] = React54.useState(false);
15784
- React54.useEffect(() => {
15750
+ const mountRef = React39.useRef(null);
15751
+ const stripeRef = React39.useRef(null);
15752
+ const elementsRef = React39.useRef(null);
15753
+ const [ready, setReady] = React39.useState(false);
15754
+ const [submitting, setSubmitting] = React39.useState(false);
15755
+ React39.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 = React54.useCallback(async () => {
15785
+ const submit = React39.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] = React54.useState({ kind: "creating" });
15870
- const [attempt, setAttempt] = React54.useState(0);
15871
- React54.useEffect(() => {
15840
+ const [stage, setStage] = React39.useState({ kind: "creating" });
15841
+ const [attempt, setAttempt] = React39.useState(0);
15842
+ React39.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 = React54.useCallback(async () => {
15871
+ const openPortal = React39.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] = React54.useState(true);
15980
- const [saved, setSaved] = React54.useState(false);
15950
+ const [dialogOpen, setDialogOpen] = React39.useState(true);
15951
+ const [saved, setSaved] = React39.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] = React54__default.default.useState(false);
16029
+ const [copied, setCopied] = React39__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,16 @@ var STAGE_COPY = {
16119
16090
  not_applicable: { title: "Finishing up", body: "" }
16120
16091
  };
16121
16092
  var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16122
- const [status, setStatus] = React54__default.default.useState(null);
16123
- const [impatient, setImpatient] = React54__default.default.useState(false);
16124
- const activationStarted = React54__default.default.useRef(false);
16125
- const onContinueRef = React54__default.default.useRef(onContinue);
16126
- React54__default.default.useEffect(() => {
16093
+ const [status, setStatus] = React39__default.default.useState(null);
16094
+ const [impatient, setImpatient] = React39__default.default.useState(false);
16095
+ const [unavailable, setUnavailable] = React39__default.default.useState(false);
16096
+ const [attempt, setAttempt] = React39__default.default.useState(0);
16097
+ const activationStarted = React39__default.default.useRef(false);
16098
+ const onContinueRef = React39__default.default.useRef(onContinue);
16099
+ React39__default.default.useEffect(() => {
16127
16100
  onContinueRef.current = onContinue;
16128
16101
  }, [onContinue]);
16129
- React54__default.default.useEffect(() => {
16102
+ React39__default.default.useEffect(() => {
16130
16103
  let cancelled = false;
16131
16104
  let timer;
16132
16105
  const startedAt = Date.now();
@@ -16134,8 +16107,9 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16134
16107
  if (cancelled) return;
16135
16108
  let terminal = false;
16136
16109
  try {
16137
- const next = await fetchAccountOpeningStatus();
16110
+ const next = await withDeadline(fetchAccountOpeningStatus(), "Account opening status");
16138
16111
  if (cancelled) return;
16112
+ setUnavailable(false);
16139
16113
  setStatus(next);
16140
16114
  if (next.status === "not_started") {
16141
16115
  onContinueRef.current();
@@ -16152,6 +16126,8 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16152
16126
  );
16153
16127
  }
16154
16128
  } catch {
16129
+ if (cancelled) return;
16130
+ setUnavailable(true);
16155
16131
  }
16156
16132
  if (cancelled || terminal) return;
16157
16133
  const waited = Date.now() - startedAt;
@@ -16163,8 +16139,20 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16163
16139
  cancelled = true;
16164
16140
  if (timer !== void 0) window.clearTimeout(timer);
16165
16141
  };
16166
- }, []);
16167
- if (!status) return null;
16142
+ }, [attempt]);
16143
+ if (unavailable || !status) {
16144
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 text-center", role: "status", "aria-live": "polite", children: [
16145
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: unavailable ? "We couldn\u2019t check your account right now." : "Checking your account\u2026" }),
16146
+ unavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16147
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] text-text-secondary", children: "You can try again or continue. Your account details will be available when setup finishes." }),
16148
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "min-h-[44px] w-full rounded-lg bg-cta px-4 py-2.5 text-on-cta", onClick: () => {
16149
+ setUnavailable(false);
16150
+ setAttempt((value) => value + 1);
16151
+ }, children: "Try again" }),
16152
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "min-h-[44px] w-full", onClick: onContinue, children: continueLabel })
16153
+ ] })
16154
+ ] });
16155
+ }
16168
16156
  if (status.status === "ready" && status.account) {
16169
16157
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", role: "status", "aria-live": "polite", children: [
16170
16158
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -16222,14 +16210,14 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16222
16210
  init_authService();
16223
16211
  var WALLET_AWAKENING_MS = 1100;
16224
16212
  var TOTAL_MS = 3e3;
16225
- function OnboardingWelcomeMoment({ chrome } = {}) {
16213
+ function OnboardingWelcomeMoment({ chrome, deferAccountOpening = false } = {}) {
16226
16214
  const navigate = useWizardNavigate();
16227
16215
  const { messages } = useBranding();
16228
- const [name, setName] = React54.useState("");
16229
- const [walletShort, setWalletShort] = React54.useState(null);
16230
- const [phase, setPhase] = React54.useState("wallet");
16231
- const [accountOpened, setAccountOpened] = React54.useState(false);
16232
- React54.useEffect(() => {
16216
+ const [name, setName] = React39.useState("");
16217
+ const [walletShort, setWalletShort] = React39.useState(null);
16218
+ const [phase, setPhase] = React39.useState("wallet");
16219
+ const [accountOpened, setAccountOpened] = React39.useState(deferAccountOpening);
16220
+ React39.useEffect(() => {
16233
16221
  let cancelled = false;
16234
16222
  (async () => {
16235
16223
  const token = exports.authService.getAccessToken();
@@ -16262,7 +16250,7 @@ function OnboardingWelcomeMoment({ chrome } = {}) {
16262
16250
  cancelled = true;
16263
16251
  };
16264
16252
  }, []);
16265
- React54.useEffect(() => {
16253
+ React39.useEffect(() => {
16266
16254
  if (!accountOpened) return;
16267
16255
  const swap = window.setTimeout(() => setPhase("welcome"), WALLET_AWAKENING_MS);
16268
16256
  const route = window.setTimeout(() => navigate("/home"), TOTAL_MS);
@@ -16472,39 +16460,39 @@ function ChoosePlan({
16472
16460
  hydratePlanSelection,
16473
16461
  clearPlanSelection
16474
16462
  } = useWizardPlanIntent();
16475
- const [catalog, setCatalog] = React54.useState(null);
16476
- const [selected, setSelected] = React54.useState(null);
16477
- const [selectedCatalogVersion, setSelectedCatalogVersion] = React54.useState(null);
16478
- const [loading, setLoading] = React54.useState(true);
16479
- const [busy, setBusy] = React54.useState(false);
16480
- const [error, setError] = React54.useState(null);
16481
- const [loadAttempt, setLoadAttempt] = React54.useState(0);
16482
- const [completed, setCompleted] = React54.useState(false);
16483
- const [leave, setLeave] = React54.useState(false);
16484
- const [serverRequired, setServerRequired] = React54.useState(false);
16485
- const [returnPending, setReturnPending] = React54.useState(() => {
16463
+ const [catalog, setCatalog] = React39.useState(null);
16464
+ const [selected, setSelected] = React39.useState(null);
16465
+ const [selectedCatalogVersion, setSelectedCatalogVersion] = React39.useState(null);
16466
+ const [loading, setLoading] = React39.useState(true);
16467
+ const [busy, setBusy] = React39.useState(false);
16468
+ const [error, setError] = React39.useState(null);
16469
+ const [loadAttempt, setLoadAttempt] = React39.useState(0);
16470
+ const [completed, setCompleted] = React39.useState(false);
16471
+ const [leave, setLeave] = React39.useState(false);
16472
+ const [serverRequired, setServerRequired] = React39.useState(false);
16473
+ const [returnPending, setReturnPending] = React39.useState(() => {
16486
16474
  const marker = readCreditCheckoutReturnMarker();
16487
16475
  return marker?.kind === "plan" && !marker.groupId;
16488
16476
  });
16489
- const [returnRetryRequired, setReturnRetryRequired] = React54.useState(false);
16490
- const initialAppliedProofRef = React54.useRef(readAppliedPlanProof());
16491
- const appliedProofRef = React54.useRef(initialAppliedProofRef.current);
16492
- const appliedPlanIdRef = React54.useRef(
16477
+ const [returnRetryRequired, setReturnRetryRequired] = React39.useState(false);
16478
+ const initialAppliedProofRef = React39.useRef(readAppliedPlanProof());
16479
+ const appliedProofRef = React39.useRef(initialAppliedProofRef.current);
16480
+ const appliedPlanIdRef = React39.useRef(
16493
16481
  initialAppliedProofRef.current?.purchasedPlanId ?? null
16494
16482
  );
16495
- const expectedPlanIdRef = React54.useRef(null);
16483
+ const expectedPlanIdRef = React39.useRef(null);
16496
16484
  const initialMismatch = initialAppliedProofRef.current?.intendedPlanId && initialAppliedProofRef.current.intendedPlanId !== initialAppliedProofRef.current.purchasedPlanId ? {
16497
16485
  purchasedPlanId: initialAppliedProofRef.current.purchasedPlanId,
16498
16486
  intendedPlanId: initialAppliedProofRef.current.intendedPlanId
16499
16487
  } : null;
16500
- const [appliedMismatch, setAppliedMismatch] = React54.useState(
16488
+ const [appliedMismatch, setAppliedMismatch] = React39.useState(
16501
16489
  initialMismatch
16502
16490
  );
16503
- const appliedMismatchRef = React54.useRef(initialMismatch);
16491
+ const appliedMismatchRef = React39.useRef(initialMismatch);
16504
16492
  expectedPlanIdRef.current = selected?.id ?? planSelection?.planId ?? null;
16505
16493
  const directSelfPayApplicable = !(wizardPlatform ?? config?.platform?.group_id) && !personalSessionHasGroupPayer();
16506
16494
  const planRequired = required || serverRequired;
16507
- React54.useEffect(() => {
16495
+ React39.useEffect(() => {
16508
16496
  if (!directSelfPayApplicable) return;
16509
16497
  let disposed = false;
16510
16498
  setLoading(true);
@@ -16594,7 +16582,7 @@ function ChoosePlan({
16594
16582
  required,
16595
16583
  returnPending
16596
16584
  ]);
16597
- React54.useEffect(() => {
16585
+ React39.useEffect(() => {
16598
16586
  const handleApplied = (event) => {
16599
16587
  const detail = event.detail;
16600
16588
  if (detail.kind !== "plan" || detail.groupId || !detail.creditPlanId) return;
@@ -16628,7 +16616,7 @@ function ChoosePlan({
16628
16616
  window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
16629
16617
  return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, handleApplied);
16630
16618
  }, []);
16631
- React54.useEffect(() => {
16619
+ React39.useEffect(() => {
16632
16620
  const matchesPersonalPlanReturn = (event) => {
16633
16621
  const detail = event.detail;
16634
16622
  const marker = readCreditCheckoutReturnMarker();
@@ -16659,7 +16647,7 @@ function ChoosePlan({
16659
16647
  );
16660
16648
  };
16661
16649
  }, []);
16662
- React54.useEffect(() => {
16650
+ React39.useEffect(() => {
16663
16651
  if (!returnPending) return;
16664
16652
  const timer = window.setInterval(() => {
16665
16653
  const marker = readCreditCheckoutReturnMarker();
@@ -17161,20 +17149,20 @@ function SponsorshipConsent({
17161
17149
  stageSponsorship,
17162
17150
  finishSponsorship
17163
17151
  } = useWizardAuthentication();
17164
- const [sponsorship, setSponsorship] = React54.useState(null);
17165
- const [exactSession, setExactSession] = React54.useState(false);
17166
- const [agreed, setAgreed] = React54.useState(false);
17167
- const [loading, setLoading] = React54.useState(true);
17168
- const [busy, setBusy] = React54.useState(false);
17169
- const [error, setError] = React54.useState(null);
17170
- const [loadAttempt, setLoadAttempt] = React54.useState(0);
17171
- const destination = React54.useMemo(() => {
17152
+ const [sponsorship, setSponsorship] = React39.useState(null);
17153
+ const [exactSession, setExactSession] = React39.useState(false);
17154
+ const [agreed, setAgreed] = React39.useState(false);
17155
+ const [loading, setLoading] = React39.useState(true);
17156
+ const [busy, setBusy] = React39.useState(false);
17157
+ const [error, setError] = React39.useState(null);
17158
+ const [loadAttempt, setLoadAttempt] = React39.useState(0);
17159
+ const destination = React39.useMemo(() => {
17172
17160
  if (pendingSponsorship?.groupId === groupId) {
17173
17161
  return pendingSponsorship.destination;
17174
17162
  }
17175
17163
  return fallbackDestination;
17176
17164
  }, [fallbackDestination, groupId, pendingSponsorship]);
17177
- const loadCurrent = React54.useCallback(async (driftMessage) => {
17165
+ const loadCurrent = React39.useCallback(async (driftMessage) => {
17178
17166
  setLoading(true);
17179
17167
  if (!driftMessage) setError(null);
17180
17168
  try {
@@ -17197,7 +17185,7 @@ function SponsorshipConsent({
17197
17185
  setLoading(false);
17198
17186
  }
17199
17187
  }, [destination, groupId, stageSponsorship]);
17200
- React54.useEffect(() => {
17188
+ React39.useEffect(() => {
17201
17189
  let cancelled = false;
17202
17190
  setLoading(true);
17203
17191
  setError(null);
@@ -17400,7 +17388,8 @@ function OnboardingWizard({
17400
17388
  invite,
17401
17389
  platform,
17402
17390
  onSelectPlatform,
17403
- sponsorshipConsent = "wizard"
17391
+ sponsorshipConsent = "wizard",
17392
+ billingMode = "automatic"
17404
17393
  }) {
17405
17394
  return /* @__PURE__ */ jsxRuntime.jsx(BrandingProvider, { branding, children: /* @__PURE__ */ jsxRuntime.jsx(
17406
17395
  WizardProvider,
@@ -17414,7 +17403,8 @@ function OnboardingWizard({
17414
17403
  {
17415
17404
  chrome,
17416
17405
  onSelectPlatform,
17417
- sponsorshipConsent
17406
+ sponsorshipConsent,
17407
+ billingMode
17418
17408
  }
17419
17409
  )
17420
17410
  }
@@ -17444,7 +17434,8 @@ function gateToPath(status) {
17444
17434
  function WizardRouter({
17445
17435
  chrome,
17446
17436
  onSelectPlatform,
17447
- sponsorshipConsent = "wizard"
17437
+ sponsorshipConsent = "wizard",
17438
+ billingMode = "automatic"
17448
17439
  }) {
17449
17440
  const pathname = useWizardPathname();
17450
17441
  const { config } = useProviderConfig();
@@ -17453,7 +17444,7 @@ function WizardRouter({
17453
17444
  const effectivePlatform = wizardPlatform ?? config?.platform?.group_id ?? pendingSponsorship?.groupId;
17454
17445
  const primaryKycId = config?.kyc.primary;
17455
17446
  const identityRequired = !!(primaryKycId && config?.kyc.enabled.includes(primaryKycId) && config?.kyc.settings[primaryKycId]?.required_for_completion);
17456
- const planApplicable = !effectivePlatform && !personalSessionHasGroupPayer();
17447
+ const planApplicable = billingMode !== "host" && !effectivePlatform && !personalSessionHasGroupPayer();
17457
17448
  const allowedIdentityProviders = userIdentityStatusScopes(config);
17458
17449
  const gate = useOnboardingState(
17459
17450
  identityRequired,
@@ -17464,11 +17455,14 @@ function WizardRouter({
17464
17455
  identityRequired && primaryKycVerifiesEmail(config)
17465
17456
  );
17466
17457
  const hostOwnsSponsorshipConsent = sponsorshipConsent === "host";
17467
- React54__default.default.useEffect(() => {
17458
+ React39__default.default.useEffect(() => {
17468
17459
  if (hostOwnsSponsorshipConsent && pendingSponsorship) {
17469
17460
  discardSponsorship();
17470
17461
  }
17471
17462
  }, [hostOwnsSponsorshipConsent, pendingSponsorship, discardSponsorship]);
17463
+ if (!planApplicable && ["/onboarding", "/onboarding/pricing", "/onboarding/plan", "/onboarding/card"].includes(pathname)) {
17464
+ return /* @__PURE__ */ jsxRuntime.jsx(WizardRedirect, { to: "/onboarding/choose", replace: true });
17465
+ }
17472
17466
  const sponsorshipContext = !hostOwnsSponsorshipConsent && !!effectivePlatform && (pendingSponsorship !== null || exports.authService.isAuthenticated() && !exports.authService.hasExactSponsoredSession(effectivePlatform));
17473
17467
  const exactSponsorship = !!effectivePlatform && exports.authService.hasExactSponsoredSession(effectivePlatform);
17474
17468
  const gateCanAnswer = exports.authService.isAuthenticated() && !!exports.tokenManager.getAccessToken();
@@ -17552,7 +17546,7 @@ function WizardRouter({
17552
17546
  }
17553
17547
  );
17554
17548
  if (pathname === "/onboarding/welcome")
17555
- return /* @__PURE__ */ jsxRuntime.jsx(OnboardingWelcomeMoment, { chrome });
17549
+ return /* @__PURE__ */ jsxRuntime.jsx(OnboardingWelcomeMoment, { chrome, deferAccountOpening: billingMode === "host" });
17556
17550
  if (pathname === "/onboarding")
17557
17551
  return /* @__PURE__ */ jsxRuntime.jsx(SelectPlan, { chrome, platformPlansAvailable: !!onSelectPlatform });
17558
17552
  if (pathname.startsWith("/onboarding/"))
@@ -17680,7 +17674,7 @@ function builtinProviderDisplayName(id) {
17680
17674
  }
17681
17675
  }
17682
17676
  function useProviderDisplayName(config) {
17683
- return React54__default.default.useCallback(
17677
+ return React39__default.default.useCallback(
17684
17678
  (id) => {
17685
17679
  const labelled = config?.kyc?.settings?.[id]?.label ?? config?.auth?.settings?.[id]?.label;
17686
17680
  const trimmed = typeof labelled === "string" ? labelled.trim() : "";
@@ -17750,26 +17744,26 @@ var OnboardingPolicySection = ({
17750
17744
  groupId,
17751
17745
  sponsorshipEpoch = 0
17752
17746
  }) => {
17753
- const [deployConfig, setDeployConfig] = React54.useState(null);
17747
+ const [deployConfig, setDeployConfig] = React39.useState(null);
17754
17748
  const providerDisplayName = useProviderDisplayName(deployConfig);
17755
- const [deployLoading, setDeployLoading] = React54.useState(true);
17756
- const [profiles, setProfiles] = React54.useState([]);
17757
- const [catalogRefreshed, setCatalogRefreshed] = React54.useState(false);
17758
- const [loading, setLoading] = React54.useState(true);
17759
- const [hidden, setHidden] = React54.useState(false);
17760
- const [platformActive, setPlatformActive] = React54.useState(null);
17761
- const [loadError, setLoadError] = React54.useState(null);
17762
- const [saving, setSaving] = React54.useState(false);
17763
- const [saved, setSaved] = React54.useState(false);
17764
- const [saveError, setSaveError] = React54.useState(null);
17765
- const [profileName, setProfileName] = React54.useState("");
17766
- const [requireEmail, setRequireEmail] = React54.useState(false);
17767
- const [customize, setCustomize] = React54.useState(false);
17768
- const [selectedProviders, setSelectedProviders] = React54.useState([]);
17769
- const [authPrimary, setAuthPrimary] = React54.useState("");
17770
- const [kycPrimary, setKycPrimary] = React54.useState("");
17771
- const [uxSteps, setUxSteps] = React54.useState({});
17772
- React54.useEffect(() => {
17749
+ const [deployLoading, setDeployLoading] = React39.useState(true);
17750
+ const [profiles, setProfiles] = React39.useState([]);
17751
+ const [catalogRefreshed, setCatalogRefreshed] = React39.useState(false);
17752
+ const [loading, setLoading] = React39.useState(true);
17753
+ const [hidden, setHidden] = React39.useState(false);
17754
+ const [platformActive, setPlatformActive] = React39.useState(null);
17755
+ const [loadError, setLoadError] = React39.useState(null);
17756
+ const [saving, setSaving] = React39.useState(false);
17757
+ const [saved, setSaved] = React39.useState(false);
17758
+ const [saveError, setSaveError] = React39.useState(null);
17759
+ const [profileName, setProfileName] = React39.useState("");
17760
+ const [requireEmail, setRequireEmail] = React39.useState(false);
17761
+ const [customize, setCustomize] = React39.useState(false);
17762
+ const [selectedProviders, setSelectedProviders] = React39.useState([]);
17763
+ const [authPrimary, setAuthPrimary] = React39.useState("");
17764
+ const [kycPrimary, setKycPrimary] = React39.useState("");
17765
+ const [uxSteps, setUxSteps] = React39.useState({});
17766
+ React39.useEffect(() => {
17773
17767
  let cancelled = false;
17774
17768
  (async () => {
17775
17769
  try {
@@ -17788,7 +17782,7 @@ var OnboardingPolicySection = ({
17788
17782
  cancelled = true;
17789
17783
  };
17790
17784
  }, []);
17791
- const applyResponse = React54.useCallback((p) => {
17785
+ const applyResponse = React39.useCallback((p) => {
17792
17786
  const pol = p.policy;
17793
17787
  setProfileName(p.verification_profile ?? "");
17794
17788
  setRequireEmail(pol?.require_email ?? false);
@@ -17798,8 +17792,8 @@ var OnboardingPolicySection = ({
17798
17792
  setKycPrimary(pol?.kyc_primary ?? "");
17799
17793
  setUxSteps(pol?.ux_steps ?? {});
17800
17794
  }, []);
17801
- const loadGen = React54.useRef(0);
17802
- const load = React54.useCallback(async () => {
17795
+ const loadGen = React39.useRef(0);
17796
+ const load = React39.useCallback(async () => {
17803
17797
  const gen = ++loadGen.current;
17804
17798
  setLoading(true);
17805
17799
  setLoadError(null);
@@ -17822,16 +17816,16 @@ var OnboardingPolicySection = ({
17822
17816
  if (gen === loadGen.current) setLoading(false);
17823
17817
  }
17824
17818
  }, [groupId, applyResponse]);
17825
- React54.useEffect(() => {
17819
+ React39.useEffect(() => {
17826
17820
  setHidden(false);
17827
17821
  setSaved(false);
17828
17822
  setSaveError(null);
17829
17823
  setCatalogRefreshed(false);
17830
17824
  void load();
17831
17825
  }, [load]);
17832
- const [probeRetry, setProbeRetry] = React54.useState(0);
17833
- const probedGroupRef = React54.useRef(null);
17834
- React54.useEffect(() => {
17826
+ const [probeRetry, setProbeRetry] = React39.useState(0);
17827
+ const probedGroupRef = React39.useRef(null);
17828
+ React39.useEffect(() => {
17835
17829
  let cancelled = false;
17836
17830
  if (probedGroupRef.current !== groupId) {
17837
17831
  setPlatformActive(null);
@@ -17846,7 +17840,7 @@ var OnboardingPolicySection = ({
17846
17840
  cancelled = true;
17847
17841
  };
17848
17842
  }, [groupId, sponsorshipEpoch, probeRetry]);
17849
- const markDirty = React54.useCallback(() => {
17843
+ const markDirty = React39.useCallback(() => {
17850
17844
  setSaved(false);
17851
17845
  setSaveError(null);
17852
17846
  }, []);
@@ -17897,7 +17891,7 @@ var OnboardingPolicySection = ({
17897
17891
  return null;
17898
17892
  };
17899
17893
  const anyBlockedToggle = !loading && profileGroups.some((g) => groupVendors(g).some((v) => vendorToggleTarget(g, v) === null));
17900
- React54.useEffect(() => {
17894
+ React39.useEffect(() => {
17901
17895
  if (!anyBlockedToggle || catalogRefreshed) return;
17902
17896
  setCatalogRefreshed(true);
17903
17897
  onboardingPolicyService.listVerificationProfiles().then((v) => setProfiles(v.profiles)).catch(() => {
@@ -17936,7 +17930,7 @@ var OnboardingPolicySection = ({
17936
17930
  ...requireEmail ? [{ label: "Verify email" }] : [],
17937
17931
  ...profileName && identityStepLabel ? [{ label: identityStepLabel, detail: identityStepDetail }] : []
17938
17932
  ];
17939
- const save = React54.useCallback(async () => {
17933
+ const save = React39.useCallback(async () => {
17940
17934
  if (customize && selectedProviders.length === 0) {
17941
17935
  setSaveError("Select at least one sign-in method, or turn customization off.");
17942
17936
  return;
@@ -18016,7 +18010,7 @@ var OnboardingPolicySection = ({
18016
18010
  )
18017
18011
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
18018
18012
  /* @__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(React54__default.default.Fragment, { children: [
18013
+ journeySteps.map((step, i) => /* @__PURE__ */ jsxRuntime.jsxs(React39__default.default.Fragment, { children: [
18020
18014
  i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-[12px] text-text-muted/60", children: "\u203A" }),
18021
18015
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
18022
18016
  /* @__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 +18869,7 @@ function formatBigNumberString(value) {
18875
18869
  return { withSeparators, sci: `~${mantissa}e${exp}` };
18876
18870
  }
18877
18871
  function ExpandableString({ value }) {
18878
- const [expanded, setExpanded] = React54.useState(false);
18872
+ const [expanded, setExpanded] = React39.useState(false);
18879
18873
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex flex-wrap items-baseline gap-2", children: [
18880
18874
  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
18875
  "[",
@@ -18961,7 +18955,7 @@ function PrettyObject({
18961
18955
  depth,
18962
18956
  keyHint
18963
18957
  }) {
18964
- const [showEmpty, setShowEmpty] = React54.useState(false);
18958
+ const [showEmpty, setShowEmpty] = React39.useState(false);
18965
18959
  const entries = Object.entries(value);
18966
18960
  const present = entries.filter(([, v]) => !isEmptyValue(v));
18967
18961
  const empty = entries.filter(([, v]) => isEmptyValue(v));
@@ -19049,24 +19043,24 @@ function PrettyJson({
19049
19043
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary", children: String(value) });
19050
19044
  }
19051
19045
  function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId, entityType = "user", selectorRegistry, addressLabels, renderSimpleSummary, mode = "sign", onRetry, onSwitchToSign }) {
19052
- const [unsignedTransaction, setUnsignedTransaction] = React54.useState(null);
19053
- const [loading, setLoading] = React54.useState(true);
19054
- const [error, setError] = React54.useState(null);
19055
- const [reviewWarning, setReviewWarning] = React54.useState(null);
19056
- const [signing, setSigning] = React54.useState(false);
19057
- const [selectedKey, setSelectedKey] = React54.useState(null);
19058
- const [availableKeys, setAvailableKeys] = React54.useState([]);
19059
- const [keysLoading, setKeysLoading] = React54.useState(false);
19060
- const [keysError, setKeysError] = React54.useState(null);
19061
- const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] = React54.useState([]);
19062
- const [expandedTxData, setExpandedTxData] = React54.useState(/* @__PURE__ */ new Set());
19063
- const [view, setView] = React54.useState("simple");
19064
- const [cancelling, setCancelling] = React54.useState(false);
19065
- const [cancelError, setCancelError] = React54.useState(null);
19046
+ const [unsignedTransaction, setUnsignedTransaction] = React39.useState(null);
19047
+ const [loading, setLoading] = React39.useState(true);
19048
+ const [error, setError] = React39.useState(null);
19049
+ const [reviewWarning, setReviewWarning] = React39.useState(null);
19050
+ const [signing, setSigning] = React39.useState(false);
19051
+ const [selectedKey, setSelectedKey] = React39.useState(null);
19052
+ const [availableKeys, setAvailableKeys] = React39.useState([]);
19053
+ const [keysLoading, setKeysLoading] = React39.useState(false);
19054
+ const [keysError, setKeysError] = React39.useState(null);
19055
+ const [policyAuthorizedKeyIds, setPolicyAuthorizedKeyIds] = React39.useState([]);
19056
+ const [expandedTxData, setExpandedTxData] = React39.useState(/* @__PURE__ */ new Set());
19057
+ const [view, setView] = React39.useState("simple");
19058
+ const [cancelling, setCancelling] = React39.useState(false);
19059
+ const [cancelError, setCancelError] = React39.useState(null);
19066
19060
  const walletSigner = useWalletSigner();
19067
19061
  const tokenStore = useTokenStore();
19068
19062
  const delegationTokenForSigning = tokenStore.getDelegationToken();
19069
- const ownedSignerState = React54.useMemo(() => {
19063
+ const ownedSignerState = React39.useMemo(() => {
19070
19064
  try {
19071
19065
  return {
19072
19066
  binding: nftOwnedSignerBinding(delegationTokenForSigning),
@@ -19095,7 +19089,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
19095
19089
  setCancelling(false);
19096
19090
  }
19097
19091
  };
19098
- React54.useEffect(() => {
19092
+ React39.useEffect(() => {
19099
19093
  setError(null);
19100
19094
  setReviewWarning(null);
19101
19095
  setKeysError(null);
@@ -19105,7 +19099,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
19105
19099
  setKeysError(null);
19106
19100
  };
19107
19101
  }, [message.id]);
19108
- React54.useEffect(() => {
19102
+ React39.useEffect(() => {
19109
19103
  const fetchUnsignedTransaction = async () => {
19110
19104
  try {
19111
19105
  setLoading(true);
@@ -19228,7 +19222,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
19228
19222
  mode,
19229
19223
  delegationTokenForSigning
19230
19224
  ]);
19231
- React54.useEffect(() => {
19225
+ React39.useEffect(() => {
19232
19226
  if (mode === "inspect") {
19233
19227
  setKeysLoading(false);
19234
19228
  return;
@@ -19293,7 +19287,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
19293
19287
  ownedSignerBinding,
19294
19288
  ownedSignerState.error
19295
19289
  ]);
19296
- React54.useEffect(() => {
19290
+ React39.useEffect(() => {
19297
19291
  if (mode === "inspect") {
19298
19292
  setPolicyAuthorizedKeyIds([]);
19299
19293
  return;
@@ -19317,7 +19311,7 @@ function SignaturePreviewDrawer({ message, onClose, onSignatureConfirmed, userId
19317
19311
  cancelled = true;
19318
19312
  };
19319
19313
  }, [message?.id, mode]);
19320
- React54.useEffect(() => {
19314
+ React39.useEffect(() => {
19321
19315
  if (availableKeys.length === 0) {
19322
19316
  if (selectedKey) setSelectedKey(null);
19323
19317
  return;
@@ -20135,8 +20129,8 @@ function InspectFooter({
20135
20129
  onRetry,
20136
20130
  onSwitchToSign
20137
20131
  }) {
20138
- const [retrying, setRetrying] = React54.useState(false);
20139
- const [actionError, setActionError] = React54.useState(null);
20132
+ const [retrying, setRetrying] = React39.useState(false);
20133
+ const [actionError, setActionError] = React39.useState(null);
20140
20134
  const status = effectiveStatus(message);
20141
20135
  const color = statusToColor(status);
20142
20136
  const txHash = message.response?.deployment_tx_hash || message.response?.transaction_hash;
@@ -20275,8 +20269,8 @@ var GWEI_DISPLAY_THRESHOLD = BigInt("100000000000000");
20275
20269
  var NATIVE_SYMBOL = "ETH";
20276
20270
  var USD_PER_GAS = 0.01 / 21e3;
20277
20271
  function useGasPricing() {
20278
- const [pricing, setPricing] = React54.useState(null);
20279
- React54.useEffect(() => {
20272
+ const [pricing, setPricing] = React39.useState(null);
20273
+ React39.useEffect(() => {
20280
20274
  let mounted = true;
20281
20275
  void exports.billingService.getGasPricing().then((p) => {
20282
20276
  if (mounted) setPricing(p);
@@ -20410,12 +20404,12 @@ var Toast = ({
20410
20404
  icon,
20411
20405
  action
20412
20406
  }) => {
20413
- const [progress, setProgress] = React54.useState(100);
20414
- const [isVisible, setIsVisible] = React54.useState(false);
20415
- React54.useEffect(() => {
20407
+ const [progress, setProgress] = React39.useState(100);
20408
+ const [isVisible, setIsVisible] = React39.useState(false);
20409
+ React39.useEffect(() => {
20416
20410
  requestAnimationFrame(() => setIsVisible(true));
20417
20411
  }, []);
20418
- React54.useEffect(() => {
20412
+ React39.useEffect(() => {
20419
20413
  if (duration > 0) {
20420
20414
  const interval = setInterval(() => {
20421
20415
  setProgress((prev) => {
@@ -20560,7 +20554,7 @@ function SignatureWorkflow({
20560
20554
  dismissPending,
20561
20555
  refreshPending
20562
20556
  } = useSignatureQueue();
20563
- React54.useEffect(() => {
20557
+ React39.useEffect(() => {
20564
20558
  if (!notify || !pending) return;
20565
20559
  const cleanup = notify({
20566
20560
  id: `signature-${pending.id}`,
@@ -20710,7 +20704,7 @@ async function resolveKey(userId, selection) {
20710
20704
  function useGenericSigner() {
20711
20705
  const { user } = useAuth();
20712
20706
  const { signMessage: signWithWallet } = useWalletSigner();
20713
- const sign = React54.useCallback(
20707
+ const sign = React39.useCallback(
20714
20708
  async (hash32Hex, opts = {}) => {
20715
20709
  if (!user) throw new Error("useGenericSigner: no authenticated user");
20716
20710
  const selection = opts.keySelection ?? { mode: "default" };
@@ -20777,10 +20771,10 @@ function PhoneVerification({
20777
20771
  readOnly = false,
20778
20772
  valueClassName
20779
20773
  }) {
20780
- const [phone, setPhone] = React54.useState(profile.phone_e164 ?? "");
20781
- const [editing, setEditing] = React54.useState(!profile.phone_e164);
20782
- const [saving, setSaving] = React54.useState(false);
20783
- const [error, setError] = React54.useState(null);
20774
+ const [phone, setPhone] = React39.useState(profile.phone_e164 ?? "");
20775
+ const [editing, setEditing] = React39.useState(!profile.phone_e164);
20776
+ const [saving, setSaving] = React39.useState(false);
20777
+ const [error, setError] = React39.useState(null);
20784
20778
  async function save() {
20785
20779
  if (!isValidE164(phone)) {
20786
20780
  setError("Please enter a phone number in E.164 format (e.g. +14155550101).");
@@ -20908,10 +20902,10 @@ function Profile({ classNames: propClassNames } = {}) {
20908
20902
  ...propClassNames ?? {}
20909
20903
  });
20910
20904
  const { isLoading: configLoading } = useProviderConfig();
20911
- const [profile, setProfile] = React54.useState(null);
20912
- const [loading, setLoading] = React54.useState(true);
20913
- const [topError, setTopError] = React54.useState(null);
20914
- React54.useEffect(() => {
20905
+ const [profile, setProfile] = React39.useState(null);
20906
+ const [loading, setLoading] = React39.useState(true);
20907
+ const [topError, setTopError] = React39.useState(null);
20908
+ React39.useEffect(() => {
20915
20909
  let cancelled = false;
20916
20910
  (async () => {
20917
20911
  try {
@@ -20956,13 +20950,13 @@ function Profile({ classNames: propClassNames } = {}) {
20956
20950
  ] });
20957
20951
  }
20958
20952
  var IdentitySection = ({ profile, onSaved, classNames }) => {
20959
- const [displayName, setDisplayName] = React54.useState(
20953
+ const [displayName, setDisplayName] = React39.useState(
20960
20954
  profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name
20961
20955
  );
20962
- const [avatarChoice, setAvatarChoice] = React54.useState(profile.avatar_choice);
20963
- const [avatarUrl, setAvatarUrl] = React54.useState(profile.avatar_url);
20964
- const [busy, setBusy] = React54.useState(false);
20965
- const [err, setErr] = React54.useState(null);
20956
+ const [avatarChoice, setAvatarChoice] = React39.useState(profile.avatar_choice);
20957
+ const [avatarUrl, setAvatarUrl] = React39.useState(profile.avatar_url);
20958
+ const [busy, setBusy] = React39.useState(false);
20959
+ const [err, setErr] = React39.useState(null);
20966
20960
  const [saved, flashSaved] = useSavedFlash();
20967
20961
  const dirty = displayName !== (profile.display_name === PLACEHOLDER_DISPLAY_NAME ? "" : profile.display_name) || avatarChoice !== profile.avatar_choice || (avatarUrl ?? "") !== (profile.avatar_url ?? "");
20968
20962
  async function save() {
@@ -21203,12 +21197,12 @@ var SaveButton = ({ onClick, busy, disabled, saved = false, classNames }) => /*
21203
21197
  }
21204
21198
  );
21205
21199
  function useSavedFlash(ms = 1800) {
21206
- const [saved, setSaved] = React54.useState(false);
21207
- const timer = React54__default.default.useRef(null);
21208
- React54.useEffect(() => () => {
21200
+ const [saved, setSaved] = React39.useState(false);
21201
+ const timer = React39__default.default.useRef(null);
21202
+ React39.useEffect(() => () => {
21209
21203
  if (timer.current) clearTimeout(timer.current);
21210
21204
  }, []);
21211
- const flash = React54__default.default.useCallback(() => {
21205
+ const flash = React39__default.default.useCallback(() => {
21212
21206
  setSaved(true);
21213
21207
  if (timer.current) clearTimeout(timer.current);
21214
21208
  timer.current = setTimeout(() => setSaved(false), ms);
@@ -21477,14 +21471,14 @@ function isEoaKey(key) {
21477
21471
  function useKeyBalance(handle, options = {}) {
21478
21472
  const { pollIntervalMs = 15e3, enabled = true } = options;
21479
21473
  const { request } = useWalletSigner();
21480
- const [wei, setWei] = React54.useState(null);
21481
- const [loading, setLoading] = React54.useState(false);
21482
- const [error, setError] = React54.useState(null);
21483
- const requestRef = React54.useRef(request);
21474
+ const [wei, setWei] = React39.useState(null);
21475
+ const [loading, setLoading] = React39.useState(false);
21476
+ const [error, setError] = React39.useState(null);
21477
+ const requestRef = React39.useRef(request);
21484
21478
  requestRef.current = request;
21485
- const handleRef = React54.useRef(handle);
21479
+ const handleRef = React39.useRef(handle);
21486
21480
  handleRef.current = handle;
21487
- const fetchOnce = React54.useCallback(async () => {
21481
+ const fetchOnce = React39.useCallback(async () => {
21488
21482
  const h = handleRef.current;
21489
21483
  if (!h) {
21490
21484
  setWei(null);
@@ -21504,7 +21498,7 @@ function useKeyBalance(handle, options = {}) {
21504
21498
  setLoading(false);
21505
21499
  }
21506
21500
  }, []);
21507
- React54.useEffect(() => {
21501
+ React39.useEffect(() => {
21508
21502
  if (!enabled || !handle) {
21509
21503
  setWei(null);
21510
21504
  setError(null);
@@ -21522,17 +21516,17 @@ function useKeyBalance(handle, options = {}) {
21522
21516
  function useEoaSend(handle, options = {}) {
21523
21517
  const { timeoutMs = 9e4, pollIntervalMs = 3e3, onConfirmed } = options;
21524
21518
  const { sendTransaction, request } = useWalletSigner();
21525
- const [status, setStatus] = React54.useState("idle");
21526
- const [txHash, setTxHash] = React54.useState(null);
21527
- const [error, setError] = React54.useState(null);
21528
- const abortRef = React54.useRef(false);
21529
- const reset = React54.useCallback(() => {
21519
+ const [status, setStatus] = React39.useState("idle");
21520
+ const [txHash, setTxHash] = React39.useState(null);
21521
+ const [error, setError] = React39.useState(null);
21522
+ const abortRef = React39.useRef(false);
21523
+ const reset = React39.useCallback(() => {
21530
21524
  abortRef.current = true;
21531
21525
  setStatus("idle");
21532
21526
  setTxHash(null);
21533
21527
  setError(null);
21534
21528
  }, []);
21535
- const send = React54.useCallback(
21529
+ const send = React39.useCallback(
21536
21530
  async (input) => {
21537
21531
  if (!handle) {
21538
21532
  setError("No EOA selected.");
@@ -21623,14 +21617,14 @@ var SendFromKey = ({
21623
21617
  maxWei,
21624
21618
  onClose
21625
21619
  }) => {
21626
- const [to, setTo] = React54.useState("");
21627
- const [amount, setAmount] = React54.useState("");
21620
+ const [to, setTo] = React39.useState("");
21621
+ const [amount, setAmount] = React39.useState("");
21628
21622
  const { status, txHash, error, send, reset } = useEoaSend(handle, {
21629
21623
  onConfirmed: () => {
21630
21624
  }
21631
21625
  });
21632
21626
  const toValid = ADDRESS_RE2.test(to);
21633
- const amountValid = React54.useMemo(() => {
21627
+ const amountValid = React39.useMemo(() => {
21634
21628
  if (!amount) return false;
21635
21629
  if (!/^\d*\.?\d*$/.test(amount.trim())) return false;
21636
21630
  return Number(amount) > 0;
@@ -21855,7 +21849,7 @@ var KeyBalances = ({
21855
21849
  }) => {
21856
21850
  const configuredClassNames = useWalletConfig().ui?.security;
21857
21851
  const classNames = { ...configuredClassNames ?? {}, ...propClassNames ?? {} };
21858
- const [sendOpen, setSendOpen] = React54.useState(false);
21852
+ const [sendOpen, setSendOpen] = React39.useState(false);
21859
21853
  const { wei, loading, error } = useKeyBalance(handle);
21860
21854
  const formatted = wei === null ? null : formatUnits(wei, 18, 6);
21861
21855
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -21905,13 +21899,13 @@ var ChangePasswordModal = ({
21905
21899
  onClose,
21906
21900
  onChanged
21907
21901
  }) => {
21908
- const [current, setCurrent] = React54.useState("");
21909
- const [next, setNext] = React54.useState("");
21910
- const [confirm, setConfirm] = React54.useState("");
21911
- const [submitting, setSubmitting] = React54.useState(false);
21912
- const [serverError, setServerError] = React54.useState(null);
21913
- const [success, setSuccess] = React54.useState(false);
21914
- const issues = React54.useMemo(() => {
21902
+ const [current, setCurrent] = React39.useState("");
21903
+ const [next, setNext] = React39.useState("");
21904
+ const [confirm, setConfirm] = React39.useState("");
21905
+ const [submitting, setSubmitting] = React39.useState(false);
21906
+ const [serverError, setServerError] = React39.useState(null);
21907
+ const [success, setSuccess] = React39.useState(false);
21908
+ const issues = React39.useMemo(() => {
21915
21909
  const out = [];
21916
21910
  if (!current) out.push({ field: "current", message: "Required." });
21917
21911
  if (!next) {
@@ -22074,7 +22068,7 @@ function PasswordField({
22074
22068
  autoComplete,
22075
22069
  autoFocus
22076
22070
  }) {
22077
- const [reveal, setReveal] = React54.useState(false);
22071
+ const [reveal, setReveal] = React39.useState(false);
22078
22072
  const touched = value.length > 0;
22079
22073
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
22080
22074
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-[10px] uppercase tracking-wide text-text-muted", children: label }),
@@ -22204,32 +22198,32 @@ function SecurityPage() {
22204
22198
  const configuredClassNames = useWalletConfig().ui?.security;
22205
22199
  const classNames = resolveSecurityClasses(configuredClassNames);
22206
22200
  const navigate = useWalletNavigate();
22207
- const [keys, setKeys] = React54.useState([]);
22208
- const [loading, setLoading] = React54.useState(true);
22209
- const [error, setError] = React54.useState(null);
22210
- const [info, setInfo] = React54.useState(null);
22211
- const [showAdvanced, setShowAdvanced] = React54.useState(false);
22212
- const [lockdown, setLockdown] = React54.useState(null);
22213
- const [busy, setBusy] = React54.useState(null);
22214
- const [rotateTarget, setRotateTarget] = React54.useState(null);
22215
- const [rotateNewKind, setRotateNewKind] = React54.useState(null);
22216
- const [rotateStep, setRotateStep] = React54.useState("pick");
22217
- const [rotateNewAddress, setRotateNewAddress] = React54.useState(null);
22218
- const [rotateNewKeyId, setRotateNewKeyId] = React54.useState(null);
22219
- const [rotateAccount, setRotateAccount] = React54.useState(null);
22220
- const [rotateAddStatus, setRotateAddStatus] = React54.useState(null);
22221
- const [rotateOperationMessageId, setRotateOperationMessageId] = React54.useState(null);
22222
- const [passwordModalOpen, setPasswordModalOpen] = React54.useState(false);
22223
- const [editingLabelKeyId, setEditingLabelKeyId] = React54.useState(null);
22224
- const [labelDraft, setLabelDraft] = React54.useState("");
22225
- const [apiKeys, setApiKeys] = React54.useState([]);
22226
- const [apiKeysLoading, setApiKeysLoading] = React54.useState(true);
22227
- const [generateOpen, setGenerateOpen] = React54.useState(false);
22228
- const [generateName, setGenerateName] = React54.useState("");
22229
- const [generateDescription, setGenerateDescription] = React54.useState("");
22230
- const [freshApiKey, setFreshApiKey] = React54.useState(null);
22231
- const [freshApiKeyCopied, setFreshApiKeyCopied] = React54.useState(false);
22232
- const refresh = React54.useCallback(async (opts) => {
22201
+ const [keys, setKeys] = React39.useState([]);
22202
+ const [loading, setLoading] = React39.useState(true);
22203
+ const [error, setError] = React39.useState(null);
22204
+ const [info, setInfo] = React39.useState(null);
22205
+ const [showAdvanced, setShowAdvanced] = React39.useState(false);
22206
+ const [lockdown, setLockdown] = React39.useState(null);
22207
+ const [busy, setBusy] = React39.useState(null);
22208
+ const [rotateTarget, setRotateTarget] = React39.useState(null);
22209
+ const [rotateNewKind, setRotateNewKind] = React39.useState(null);
22210
+ const [rotateStep, setRotateStep] = React39.useState("pick");
22211
+ const [rotateNewAddress, setRotateNewAddress] = React39.useState(null);
22212
+ const [rotateNewKeyId, setRotateNewKeyId] = React39.useState(null);
22213
+ const [rotateAccount, setRotateAccount] = React39.useState(null);
22214
+ const [rotateAddStatus, setRotateAddStatus] = React39.useState(null);
22215
+ const [rotateOperationMessageId, setRotateOperationMessageId] = React39.useState(null);
22216
+ const [passwordModalOpen, setPasswordModalOpen] = React39.useState(false);
22217
+ const [editingLabelKeyId, setEditingLabelKeyId] = React39.useState(null);
22218
+ const [labelDraft, setLabelDraft] = React39.useState("");
22219
+ const [apiKeys, setApiKeys] = React39.useState([]);
22220
+ const [apiKeysLoading, setApiKeysLoading] = React39.useState(true);
22221
+ const [generateOpen, setGenerateOpen] = React39.useState(false);
22222
+ const [generateName, setGenerateName] = React39.useState("");
22223
+ const [generateDescription, setGenerateDescription] = React39.useState("");
22224
+ const [freshApiKey, setFreshApiKey] = React39.useState(null);
22225
+ const [freshApiKeyCopied, setFreshApiKeyCopied] = React39.useState(false);
22226
+ const refresh = React39.useCallback(async (opts) => {
22233
22227
  setError(null);
22234
22228
  try {
22235
22229
  if (opts?.invalidate !== false) invalidateWalletCount();
@@ -22245,10 +22239,10 @@ function SecurityPage() {
22245
22239
  setLoading(false);
22246
22240
  }
22247
22241
  }, []);
22248
- React54.useEffect(() => {
22242
+ React39.useEffect(() => {
22249
22243
  void refresh({ invalidate: false });
22250
22244
  }, [refresh]);
22251
- const refreshApiKeys = React54.useCallback(async () => {
22245
+ const refreshApiKeys = React39.useCallback(async () => {
22252
22246
  try {
22253
22247
  const list = await apiKeysService.list();
22254
22248
  setApiKeys(list);
@@ -22258,7 +22252,7 @@ function SecurityPage() {
22258
22252
  setApiKeysLoading(false);
22259
22253
  }
22260
22254
  }, []);
22261
- React54.useEffect(() => {
22255
+ React39.useEffect(() => {
22262
22256
  refreshApiKeys();
22263
22257
  }, [refreshApiKeys]);
22264
22258
  const userControlledCount = keys.length;
@@ -23542,42 +23536,42 @@ var GroupsView = ({
23542
23536
  clearDelegationToken,
23543
23537
  user
23544
23538
  } = useAuthContext();
23545
- const [busyId, setBusyId] = React54.useState(null);
23546
- const [error, setError] = React54.useState(null);
23547
- const [refreshing, setRefreshing] = React54.useState(false);
23548
- const [creating, setCreating] = React54.useState(false);
23549
- const [createOpen, setCreateOpen] = React54.useState(false);
23550
- const [newGroupName, setNewGroupName] = React54.useState("");
23551
- const [newGroupDescription, setNewGroupDescription] = React54.useState("");
23552
- const [newGroupType, setNewGroupType] = React54.useState("Team");
23553
- const [newGroupLegalEntity, setNewGroupLegalEntity] = React54.useState(false);
23554
- const [selectedGroupId, setSelectedGroupId] = React54.useState(null);
23555
- const [ownedGroups, setOwnedGroups] = React54.useState([]);
23556
- const [ownedGroupsLoading, setOwnedGroupsLoading] = React54.useState(false);
23557
- const [ownedGroupsError, setOwnedGroupsError] = React54.useState(null);
23558
- const [activeOwnedGroup, setActiveOwnedGroup] = React54.useState(null);
23559
- const [operatorKeys, setOperatorKeys] = React54.useState([]);
23560
- const [operatorKeysLoading, setOperatorKeysLoading] = React54.useState(false);
23561
- const [selectedOperatorKeyId, setSelectedOperatorKeyId] = React54.useState("");
23562
- const [relationshipChildGroupId, setRelationshipChildGroupId] = React54.useState("");
23563
- const [relationshipAdvancing, setRelationshipAdvancing] = React54.useState(false);
23564
- const [relationshipProgress, setRelationshipProgress] = React54.useState(null);
23539
+ const [busyId, setBusyId] = React39.useState(null);
23540
+ const [error, setError] = React39.useState(null);
23541
+ const [refreshing, setRefreshing] = React39.useState(false);
23542
+ const [creating, setCreating] = React39.useState(false);
23543
+ const [createOpen, setCreateOpen] = React39.useState(false);
23544
+ const [newGroupName, setNewGroupName] = React39.useState("");
23545
+ const [newGroupDescription, setNewGroupDescription] = React39.useState("");
23546
+ const [newGroupType, setNewGroupType] = React39.useState("Team");
23547
+ const [newGroupLegalEntity, setNewGroupLegalEntity] = React39.useState(false);
23548
+ const [selectedGroupId, setSelectedGroupId] = React39.useState(null);
23549
+ const [ownedGroups, setOwnedGroups] = React39.useState([]);
23550
+ const [ownedGroupsLoading, setOwnedGroupsLoading] = React39.useState(false);
23551
+ const [ownedGroupsError, setOwnedGroupsError] = React39.useState(null);
23552
+ const [activeOwnedGroup, setActiveOwnedGroup] = React39.useState(null);
23553
+ const [operatorKeys, setOperatorKeys] = React39.useState([]);
23554
+ const [operatorKeysLoading, setOperatorKeysLoading] = React39.useState(false);
23555
+ const [selectedOperatorKeyId, setSelectedOperatorKeyId] = React39.useState("");
23556
+ const [relationshipChildGroupId, setRelationshipChildGroupId] = React39.useState("");
23557
+ const [relationshipAdvancing, setRelationshipAdvancing] = React39.useState(false);
23558
+ const [relationshipProgress, setRelationshipProgress] = React39.useState(null);
23565
23559
  const actingAsAnyGroup = !!delegationToken;
23566
- const selectedGroup = React54.useMemo(
23560
+ const selectedGroup = React39.useMemo(
23567
23561
  () => groups.find((group) => group.id === selectedGroupId) ?? null,
23568
23562
  [groups, selectedGroupId]
23569
23563
  );
23570
23564
  const sourceGroupId = delegationSession?.kind === "owned" ? delegationSession.parentGroupId : delegationSession?.currentGroupId ?? null;
23571
- const sourceGroup = React54.useMemo(
23565
+ const sourceGroup = React39.useMemo(
23572
23566
  () => groups.find((group) => group.id === sourceGroupId) ?? null,
23573
23567
  [groups, sourceGroupId]
23574
23568
  );
23575
23569
  const canAdvanceRelationshipAsParent = sourceGroup?.role === "owner";
23576
- React54.useEffect(() => {
23570
+ React39.useEffect(() => {
23577
23571
  setRelationshipChildGroupId("");
23578
23572
  setRelationshipProgress(null);
23579
23573
  }, [delegationSession?.kind, delegationSession?.currentGroupId]);
23580
- React54.useEffect(() => {
23574
+ React39.useEffect(() => {
23581
23575
  let cancelled = false;
23582
23576
  if (!delegationToken || delegationSession?.kind !== "direct") {
23583
23577
  setOwnedGroups([]);
@@ -23605,7 +23599,7 @@ var GroupsView = ({
23605
23599
  cancelled = true;
23606
23600
  };
23607
23601
  }, [delegationSession, delegationToken]);
23608
- React54.useEffect(() => {
23602
+ React39.useEffect(() => {
23609
23603
  let cancelled = false;
23610
23604
  if (delegationSession?.kind !== "direct" || !user?.id) {
23611
23605
  setOperatorKeys([]);
@@ -23642,7 +23636,7 @@ var GroupsView = ({
23642
23636
  cancelled = true;
23643
23637
  };
23644
23638
  }, [delegationSession, user?.id]);
23645
- React54.useEffect(() => {
23639
+ React39.useEffect(() => {
23646
23640
  let cancelled = false;
23647
23641
  if (!delegationToken || delegationSession?.kind !== "owned") {
23648
23642
  setActiveOwnedGroup(null);
@@ -24392,22 +24386,22 @@ function GroupDetailView({
24392
24386
  onOpenBilling,
24393
24387
  onRefreshed
24394
24388
  }) {
24395
- const [details, setDetails] = React54.useState(group);
24396
- const [accountStatus, setAccountStatus] = React54.useState(null);
24397
- const [members, setMembers] = React54.useState([]);
24398
- const [loading, setLoading] = React54.useState(true);
24399
- const [membersLoading, setMembersLoading] = React54.useState(true);
24400
- const [error, setError] = React54.useState(null);
24401
- const [showAddMember, setShowAddMember] = React54.useState(false);
24402
- const [newMemberId, setNewMemberId] = React54.useState("");
24403
- const [newMemberRole, setNewMemberRole] = React54.useState("member");
24404
- const [editingMemberId, setEditingMemberId] = React54.useState(null);
24405
- const [editingRole, setEditingRole] = React54.useState("member");
24406
- const [submitting, setSubmitting] = React54.useState(false);
24407
- const [deploying, setDeploying] = React54.useState(false);
24389
+ const [details, setDetails] = React39.useState(group);
24390
+ const [accountStatus, setAccountStatus] = React39.useState(null);
24391
+ const [members, setMembers] = React39.useState([]);
24392
+ const [loading, setLoading] = React39.useState(true);
24393
+ const [membersLoading, setMembersLoading] = React39.useState(true);
24394
+ const [error, setError] = React39.useState(null);
24395
+ const [showAddMember, setShowAddMember] = React39.useState(false);
24396
+ const [newMemberId, setNewMemberId] = React39.useState("");
24397
+ const [newMemberRole, setNewMemberRole] = React39.useState("member");
24398
+ const [editingMemberId, setEditingMemberId] = React39.useState(null);
24399
+ const [editingRole, setEditingRole] = React39.useState("member");
24400
+ const [submitting, setSubmitting] = React39.useState(false);
24401
+ const [deploying, setDeploying] = React39.useState(false);
24408
24402
  const role = details.role ?? group.role ?? "member";
24409
24403
  const canManageMembers = role === "owner" || role === "admin";
24410
- const loadDetails = React54.useCallback(async () => {
24404
+ const loadDetails = React39.useCallback(async () => {
24411
24405
  setLoading(true);
24412
24406
  setMembersLoading(true);
24413
24407
  setError(null);
@@ -24427,7 +24421,7 @@ function GroupDetailView({
24427
24421
  setMembersLoading(false);
24428
24422
  }
24429
24423
  }, [group]);
24430
- React54.useEffect(() => {
24424
+ React39.useEffect(() => {
24431
24425
  setDetails(group);
24432
24426
  void loadDetails();
24433
24427
  }, [group, loadDetails]);
@@ -24961,17 +24955,17 @@ function ActiveEnvironmentBadge({
24961
24955
  configuredTestChains
24962
24956
  );
24963
24957
  const canChoose = Boolean(activeChainId && options.length > 1);
24964
- const [busyChainId, setBusyChainId] = React54__default.default.useState(null);
24965
- const [pendingLiveChainId, setPendingLiveChainId] = React54__default.default.useState(null);
24966
- const [error, setError] = React54__default.default.useState(null);
24967
- const switchingRef = React54__default.default.useRef(false);
24968
- const confirmLiveRef = React54__default.default.useRef(null);
24969
- const liveWarningId = React54__default.default.useId();
24958
+ const [busyChainId, setBusyChainId] = React39__default.default.useState(null);
24959
+ const [pendingLiveChainId, setPendingLiveChainId] = React39__default.default.useState(null);
24960
+ const [error, setError] = React39__default.default.useState(null);
24961
+ const switchingRef = React39__default.default.useRef(false);
24962
+ const confirmLiveRef = React39__default.default.useRef(null);
24963
+ const liveWarningId = React39__default.default.useId();
24970
24964
  const label = modeLabel(environment.mode);
24971
24965
  const modeCounts = { test: 0, live: 0, unknown: 0 };
24972
24966
  for (const option of options) modeCounts[option.mode] += 1;
24973
24967
  const pendingLive = options.find((option) => option.chainId === pendingLiveChainId) ?? null;
24974
- React54__default.default.useEffect(() => {
24968
+ React39__default.default.useEffect(() => {
24975
24969
  if (pendingLiveChainId) confirmLiveRef.current?.focus();
24976
24970
  }, [pendingLiveChainId]);
24977
24971
  async function switchTo(option) {
@@ -25242,26 +25236,26 @@ var WalletCenterSurface = ({
25242
25236
  } = useAuthContext();
25243
25237
  const walletConfig = useWalletConfig();
25244
25238
  const walletCenterUi = walletConfig.ui?.walletCenter;
25245
- const [section, setSection] = React54.useState("menu");
25246
- const [historyFilter, setHistoryFilter] = React54.useState("all");
25247
- const [historyItems, setHistoryItems] = React54.useState([]);
25248
- const [historyOffset, setHistoryOffset] = React54.useState(0);
25249
- const [historyHasMore, setHistoryHasMore] = React54.useState(false);
25250
- const [historyLoading, setHistoryLoading] = React54.useState(false);
25251
- const [historyError, setHistoryError] = React54.useState(null);
25252
- const [historyLoadedOnce, setHistoryLoadedOnce] = React54.useState(false);
25253
- const [selected, setSelected] = React54.useState(null);
25254
- const [selectedSource, setSelectedSource] = React54.useState("pending");
25255
- const [busyId, setBusyId] = React54.useState(null);
25256
- const [actionError, setActionError] = React54.useState(null);
25257
- const cancelGuardRef = React54.useRef(/* @__PURE__ */ new Map());
25258
- const wasOpenRef = React54.useRef(false);
25259
- const walletRootRef = React54.useRef(null);
25260
- const leaveSection = React54.useCallback(() => {
25239
+ const [section, setSection] = React39.useState("menu");
25240
+ const [historyFilter, setHistoryFilter] = React39.useState("all");
25241
+ const [historyItems, setHistoryItems] = React39.useState([]);
25242
+ const [historyOffset, setHistoryOffset] = React39.useState(0);
25243
+ const [historyHasMore, setHistoryHasMore] = React39.useState(false);
25244
+ const [historyLoading, setHistoryLoading] = React39.useState(false);
25245
+ const [historyError, setHistoryError] = React39.useState(null);
25246
+ const [historyLoadedOnce, setHistoryLoadedOnce] = React39.useState(false);
25247
+ const [selected, setSelected] = React39.useState(null);
25248
+ const [selectedSource, setSelectedSource] = React39.useState("pending");
25249
+ const [busyId, setBusyId] = React39.useState(null);
25250
+ const [actionError, setActionError] = React39.useState(null);
25251
+ const cancelGuardRef = React39.useRef(/* @__PURE__ */ new Map());
25252
+ const wasOpenRef = React39.useRef(false);
25253
+ const walletRootRef = React39.useRef(null);
25254
+ const leaveSection = React39.useCallback(() => {
25261
25255
  if (embedded && initialView !== "menu") onClose();
25262
25256
  else setSection("menu");
25263
25257
  }, [embedded, initialView, onClose]);
25264
- React54.useEffect(() => {
25258
+ React39.useEffect(() => {
25265
25259
  const justOpened = isOpen && !wasOpenRef.current;
25266
25260
  wasOpenRef.current = isOpen;
25267
25261
  if (!justOpened) return;
@@ -25275,24 +25269,24 @@ var WalletCenterSurface = ({
25275
25269
  setHistoryHasMore(false);
25276
25270
  setHistoryLoadedOnce(false);
25277
25271
  }, [initialView, isOpen, refreshPending]);
25278
- React54.useEffect(() => {
25272
+ React39.useEffect(() => {
25279
25273
  if (!isOpen) return;
25280
25274
  if (activeBuiltinFor(section, modules) === "transactions" && pendingList.length === 0) {
25281
25275
  leaveSection();
25282
25276
  }
25283
25277
  }, [isOpen, leaveSection, modules, pendingList.length, section]);
25284
- const delegatedGroupId = React54.useMemo(() => {
25278
+ const delegatedGroupId = React39.useMemo(() => {
25285
25279
  if (!delegationToken || typeof window === "undefined") return null;
25286
25280
  return window.localStorage.getItem("delegation_group_id");
25287
25281
  }, [delegationToken]);
25288
- const configuredModules = React54.useMemo(() => {
25282
+ const configuredModules = React39.useMemo(() => {
25289
25283
  return validateWalletCenterModules(modules ?? defaultWalletCenterModules());
25290
25284
  }, [modules]);
25291
- const runtime = React54.useMemo(
25285
+ const runtime = React39.useMemo(
25292
25286
  () => ({ pendingCount: pendingList.length, isAuthenticated: !!user }),
25293
25287
  [pendingList.length, user]
25294
25288
  );
25295
- const visibleModules = React54.useMemo(
25289
+ const visibleModules = React39.useMemo(
25296
25290
  () => configuredModules.filter((module) => {
25297
25291
  if (module.kind === "builtin" && module.builtin === "transactions" && pendingList.length === 0) {
25298
25292
  return false;
@@ -25301,16 +25295,16 @@ var WalletCenterSurface = ({
25301
25295
  }),
25302
25296
  [configuredModules, pendingList.length, runtime]
25303
25297
  );
25304
- const activeModule = React54.useMemo(
25298
+ const activeModule = React39.useMemo(
25305
25299
  () => configuredModules.find((module) => module.id === section) ?? null,
25306
25300
  [configuredModules, section]
25307
25301
  );
25308
25302
  const activeBuiltin = activeModule?.kind === "builtin" ? activeModule.builtin : null;
25309
- const menuItems = React54.useMemo(
25303
+ const menuItems = React39.useMemo(
25310
25304
  () => buildWalletMenuItems(visibleModules, runtime, groups.length),
25311
25305
  [groups.length, runtime, visibleModules]
25312
25306
  );
25313
- React54.useEffect(() => {
25307
+ React39.useEffect(() => {
25314
25308
  if (!isOpen) return;
25315
25309
  const onVis = () => {
25316
25310
  if (document.visibilityState === "visible") {
@@ -25320,11 +25314,11 @@ var WalletCenterSurface = ({
25320
25314
  document.addEventListener("visibilitychange", onVis);
25321
25315
  return () => document.removeEventListener("visibilitychange", onVis);
25322
25316
  }, [isOpen, refreshPending]);
25323
- React54.useEffect(() => {
25317
+ React39.useEffect(() => {
25324
25318
  const scrollContainer = walletRootRef.current?.parentElement;
25325
25319
  if (scrollContainer) scrollContainer.scrollTop = 0;
25326
25320
  }, [section, selected]);
25327
- const fetchHistory = React54.useCallback(
25321
+ const fetchHistory = React39.useCallback(
25328
25322
  async (offset, append) => {
25329
25323
  setHistoryLoading(true);
25330
25324
  setHistoryError(null);
@@ -25347,7 +25341,7 @@ var WalletCenterSurface = ({
25347
25341
  },
25348
25342
  [userId]
25349
25343
  );
25350
- React54.useEffect(() => {
25344
+ React39.useEffect(() => {
25351
25345
  if (!isOpen) return;
25352
25346
  if (activeBuiltin !== "history") return;
25353
25347
  if (historyLoadedOnce) return;
@@ -25362,7 +25356,7 @@ var WalletCenterSurface = ({
25362
25356
  if (historyItems.length >= HISTORY_MAX_ITEMS) return;
25363
25357
  void fetchHistory(historyOffset, true);
25364
25358
  };
25365
- const filteredHistoryItems = React54.useMemo(() => {
25359
+ const filteredHistoryItems = React39.useMemo(() => {
25366
25360
  if (historyFilter === "all") return historyItems;
25367
25361
  const want = historyFilter === "Completed" /* Completed */ ? /* @__PURE__ */ new Set(["completed", "success"]) : historyFilter === "Failed" /* Failed */ ? /* @__PURE__ */ new Set(["failed", "error"]) : /* @__PURE__ */ new Set(["canceled", "cancelled"]);
25368
25362
  return historyItems.filter(
@@ -25435,7 +25429,7 @@ var WalletCenterSurface = ({
25435
25429
  setActionError(e?.message ?? "Failed to retry message.");
25436
25430
  }
25437
25431
  };
25438
- const handleMenuActAsSelf = React54.useCallback(async () => {
25432
+ const handleMenuActAsSelf = React39.useCallback(async () => {
25439
25433
  setActionError(null);
25440
25434
  try {
25441
25435
  clearDelegationToken();
@@ -25443,7 +25437,7 @@ var WalletCenterSurface = ({
25443
25437
  setActionError(e?.message ?? "Failed to switch entity.");
25444
25438
  }
25445
25439
  }, [clearDelegationToken]);
25446
- const handleMenuActAsGroup = React54.useCallback(
25440
+ const handleMenuActAsGroup = React39.useCallback(
25447
25441
  async (group) => {
25448
25442
  setActionError(null);
25449
25443
  try {
@@ -25454,7 +25448,7 @@ var WalletCenterSurface = ({
25454
25448
  },
25455
25449
  [createDelegationToken]
25456
25450
  );
25457
- const handleSignOut = React54.useCallback(async () => {
25451
+ const handleSignOut = React39.useCallback(async () => {
25458
25452
  setActionError(null);
25459
25453
  try {
25460
25454
  await logout();
@@ -25468,7 +25462,7 @@ var WalletCenterSurface = ({
25468
25462
  setActionError(e?.message ?? "Failed to sign out.");
25469
25463
  }
25470
25464
  }, [logout, onClose, walletConfig]);
25471
- const navigateFromCenter = React54.useCallback(
25465
+ const navigateFromCenter = React39.useCallback(
25472
25466
  (href, options) => {
25473
25467
  if (walletConfig.onNavigate) {
25474
25468
  walletConfig.onNavigate(href, options);
@@ -25479,7 +25473,7 @@ var WalletCenterSurface = ({
25479
25473
  },
25480
25474
  [walletConfig]
25481
25475
  );
25482
- const panelContext = React54.useMemo(
25476
+ const panelContext = React39.useMemo(
25483
25477
  () => ({
25484
25478
  close: onClose,
25485
25479
  back: () => setSection("menu"),
@@ -25490,7 +25484,7 @@ var WalletCenterSurface = ({
25490
25484
  }),
25491
25485
  [navigateFromCenter, onClose]
25492
25486
  );
25493
- const resolvedActors = React54.useMemo(() => {
25487
+ const resolvedActors = React39.useMemo(() => {
25494
25488
  if (actors) return actors;
25495
25489
  return [
25496
25490
  {
@@ -25517,7 +25511,7 @@ var WalletCenterSurface = ({
25517
25511
  status: identity?.status ?? { label: "Online", color: "#4ade80" },
25518
25512
  actions: identity?.actions ?? []
25519
25513
  };
25520
- const handleSelectModule = React54.useCallback(
25514
+ const handleSelectModule = React39.useCallback(
25521
25515
  (module) => {
25522
25516
  setActionError(null);
25523
25517
  if (module.kind === "route") {
@@ -25529,7 +25523,7 @@ var WalletCenterSurface = ({
25529
25523
  },
25530
25524
  [navigateFromCenter, onClose]
25531
25525
  );
25532
- const handleSelectActor = React54.useCallback(async (actor) => {
25526
+ const handleSelectActor = React39.useCallback(async (actor) => {
25533
25527
  setActionError(null);
25534
25528
  try {
25535
25529
  await actor.onSelect();
@@ -25538,7 +25532,7 @@ var WalletCenterSurface = ({
25538
25532
  setActionError(error?.message ?? "Failed to switch signing context.");
25539
25533
  }
25540
25534
  }, [leaveSection]);
25541
- const drawerTitle = React54.useMemo(() => {
25535
+ const drawerTitle = React39.useMemo(() => {
25542
25536
  if (selected) {
25543
25537
  const label = humanizeMessageType(selected.data?.message_type);
25544
25538
  return selectedSource === "pending" ? `${label} \u2014 Sign` : label;
@@ -25546,7 +25540,7 @@ var WalletCenterSurface = ({
25546
25540
  return "Wallet";
25547
25541
  }, [selected, selectedSource]);
25548
25542
  const hostedTitle = !embedded ? null : selected ? drawerTitle : section === "actors" ? "Signing context" : activeModule?.label ?? null;
25549
- React54.useEffect(() => {
25543
+ React39.useEffect(() => {
25550
25544
  if (!embedded) return void 0;
25551
25545
  onTitle?.(hostedTitle);
25552
25546
  return () => onTitle?.(null);
@@ -25731,7 +25725,7 @@ function WalletMenu({
25731
25725
  const secondaryItems = items.filter((item) => item.placement === "secondary");
25732
25726
  const activeActor = actors.find((actor) => actor.active) ?? actors[0];
25733
25727
  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(React54__default.default.Fragment, { children: [
25728
+ const renderCard = (cardItems) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React39__default.default.Fragment, { children: [
25735
25729
  index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
25736
25730
  /* @__PURE__ */ jsxRuntime.jsx(
25737
25731
  WalletMenuRow,
@@ -25975,13 +25969,13 @@ function ActorsPane({
25975
25969
  error,
25976
25970
  onSelect
25977
25971
  }) {
25978
- const [busyId, setBusyId] = React54.useState(null);
25972
+ const [busyId, setBusyId] = React39.useState(null);
25979
25973
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [
25980
25974
  /* @__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
25975
  error && /* @__PURE__ */ jsxRuntime.jsx(ErrorBanner, { children: error }),
25982
25976
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-[22px] border border-border-light bg-raised", children: actors.map((actor, index) => {
25983
25977
  const ActorIcon = actor.icon;
25984
- return /* @__PURE__ */ jsxRuntime.jsxs(React54__default.default.Fragment, { children: [
25978
+ return /* @__PURE__ */ jsxRuntime.jsxs(React39__default.default.Fragment, { children: [
25985
25979
  index > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 border-t border-border-light" }),
25986
25980
  /* @__PURE__ */ jsxRuntime.jsxs(
25987
25981
  "button",
@@ -26016,10 +26010,10 @@ function DirectoryPane({
26016
26010
  module,
26017
26011
  context
26018
26012
  }) {
26019
- const [query, setQuery] = React54.useState("");
26013
+ const [query, setQuery] = React39.useState("");
26020
26014
  const isMobile = useWalletCenterMobile();
26021
26015
  const normalizedQuery = normalizeSearchText(query);
26022
- const visibleGroups = React54.useMemo(
26016
+ const visibleGroups = React39.useMemo(
26023
26017
  () => module.groups.filter((group) => {
26024
26018
  if (!group.visibility || group.visibility === "always") return true;
26025
26019
  return group.visibility === (isMobile ? "mobile" : "desktop");
@@ -26120,10 +26114,10 @@ function normalizeSearchText(value) {
26120
26114
  return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLocaleLowerCase();
26121
26115
  }
26122
26116
  function useWalletCenterMobile() {
26123
- const [isMobile, setIsMobile] = React54.useState(
26117
+ const [isMobile, setIsMobile] = React39.useState(
26124
26118
  () => typeof window !== "undefined" && window.matchMedia("(max-width: 639px)").matches
26125
26119
  );
26126
- React54.useEffect(() => {
26120
+ React39.useEffect(() => {
26127
26121
  if (typeof window === "undefined") return;
26128
26122
  const media = window.matchMedia("(max-width: 639px)");
26129
26123
  const update = () => setIsMobile(media.matches);
@@ -26663,10 +26657,10 @@ function messageText(content) {
26663
26657
  return JSON.stringify(content, null, 2);
26664
26658
  }
26665
26659
  var PromptTranscript = ({ usageEventId }) => {
26666
- const [log, setLog] = React54.useState(null);
26667
- const [note, setNote] = React54.useState(null);
26668
- const [loading, setLoading] = React54.useState(true);
26669
- React54.useEffect(() => {
26660
+ const [log, setLog] = React39.useState(null);
26661
+ const [note, setNote] = React39.useState(null);
26662
+ const [loading, setLoading] = React39.useState(true);
26663
+ React39.useEffect(() => {
26670
26664
  let cancelled = false;
26671
26665
  const base = getAgentsServiceUrl();
26672
26666
  setLoading(true);
@@ -26831,13 +26825,13 @@ var LineItemsTable = ({
26831
26825
  caption,
26832
26826
  showActor
26833
26827
  }) => {
26834
- const [selected, setSelected] = React54.useState(null);
26835
- const [gasPricing, setGasPricing] = React54.useState(null);
26828
+ const [selected, setSelected] = React39.useState(null);
26829
+ const [gasPricing, setGasPricing] = React39.useState(null);
26836
26830
  const minuteRate = gasPricing?.agent_minute_usd ?? 0;
26837
- React54.useEffect(() => {
26831
+ React39.useEffect(() => {
26838
26832
  void exports.billingService.getGasPricing().then(setGasPricing);
26839
26833
  }, []);
26840
- const columns = React54.useMemo(
26834
+ const columns = React39.useMemo(
26841
26835
  () => [
26842
26836
  {
26843
26837
  header: "When",
@@ -27096,12 +27090,12 @@ var BuyCreditsDialog = ({
27096
27090
  source = "manual",
27097
27091
  reason
27098
27092
  }) => {
27099
- const [stage, setStage] = React54.useState({ kind: "loading" });
27100
- const [attempt, setAttempt] = React54.useState(0);
27093
+ const [stage, setStage] = React39.useState({ kind: "loading" });
27094
+ const [attempt, setAttempt] = React39.useState(0);
27101
27095
  const activeGate = creditGateInfoForActiveToken();
27102
27096
  const effectiveReason = reason ?? activeGate.reason ?? void 0;
27103
27097
  const effectiveGroupId = resolveBuyCreditsTargetGroupId(target, activeGate);
27104
- React54.useEffect(() => {
27098
+ React39.useEffect(() => {
27105
27099
  if (!isOpen) return;
27106
27100
  let cancelled = false;
27107
27101
  setStage({ kind: "loading" });
@@ -27140,7 +27134,7 @@ var BuyCreditsDialog = ({
27140
27134
  cancelled = true;
27141
27135
  };
27142
27136
  }, [isOpen, effectiveGroupId, effectiveReason, target.kind, attempt]);
27143
- const redirectTo = React54.useCallback(
27137
+ const redirectTo = React39.useCallback(
27144
27138
  async (open) => {
27145
27139
  setStage({ kind: "redirecting" });
27146
27140
  try {
@@ -27159,7 +27153,7 @@ var BuyCreditsDialog = ({
27159
27153
  },
27160
27154
  [effectiveGroupId]
27161
27155
  );
27162
- const buyPlan = React54.useCallback(
27156
+ const buyPlan = React39.useCallback(
27163
27157
  (planId) => {
27164
27158
  const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
27165
27159
  kind: "plan",
@@ -27176,7 +27170,7 @@ var BuyCreditsDialog = ({
27176
27170
  },
27177
27171
  [redirectTo, effectiveGroupId]
27178
27172
  );
27179
- const buyTopup = React54.useCallback(
27173
+ const buyTopup = React39.useCallback(
27180
27174
  (topupId) => {
27181
27175
  const { successUrl, cancelUrl } = buildCreditCheckoutReturnUrls({
27182
27176
  kind: "topup",
@@ -27353,11 +27347,11 @@ var shareKindLabel = (share) => {
27353
27347
  return KIND_LABELS[kind] ?? (share.entry_kind === "clawback" ? "Adjustment" : "Earnings");
27354
27348
  };
27355
27349
  var EarningsSection = ({ dense = false }) => {
27356
- const [summary, setSummary] = React54.useState(null);
27357
- const [loaded, setLoaded] = React54.useState(false);
27358
- const [connectBusy, setConnectBusy] = React54.useState(false);
27359
- const [error, setError] = React54.useState(null);
27360
- const load = React54.useCallback(async () => {
27350
+ const [summary, setSummary] = React39.useState(null);
27351
+ const [loaded, setLoaded] = React39.useState(false);
27352
+ const [connectBusy, setConnectBusy] = React39.useState(false);
27353
+ const [error, setError] = React39.useState(null);
27354
+ const load = React39.useCallback(async () => {
27361
27355
  try {
27362
27356
  const s = await exports.billingService.getMyEarnings();
27363
27357
  setSummary(s);
@@ -27367,10 +27361,10 @@ var EarningsSection = ({ dense = false }) => {
27367
27361
  setLoaded(true);
27368
27362
  }
27369
27363
  }, []);
27370
- React54.useEffect(() => {
27364
+ React39.useEffect(() => {
27371
27365
  void load();
27372
27366
  }, [load]);
27373
- const openConnectOnboarding = React54.useCallback(async () => {
27367
+ const openConnectOnboarding = React39.useCallback(async () => {
27374
27368
  setConnectBusy(true);
27375
27369
  setError(null);
27376
27370
  try {
@@ -27482,10 +27476,10 @@ var EarningsSection = ({ dense = false }) => {
27482
27476
  init_billingService();
27483
27477
  init_creditCheckoutReturn();
27484
27478
  var GroupBillingSection = ({ groupId }) => {
27485
- const [summary, setSummary] = React54.useState(null);
27486
- const [portalBusy, setPortalBusy] = React54.useState(false);
27487
- const [portalError, setPortalError] = React54.useState(null);
27488
- const openGroupPortal = React54.useCallback(async () => {
27479
+ const [summary, setSummary] = React39.useState(null);
27480
+ const [portalBusy, setPortalBusy] = React39.useState(false);
27481
+ const [portalError, setPortalError] = React39.useState(null);
27482
+ const openGroupPortal = React39.useCallback(async () => {
27489
27483
  setPortalBusy(true);
27490
27484
  setPortalError(null);
27491
27485
  try {
@@ -27501,21 +27495,21 @@ var GroupBillingSection = ({ groupId }) => {
27501
27495
  setPortalBusy(false);
27502
27496
  }
27503
27497
  }, [groupId]);
27504
- const [pricing, setPricing] = React54.useState(null);
27505
- const [items, setItems] = React54.useState([]);
27506
- const [hasMore, setHasMore] = React54.useState(false);
27507
- const [moreBusy, setMoreBusy] = React54.useState(false);
27508
- const [loading, setLoading] = React54.useState(true);
27509
- const [hidden, setHidden] = React54.useState(false);
27510
- const [addCardOpen, setAddCardOpen] = React54.useState(false);
27511
- const [buyCreditsOpen, setBuyCreditsOpen] = React54.useState(false);
27512
- const [earnings, setEarnings] = React54.useState(null);
27513
- const [reactivating, setReactivating] = React54.useState(false);
27514
- const [reactivationError, setReactivationError] = React54.useState(null);
27515
- React54.useEffect(() => {
27498
+ const [pricing, setPricing] = React39.useState(null);
27499
+ const [items, setItems] = React39.useState([]);
27500
+ const [hasMore, setHasMore] = React39.useState(false);
27501
+ const [moreBusy, setMoreBusy] = React39.useState(false);
27502
+ const [loading, setLoading] = React39.useState(true);
27503
+ const [hidden, setHidden] = React39.useState(false);
27504
+ const [addCardOpen, setAddCardOpen] = React39.useState(false);
27505
+ const [buyCreditsOpen, setBuyCreditsOpen] = React39.useState(false);
27506
+ const [earnings, setEarnings] = React39.useState(null);
27507
+ const [reactivating, setReactivating] = React39.useState(false);
27508
+ const [reactivationError, setReactivationError] = React39.useState(null);
27509
+ React39.useEffect(() => {
27516
27510
  void exports.billingService.getGasPricing().then(setPricing);
27517
27511
  }, []);
27518
- React54.useEffect(() => {
27512
+ React39.useEffect(() => {
27519
27513
  let cancelled = false;
27520
27514
  exports.billingService.getGroupEarnings(groupId).then((e) => {
27521
27515
  if (!cancelled) setEarnings(e);
@@ -27525,7 +27519,7 @@ var GroupBillingSection = ({ groupId }) => {
27525
27519
  cancelled = true;
27526
27520
  };
27527
27521
  }, [groupId]);
27528
- const load = React54.useCallback(async () => {
27522
+ const load = React39.useCallback(async () => {
27529
27523
  setLoading(true);
27530
27524
  try {
27531
27525
  const s = await exports.billingService.getGroupBilling(groupId);
@@ -27538,10 +27532,10 @@ var GroupBillingSection = ({ groupId }) => {
27538
27532
  setLoading(false);
27539
27533
  }
27540
27534
  }, [groupId]);
27541
- React54.useEffect(() => {
27535
+ React39.useEffect(() => {
27542
27536
  void load();
27543
27537
  }, [load]);
27544
- React54.useEffect(() => {
27538
+ React39.useEffect(() => {
27545
27539
  const reloadMatchingGroup = (event) => {
27546
27540
  const detail = event.detail;
27547
27541
  if (detail?.groupId === groupId) void load();
@@ -27549,7 +27543,7 @@ var GroupBillingSection = ({ groupId }) => {
27549
27543
  window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
27550
27544
  return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadMatchingGroup);
27551
27545
  }, [groupId, load]);
27552
- const loadMore = React54.useCallback(async () => {
27546
+ const loadMore = React39.useCallback(async () => {
27553
27547
  const last = items[items.length - 1];
27554
27548
  if (!last || moreBusy) return;
27555
27549
  setMoreBusy(true);
@@ -27566,7 +27560,7 @@ var GroupBillingSection = ({ groupId }) => {
27566
27560
  setMoreBusy(false);
27567
27561
  }
27568
27562
  }, [groupId, items, moreBusy]);
27569
- const reactivate = React54.useCallback(async () => {
27563
+ const reactivate = React39.useCallback(async () => {
27570
27564
  setReactivating(true);
27571
27565
  setReactivationError(null);
27572
27566
  try {
@@ -27785,8 +27779,8 @@ var SeriesLine = ({
27785
27779
  formatUsdMicros(Math.round(usd2 * 1e6))
27786
27780
  ] });
27787
27781
  var DailySpendChart = ({ summary }) => {
27788
- const [hovered, setHovered] = React54.useState(null);
27789
- const rows = React54.useMemo(() => {
27782
+ const [hovered, setHovered] = React39.useState(null);
27783
+ const rows = React39.useMemo(() => {
27790
27784
  const byDay = /* @__PURE__ */ new Map();
27791
27785
  for (const p of summary.daily ?? []) {
27792
27786
  const parsed = new Date(p.day);
@@ -27894,7 +27888,7 @@ var BTN = "inline-flex h-8 shrink-0 items-center rounded-md border border-border
27894
27888
  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
27889
  var METER_TRACK = "h-1 overflow-hidden rounded-full bg-raised";
27896
27890
  var BreakdownCard = ({ title, rows, color, minuteRate, labelFor: labelFor2, countNoun }) => {
27897
- const displayRows = React54.useMemo(() => {
27891
+ const displayRows = React39.useMemo(() => {
27898
27892
  if (!labelFor2) return rows;
27899
27893
  const merged = /* @__PURE__ */ new Map();
27900
27894
  for (const r of rows) {
@@ -27957,27 +27951,28 @@ var Banner = ({
27957
27951
  );
27958
27952
  };
27959
27953
  var BillingCenter = ({ dense = false }) => {
27960
- const [summary, setSummary] = React54.useState(null);
27961
- const [pricing, setPricing] = React54.useState(null);
27962
- const [items, setItems] = React54.useState([]);
27963
- const [hasMore, setHasMore] = React54.useState(false);
27964
- const [moreBusy, setMoreBusy] = React54.useState(false);
27965
- const [expandedGroup, setExpandedGroup] = React54.useState(null);
27966
- const [notConfigured, setNotConfigured] = React54.useState(false);
27967
- const [loading, setLoading] = React54.useState(true);
27968
- const [loadError, setLoadError] = React54.useState(null);
27969
- const [portalBusy, setPortalBusy] = React54.useState(false);
27970
- const [portalError, setPortalError] = React54.useState(null);
27971
- const [reactivating, setReactivating] = React54.useState(false);
27972
- const [addCardOpen, setAddCardOpen] = React54.useState(false);
27973
- const [buyCreditsOpen, setBuyCreditsOpen] = React54.useState(false);
27974
- const load = React54.useCallback(async () => {
27954
+ const [summary, setSummary] = React39.useState(null);
27955
+ const [pricing, setPricing] = React39.useState(null);
27956
+ const [items, setItems] = React39.useState([]);
27957
+ const [hasMore, setHasMore] = React39.useState(false);
27958
+ const [moreBusy, setMoreBusy] = React39.useState(false);
27959
+ const [expandedGroup, setExpandedGroup] = React39.useState(null);
27960
+ const [notConfigured, setNotConfigured] = React39.useState(false);
27961
+ const [loading, setLoading] = React39.useState(true);
27962
+ const [loadError, setLoadError] = React39.useState(null);
27963
+ const [portalBusy, setPortalBusy] = React39.useState(false);
27964
+ const [portalError, setPortalError] = React39.useState(null);
27965
+ const [reactivating, setReactivating] = React39.useState(false);
27966
+ const [addCardOpen, setAddCardOpen] = React39.useState(false);
27967
+ const [buyCreditsOpen, setBuyCreditsOpen] = React39.useState(false);
27968
+ const load = React39.useCallback(async () => {
27975
27969
  setLoading(true);
27976
27970
  setLoadError(null);
27977
27971
  try {
27978
27972
  const s = await exports.billingService.getMyBilling();
27973
+ setNotConfigured(s === null);
27979
27974
  if (s === null) {
27980
- setNotConfigured(true);
27975
+ setSummary(null);
27981
27976
  } else {
27982
27977
  setSummary(s);
27983
27978
  setItems(s.recent_line_items);
@@ -27989,16 +27984,16 @@ var BillingCenter = ({ dense = false }) => {
27989
27984
  setLoading(false);
27990
27985
  }
27991
27986
  }, []);
27992
- React54.useEffect(() => {
27987
+ React39.useEffect(() => {
27993
27988
  void load();
27994
- void exports.billingService.getGasPricing().then(setPricing);
27989
+ void exports.billingService.getGasPricing().then(setPricing).catch(() => setPricing(null));
27995
27990
  }, [load]);
27996
- React54.useEffect(() => {
27991
+ React39.useEffect(() => {
27997
27992
  const reloadAfterCheckout = () => void load();
27998
27993
  window.addEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
27999
27994
  return () => window.removeEventListener(exports.CREDIT_CHECKOUT_SYNCED_EVENT, reloadAfterCheckout);
28000
27995
  }, [load]);
28001
- const loadMore = React54.useCallback(async () => {
27996
+ const loadMore = React39.useCallback(async () => {
28002
27997
  const last = items[items.length - 1];
28003
27998
  if (!last || moreBusy) return;
28004
27999
  setMoreBusy(true);
@@ -28012,7 +28007,7 @@ var BillingCenter = ({ dense = false }) => {
28012
28007
  setMoreBusy(false);
28013
28008
  }
28014
28009
  }, [items, moreBusy]);
28015
- const openPortal = React54.useCallback(async () => {
28010
+ const openPortal = React39.useCallback(async () => {
28016
28011
  setPortalBusy(true);
28017
28012
  setPortalError(null);
28018
28013
  try {
@@ -28023,7 +28018,7 @@ var BillingCenter = ({ dense = false }) => {
28023
28018
  setPortalBusy(false);
28024
28019
  }
28025
28020
  }, []);
28026
- const reactivate = React54.useCallback(async () => {
28021
+ const reactivate = React39.useCallback(async () => {
28027
28022
  setReactivating(true);
28028
28023
  setPortalError(null);
28029
28024
  try {
@@ -28036,18 +28031,6 @@ var BillingCenter = ({ dense = false }) => {
28036
28031
  }
28037
28032
  }, [load]);
28038
28033
  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
28034
  const totals = summary?.period_totals ?? [];
28052
28035
  const payableTotal = totals.reduce((acc, t) => acc + t.amount_usd_micros, 0);
28053
28036
  const personalTotal = summary?.spend?.period_usd_micros ?? payableTotal;
@@ -28064,7 +28047,7 @@ var BillingCenter = ({ dense = false }) => {
28064
28047
  const breakdownCount = [llmBreakdown, gasBreakdown, knowledgeBreakdown].filter(
28065
28048
  (rows) => rows.length > 0
28066
28049
  ).length;
28067
- const meterKeys = React54.useMemo(
28050
+ const meterKeys = React39.useMemo(
28068
28051
  () => [
28069
28052
  "llm_usage_usd",
28070
28053
  "gas_usage_usd",
@@ -28078,10 +28061,10 @@ var BillingCenter = ({ dense = false }) => {
28078
28061
  (g) => g.credit_plan_id && g.status === "active"
28079
28062
  ) ?? null;
28080
28063
  const tokenCardGated = billingGateInfoForActiveToken().cardRequired;
28081
- const [sponsorBusy, setSponsorBusy] = React54.useState(false);
28082
- const [sponsorError, setSponsorError] = React54.useState(null);
28083
- const [autoBind, setAutoBind] = React54.useState("idle");
28084
- React54.useEffect(() => {
28064
+ const [sponsorBusy, setSponsorBusy] = React39.useState(false);
28065
+ const [sponsorError, setSponsorError] = React39.useState(null);
28066
+ const [autoBind, setAutoBind] = React39.useState("idle");
28067
+ React39.useEffect(() => {
28085
28068
  if (autoBind !== "idle") return;
28086
28069
  if (!summary?.card_required || !tokenCardGated || !platformGroup) return;
28087
28070
  setAutoBind("trying");
@@ -28089,7 +28072,7 @@ var BillingCenter = ({ dense = false }) => {
28089
28072
  if (bound) await load();
28090
28073
  }).finally(() => setAutoBind("settled"));
28091
28074
  }, [summary, tokenCardGated, platformGroup, autoBind]);
28092
- const billViaGroup = React54.useCallback(async () => {
28075
+ const billViaGroup = React39.useCallback(async () => {
28093
28076
  if (!platformGroup || sponsorBusy) return;
28094
28077
  setSponsorBusy(true);
28095
28078
  setSponsorError(null);
@@ -28123,6 +28106,18 @@ var BillingCenter = ({ dense = false }) => {
28123
28106
  const creditExhausted = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros <= 0;
28124
28107
  const creditLow = prepaidCreditsEnabled && creditPlanId != null && creditBalanceMicros > 0 && creditGrantMicros != null && creditBalanceMicros < creditGrantMicros * 0.15;
28125
28108
  const recoveryAction = summary ? billingRecoveryAction(summary) : null;
28109
+ if (notConfigured) {
28110
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
28111
+ !dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
28112
+ /* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
28113
+ "Usage & billing",
28114
+ !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" })
28115
+ ] }),
28116
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-text-muted", children: "Metered AI and on-chain usage." })
28117
+ ] }),
28118
+ /* @__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." })
28119
+ ] });
28120
+ }
28126
28121
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClass, children: [
28127
28122
  !dense && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
28128
28123
  /* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-lg font-semibold text-text-primary max-sm:sr-only", children: [
@@ -28461,9 +28456,9 @@ var BillingCenter = ({ dense = false }) => {
28461
28456
  init_cardRequired();
28462
28457
  init_billingService();
28463
28458
  var CardRequiredHost = () => {
28464
- const [request, setRequest] = React54.useState(null);
28465
- React54.useEffect(() => exports.cardRequiredGate.subscribe(setRequest), []);
28466
- React54.useEffect(() => {
28459
+ const [request, setRequest] = React39.useState(null);
28460
+ React39.useEffect(() => exports.cardRequiredGate.subscribe(setRequest), []);
28461
+ React39.useEffect(() => {
28467
28462
  let inFlight = false;
28468
28463
  const heal = async () => {
28469
28464
  if (inFlight) return;
@@ -28547,11 +28542,11 @@ var PENDING_RETURN_NOTICE = {
28547
28542
  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
28543
  };
28549
28544
  var CreditExhaustedHost = () => {
28550
- const [request, setRequest] = React54.useState(null);
28551
- const [checkoutNotice, setCheckoutNotice] = React54.useState(null);
28552
- const [retryMarker, setRetryMarker] = React54.useState(null);
28553
- React54.useEffect(() => creditRequiredGate.subscribe(setRequest), []);
28554
- React54.useEffect(() => {
28545
+ const [request, setRequest] = React39.useState(null);
28546
+ const [checkoutNotice, setCheckoutNotice] = React39.useState(null);
28547
+ const [retryMarker, setRetryMarker] = React39.useState(null);
28548
+ React39.useEffect(() => creditRequiredGate.subscribe(setRequest), []);
28549
+ React39.useEffect(() => {
28555
28550
  const parsedMarker = readCreditCheckoutReturnMarker();
28556
28551
  if (!parsedMarker) return;
28557
28552
  const marker = parsedMarker;
@@ -28757,12 +28752,12 @@ function VerifiedBadge({
28757
28752
  }
28758
28753
  function IdentityCard() {
28759
28754
  const { config, isLoading: configLoading } = useProviderConfig();
28760
- const [credentials, setCredentials] = React54.useState([]);
28761
- const [profile, setProfile] = React54.useState(null);
28762
- const [loading, setLoading] = React54.useState(true);
28763
- const [activeKyc, setActiveKyc] = React54.useState(null);
28764
- const [error, setError] = React54.useState(null);
28765
- React54.useEffect(() => {
28755
+ const [credentials, setCredentials] = React39.useState([]);
28756
+ const [profile, setProfile] = React39.useState(null);
28757
+ const [loading, setLoading] = React39.useState(true);
28758
+ const [activeKyc, setActiveKyc] = React39.useState(null);
28759
+ const [error, setError] = React39.useState(null);
28760
+ React39.useEffect(() => {
28766
28761
  let cancelled = false;
28767
28762
  (async () => {
28768
28763
  try {
@@ -28899,10 +28894,10 @@ function LoginAltMethods({ exclude, platform, onSuccess } = {}) {
28899
28894
  const navigate = useWalletNavigate();
28900
28895
  const { bootstrapSession } = useAuth();
28901
28896
  const { config, isLoading } = useProviderConfig();
28902
- const [busyId, setBusyId] = React54.useState(null);
28903
- const [error, setError] = React54.useState(null);
28904
- const [passkeySupported, setPasskeySupported] = React54.useState(false);
28905
- React54.useEffect(() => {
28897
+ const [busyId, setBusyId] = React39.useState(null);
28898
+ const [error, setError] = React39.useState(null);
28899
+ const [passkeySupported, setPasskeySupported] = React39.useState(false);
28900
+ React39.useEffect(() => {
28906
28901
  setPasskeySupported(typeof window !== "undefined" && !!window.PublicKeyCredential);
28907
28902
  }, []);
28908
28903
  if (isLoading || !config) return null;
@@ -29068,25 +29063,25 @@ function useForm({
29068
29063
  schema,
29069
29064
  onSubmit
29070
29065
  }) {
29071
- const [state, setState] = React54.useState({
29066
+ const [state, setState] = React39.useState({
29072
29067
  values: initialValues,
29073
29068
  errors: {},
29074
29069
  touched: {}
29075
29070
  });
29076
- const handleChange = React54.useCallback((name, value) => {
29071
+ const handleChange = React39.useCallback((name, value) => {
29077
29072
  setState((prev) => ({
29078
29073
  ...prev,
29079
29074
  values: { ...prev.values, [name]: value },
29080
29075
  touched: { ...prev.touched, [name]: true }
29081
29076
  }));
29082
29077
  }, []);
29083
- const handleBlur = React54.useCallback((name) => {
29078
+ const handleBlur = React39.useCallback((name) => {
29084
29079
  setState((prev) => ({
29085
29080
  ...prev,
29086
29081
  touched: { ...prev.touched, [name]: true }
29087
29082
  }));
29088
29083
  }, []);
29089
- const validate = React54.useCallback(() => {
29084
+ const validate = React39.useCallback(() => {
29090
29085
  try {
29091
29086
  schema.parse(state.values);
29092
29087
  setState((prev) => ({ ...prev, errors: {} }));
@@ -29102,13 +29097,13 @@ function useForm({
29102
29097
  return false;
29103
29098
  }
29104
29099
  }, [schema, state.values]);
29105
- const handleSubmit = React54.useCallback(async (e) => {
29100
+ const handleSubmit = React39.useCallback(async (e) => {
29106
29101
  e.preventDefault();
29107
29102
  if (validate()) {
29108
29103
  await onSubmit(state.values);
29109
29104
  }
29110
29105
  }, [onSubmit, state.values, validate]);
29111
- const reset = React54.useCallback(() => {
29106
+ const reset = React39.useCallback(() => {
29112
29107
  setState({
29113
29108
  values: initialValues,
29114
29109
  errors: {},
@@ -29153,9 +29148,9 @@ var defaultFormConfig = {
29153
29148
  function useLogin(options = {}) {
29154
29149
  const navigate = useWalletNavigate();
29155
29150
  const { login: contextLogin, isLoading: contextLoading, error: contextError, clearError: contextClearError, user } = useAuth();
29156
- const [isSubmitting, setIsSubmitting] = React54.useState(false);
29157
- const [error, setError] = React54.useState(null);
29158
- const [isAuthenticated, setIsAuthenticated] = React54.useState(exports.authService.isAuthenticated());
29151
+ const [isSubmitting, setIsSubmitting] = React39.useState(false);
29152
+ const [error, setError] = React39.useState(null);
29153
+ const [isAuthenticated, setIsAuthenticated] = React39.useState(exports.authService.isAuthenticated());
29159
29154
  const {
29160
29155
  services = ["vault", "payments"],
29161
29156
  redirectPath = "/dashboard",
@@ -29165,11 +29160,11 @@ function useLogin(options = {}) {
29165
29160
  showErrorMessages = true,
29166
29161
  platform: optionsPlatform
29167
29162
  } = options;
29168
- const clearError = React54.useCallback(() => {
29163
+ const clearError = React39.useCallback(() => {
29169
29164
  setError(null);
29170
29165
  contextClearError();
29171
29166
  }, [contextClearError]);
29172
- const login = React54.useCallback(async (credentials) => {
29167
+ const login = React39.useCallback(async (credentials) => {
29173
29168
  try {
29174
29169
  setIsSubmitting(true);
29175
29170
  setError(null);
@@ -29423,8 +29418,8 @@ function AccessFlowBody({
29423
29418
  onSelectPlatform
29424
29419
  }) {
29425
29420
  const { isAuthenticated } = useAuth();
29426
- const [mode, setMode] = React54.useState(initialMode);
29427
- const handleWizardComplete = React54.useCallback(
29421
+ const [mode, setMode] = React39.useState(initialMode);
29422
+ const handleWizardComplete = React39.useCallback(
29428
29423
  (destination) => {
29429
29424
  if (destination === "/login") {
29430
29425
  setMode("login");
@@ -29477,8 +29472,8 @@ init_chainAccountRequired();
29477
29472
  // src/ui/account/ChainAccountRequiredHost.tsx
29478
29473
  init_chainAccountRequired();
29479
29474
  var ChainAccountRequiredHost = () => {
29480
- const [request, setRequest] = React54.useState(null);
29481
- React54.useEffect(() => exports.chainAccountRequiredGate.subscribe(setRequest), []);
29475
+ const [request, setRequest] = React39.useState(null);
29476
+ React39.useEffect(() => exports.chainAccountRequiredGate.subscribe(setRequest), []);
29482
29477
  if (!request) return null;
29483
29478
  const key = `${request.context.entityKind}:${request.context.entityId}:${request.context.chainId}`;
29484
29479
  return /* @__PURE__ */ jsxRuntime.jsx(ChainAccountActivationDialog, { request }, key);
@@ -29486,10 +29481,10 @@ var ChainAccountRequiredHost = () => {
29486
29481
  var ChainAccountActivationDialog = ({ request }) => {
29487
29482
  const mode = chainAccountMode(request.context);
29488
29483
  const label = mode === "test" ? "Test" : "Live";
29489
- const [started, setStarted] = React54.useState(false);
29490
- const [waitingForVerification, setWaitingForVerification] = React54.useState(false);
29491
- const [status, setStatus] = React54.useState(null);
29492
- const [error, setError] = React54.useState(null);
29484
+ const [started, setStarted] = React39.useState(false);
29485
+ const [waitingForVerification, setWaitingForVerification] = React39.useState(false);
29486
+ const [status, setStatus] = React39.useState(null);
29487
+ const [error, setError] = React39.useState(null);
29493
29488
  async function activate(verificationAttempted = false) {
29494
29489
  setStarted(true);
29495
29490
  setError(null);
@@ -29612,8 +29607,8 @@ init_walletIdentity();
29612
29607
  init_verificationsService();
29613
29608
  init_ProviderConfigContext();
29614
29609
  var VerificationRequiredHost = () => {
29615
- const [request, setRequest] = React54.useState(null);
29616
- React54.useEffect(() => verificationRequiredGate.subscribe(setRequest), []);
29610
+ const [request, setRequest] = React39.useState(null);
29611
+ React39.useEffect(() => verificationRequiredGate.subscribe(setRequest), []);
29617
29612
  if (!request) return null;
29618
29613
  return /* @__PURE__ */ jsxRuntime.jsx(VerificationDialog, { request }, request.context.profile ?? "default");
29619
29614
  };
@@ -29622,12 +29617,12 @@ var VerificationDialog = ({
29622
29617
  }) => {
29623
29618
  const { context } = request;
29624
29619
  const { config } = useProviderConfig();
29625
- const [activeProvider, setActiveProvider] = React54.useState(null);
29626
- const [checking, setChecking] = React54.useState(false);
29627
- const [error, setError] = React54.useState(null);
29628
- const [isGroupManager, setIsGroupManager] = React54.useState(null);
29620
+ const [activeProvider, setActiveProvider] = React39.useState(null);
29621
+ const [checking, setChecking] = React39.useState(false);
29622
+ const [error, setError] = React39.useState(null);
29623
+ const [isGroupManager, setIsGroupManager] = React39.useState(null);
29629
29624
  const hasGroupMiss = context.missing.some((m) => m.subject_kind === "group");
29630
- React54.useEffect(() => {
29625
+ React39.useEffect(() => {
29631
29626
  if (!hasGroupMiss || !context.groupId) return;
29632
29627
  let cancelled = false;
29633
29628
  groupsService.getGroupDetails(context.groupId).then((g) => {
@@ -29804,25 +29799,25 @@ function BusinessVerificationSection({
29804
29799
  initialStatus
29805
29800
  }) {
29806
29801
  const { config } = useProviderConfig();
29807
- const [status, setStatus] = React54__default.default.useState(initialStatus ?? "not_required");
29808
- const [flowInstance, setFlowInstance] = React54__default.default.useState(null);
29809
- const [error, setError] = React54__default.default.useState(null);
29810
- const [busy, setBusy] = React54__default.default.useState(false);
29811
- const kybInstances = React54__default.default.useMemo(
29802
+ const [status, setStatus] = React39__default.default.useState(initialStatus ?? "not_required");
29803
+ const [flowInstance, setFlowInstance] = React39__default.default.useState(null);
29804
+ const [error, setError] = React39__default.default.useState(null);
29805
+ const [busy, setBusy] = React39__default.default.useState(false);
29806
+ const kybInstances = React39__default.default.useMemo(
29812
29807
  () => (config?.kyc.enabled ?? []).filter(
29813
29808
  (id) => config?.kyc.settings[id]?.subject === "group"
29814
29809
  ),
29815
29810
  [config]
29816
29811
  );
29817
29812
  const entityDefault = config?.kyc.entity_default_profile ?? null;
29818
- const refreshStatus = React54__default.default.useCallback(async () => {
29813
+ const refreshStatus = React39__default.default.useCallback(async () => {
29819
29814
  try {
29820
29815
  const s = await getIdentityStatus({ groupId });
29821
29816
  setStatus(s.status === "unverified" ? "unverified" : s.status);
29822
29817
  } catch {
29823
29818
  }
29824
29819
  }, [groupId]);
29825
- React54__default.default.useEffect(() => {
29820
+ React39__default.default.useEffect(() => {
29826
29821
  if (initialStatus !== void 0) setStatus(initialStatus);
29827
29822
  }, [initialStatus]);
29828
29823
  const startFlow = async (bindFirst) => {
@@ -30558,31 +30553,31 @@ function readDelegationGroupId() {
30558
30553
  function useIncomingPayments(options = {}) {
30559
30554
  const { entityId: entityIdOverride, walletId: walletIdOverride, disableLiveRefresh } = options;
30560
30555
  const { user, isAuthenticated } = useAuth();
30561
- const [delegationGroupId, setDelegationGroupId] = React54.useState(
30556
+ const [delegationGroupId, setDelegationGroupId] = React39.useState(
30562
30557
  () => readDelegationGroupId()
30563
30558
  );
30564
- React54.useEffect(() => {
30559
+ React39.useEffect(() => {
30565
30560
  setDelegationGroupId(readDelegationGroupId());
30566
30561
  }, [isAuthenticated, user?.id]);
30567
- const activeEntityId = React54.useMemo(() => {
30562
+ const activeEntityId = React39.useMemo(() => {
30568
30563
  if (entityIdOverride !== void 0) return entityIdOverride;
30569
30564
  if (delegationGroupId) return delegationGroupId;
30570
30565
  return user?.id ?? null;
30571
30566
  }, [entityIdOverride, delegationGroupId, user?.id]);
30572
30567
  const activeWalletId = walletIdOverride ?? user?.default_wallet_id ?? null;
30573
- const [payments, setPayments] = React54.useState([]);
30574
- const [contracts, setContracts] = React54.useState([]);
30575
- const [swaps, setSwaps] = React54.useState([]);
30576
- const [loading, setLoading] = React54.useState(false);
30577
- const [error, setError] = React54.useState(null);
30578
- const [acceptState, setAcceptState] = React54.useState({ itemKey: null, error: null });
30579
- const inflightRef = React54.useRef(null);
30580
- const activeEntityIdRef = React54.useRef(activeEntityId);
30581
- React54.useEffect(() => {
30568
+ const [payments, setPayments] = React39.useState([]);
30569
+ const [contracts, setContracts] = React39.useState([]);
30570
+ const [swaps, setSwaps] = React39.useState([]);
30571
+ const [loading, setLoading] = React39.useState(false);
30572
+ const [error, setError] = React39.useState(null);
30573
+ const [acceptState, setAcceptState] = React39.useState({ itemKey: null, error: null });
30574
+ const inflightRef = React39.useRef(null);
30575
+ const activeEntityIdRef = React39.useRef(activeEntityId);
30576
+ React39.useEffect(() => {
30582
30577
  activeEntityIdRef.current = activeEntityId;
30583
30578
  setDelegationGroupId(readDelegationGroupId());
30584
30579
  });
30585
- const fetchAll = React54.useCallback(async () => {
30580
+ const fetchAll = React39.useCallback(async () => {
30586
30581
  if (!isAuthenticated || !activeEntityId) {
30587
30582
  setPayments([]);
30588
30583
  setContracts([]);
@@ -30633,10 +30628,10 @@ function useIncomingPayments(options = {}) {
30633
30628
  inflightRef.current = work;
30634
30629
  return work;
30635
30630
  }, [isAuthenticated, activeEntityId, activeWalletId]);
30636
- React54.useEffect(() => {
30631
+ React39.useEffect(() => {
30637
30632
  void fetchAll();
30638
30633
  }, [fetchAll]);
30639
- React54.useEffect(() => {
30634
+ React39.useEffect(() => {
30640
30635
  if (disableLiveRefresh) return;
30641
30636
  if (!isAuthenticated || !activeEntityId) return;
30642
30637
  const unsub = subscribeEntityEvents(activeEntityId, (event) => {
@@ -30648,12 +30643,12 @@ function useIncomingPayments(options = {}) {
30648
30643
  unsub();
30649
30644
  };
30650
30645
  }, [isAuthenticated, activeEntityId, disableLiveRefresh, fetchAll]);
30651
- const items = React54.useMemo(
30646
+ const items = React39.useMemo(
30652
30647
  () => buildInbox({ payments, contracts, swaps, activeEntityId }),
30653
30648
  [payments, contracts, swaps, activeEntityId]
30654
30649
  );
30655
- const groups = React54.useMemo(() => groupInbox(items), [items]);
30656
- const accept = React54.useCallback(
30650
+ const groups = React39.useMemo(() => groupInbox(items), [items]);
30651
+ const accept = React39.useCallback(
30657
30652
  async (item) => {
30658
30653
  setAcceptState({ itemKey: item.key, error: null });
30659
30654
  try {
@@ -30678,7 +30673,7 @@ function useIncomingPayments(options = {}) {
30678
30673
  },
30679
30674
  []
30680
30675
  );
30681
- const cancel = React54.useCallback(async (paymentId) => {
30676
+ const cancel = React39.useCallback(async (paymentId) => {
30682
30677
  try {
30683
30678
  await paymentsService.cancelPayment({ paymentId });
30684
30679
  setPayments((prev) => prev.filter((p) => p.id !== paymentId));
@@ -30707,14 +30702,14 @@ function resetDecimalsWarningCache() {
30707
30702
  warnedTokenIds.clear();
30708
30703
  }
30709
30704
  function useDecimalsCore(payments, walletAddress) {
30710
- const [cache2, setCache] = React54.useState(/* @__PURE__ */ new Map());
30711
- const [cacheErrors, setCacheErrors] = React54.useState(/* @__PURE__ */ new Map());
30712
- const fetchingRef = React54.useRef(/* @__PURE__ */ new Set());
30713
- const cacheRef = React54.useRef(cache2);
30714
- React54.useEffect(() => {
30705
+ const [cache2, setCache] = React39.useState(/* @__PURE__ */ new Map());
30706
+ const [cacheErrors, setCacheErrors] = React39.useState(/* @__PURE__ */ new Map());
30707
+ const fetchingRef = React39.useRef(/* @__PURE__ */ new Set());
30708
+ const cacheRef = React39.useRef(cache2);
30709
+ React39.useEffect(() => {
30715
30710
  cacheRef.current = cache2;
30716
30711
  }, [cache2]);
30717
- React54.useEffect(() => {
30712
+ React39.useEffect(() => {
30718
30713
  if (!payments || payments.length === 0) return;
30719
30714
  const todo = /* @__PURE__ */ new Set();
30720
30715
  for (const payment of payments) {
@@ -30805,7 +30800,7 @@ function useDecimalsCore(payments, walletAddress) {
30805
30800
  todo.forEach((id) => fetchingRef.current.delete(id));
30806
30801
  };
30807
30802
  }, [payments, walletAddress]);
30808
- return React54.useMemo(() => ({ cache: cache2, cacheErrors }), [cache2, cacheErrors]);
30803
+ return React39.useMemo(() => ({ cache: cache2, cacheErrors }), [cache2, cacheErrors]);
30809
30804
  }
30810
30805
  function usePaymentDecimals(payments, walletAddress) {
30811
30806
  const { cache: cache2 } = useDecimalsCore(payments, walletAddress);
@@ -31010,7 +31005,7 @@ var IncomingPaymentsInbox = ({
31010
31005
  ...hookOptions
31011
31006
  }) => {
31012
31007
  const inbox = useIncomingPayments(hookOptions);
31013
- const allPayments = React54__default.default.useMemo(
31008
+ const allPayments = React39__default.default.useMemo(
31014
31009
  () => [
31015
31010
  ...inbox.payments,
31016
31011
  ...inbox.contracts.flatMap((c) => c.payments ?? [])
@@ -31171,7 +31166,7 @@ var IncomingPaymentsLauncher = ({
31171
31166
  }) => {
31172
31167
  const { isAuthenticated } = useAuth();
31173
31168
  const inbox = useIncomingPayments(hookOptions);
31174
- const [open, setOpen] = React54.useState(false);
31169
+ const [open, setOpen] = React39.useState(false);
31175
31170
  if (hideWhenSignedOut && !isAuthenticated) return null;
31176
31171
  const handleClick = onClick ?? (() => setOpen(true));
31177
31172
  const count = inbox.items.length;
@@ -31301,11 +31296,11 @@ function SummaryTile({ label, count }) {
31301
31296
  ] });
31302
31297
  }
31303
31298
  function useSendPayment() {
31304
- const [sending, setSending] = React54.useState(false);
31305
- const [error, setError] = React54.useState(null);
31306
- const [lastResponse, setLastResponse] = React54.useState(null);
31307
- const inflightRef = React54.useRef(null);
31308
- const send = React54.useCallback(async (args) => {
31299
+ const [sending, setSending] = React39.useState(false);
31300
+ const [error, setError] = React39.useState(null);
31301
+ const [lastResponse, setLastResponse] = React39.useState(null);
31302
+ const inflightRef = React39.useRef(null);
31303
+ const send = React39.useCallback(async (args) => {
31309
31304
  if (inflightRef.current) {
31310
31305
  return inflightRef.current;
31311
31306
  }
@@ -31333,7 +31328,7 @@ function useSendPayment() {
31333
31328
  inflightRef.current = work;
31334
31329
  return work;
31335
31330
  }, []);
31336
- const reset = React54.useCallback(() => {
31331
+ const reset = React39.useCallback(() => {
31337
31332
  setError(null);
31338
31333
  setLastResponse(null);
31339
31334
  }, []);
@@ -31351,13 +31346,13 @@ var SendPaymentForm = ({
31351
31346
  className = ""
31352
31347
  }) => {
31353
31348
  const initialAssetId = (defaultAssetId && assets.find((a) => a.id === defaultAssetId)?.id) ?? assets[0]?.id ?? "";
31354
- const [assetId, setAssetId] = React54.useState(initialAssetId);
31355
- const [amount, setAmount] = React54.useState(defaultAmount);
31356
- const [recipient, setRecipient] = React54.useState(defaultRecipient);
31357
- const [recipientMode, setRecipientMode] = React54.useState("entity");
31358
- const [description, setDescription] = React54.useState("");
31359
- const [validationError, setValidationError] = React54.useState(null);
31360
- React54.useEffect(() => {
31349
+ const [assetId, setAssetId] = React39.useState(initialAssetId);
31350
+ const [amount, setAmount] = React39.useState(defaultAmount);
31351
+ const [recipient, setRecipient] = React39.useState(defaultRecipient);
31352
+ const [recipientMode, setRecipientMode] = React39.useState("entity");
31353
+ const [description, setDescription] = React39.useState("");
31354
+ const [validationError, setValidationError] = React39.useState(null);
31355
+ React39.useEffect(() => {
31361
31356
  if (assetId === "" && assets.length > 0) {
31362
31357
  setAssetId(assets[0].id);
31363
31358
  } else if (assetId && !assets.find((a) => a.id === assetId)) {