@pooflabs/web 0.0.54 → 0.0.56

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.
@@ -13086,7 +13086,7 @@ async function loadDependencies() {
13086
13086
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
13087
13087
  import('react'),
13088
13088
  import('react-dom/client'),
13089
- Promise.resolve().then(function () { return require('./index-dUcbbUey.js'); })
13089
+ Promise.resolve().then(function () { return require('./index-Bd_yX1y8.js'); })
13090
13090
  ]);
13091
13091
  // Extract default export from ESM module namespace
13092
13092
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -13196,6 +13196,11 @@ class PhantomWalletProvider {
13196
13196
  existingProviders.forEach(el => el.remove());
13197
13197
  this.containerElement = document.createElement('div');
13198
13198
  this.containerElement.setAttribute('data-phantom-provider', 'true');
13199
+ // Keep the provider root above host app overlays/modals and clickable.
13200
+ this.containerElement.style.position = 'fixed';
13201
+ this.containerElement.style.inset = '0';
13202
+ this.containerElement.style.zIndex = '2147483647';
13203
+ this.containerElement.style.pointerEvents = 'auto';
13199
13204
  document.body.appendChild(this.containerElement);
13200
13205
  const that = this;
13201
13206
  const { PhantomProvider: ReactPhantomProvider, usePhantom, useConnect, useDisconnect, useModal, useSolana, useDiscoveredWallets, AddressType, darkTheme, lightTheme } = phantomReactSdk;
@@ -13220,6 +13225,8 @@ class PhantomWalletProvider {
13220
13225
  const showDeeplink = isMobile && sdkProviders.includes('deeplink') && !hasPhantomInjected;
13221
13226
  // Track previous modal state to detect closes
13222
13227
  const prevModalOpen = React$1.useRef(false);
13228
+ // Track when modal was closed because user selected a wallet (not dismissed)
13229
+ const walletClickedRef = React$1.useRef(false);
13223
13230
  // Set up effect to expose methods to the class
13224
13231
  React$1.useEffect(() => {
13225
13232
  if (phantom) {
@@ -13327,9 +13334,12 @@ class PhantomWalletProvider {
13327
13334
  React$1.useEffect(() => {
13328
13335
  // Detect when modal was open and is now closed
13329
13336
  if (prevModalOpen.current && !showWalletModal && !modal.isOpened) {
13330
- // Modal just closed
13331
- if (that.loginInProgress && that.pendingLogin && !(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected)) {
13332
- // User closed modal without connecting
13337
+ if (walletClickedRef.current) {
13338
+ // Modal closed because user selected a wallet don't reject
13339
+ walletClickedRef.current = false;
13340
+ }
13341
+ else if (that.loginInProgress && that.pendingLogin && !(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected)) {
13342
+ // User dismissed modal without connecting
13333
13343
  that.pendingLogin.reject(new Error('User cancelled login'));
13334
13344
  that.pendingLogin = null;
13335
13345
  that.loginInProgress = false;
@@ -13337,6 +13347,28 @@ class PhantomWalletProvider {
13337
13347
  }
13338
13348
  prevModalOpen.current = showWalletModal || modal.isOpened;
13339
13349
  }, [showWalletModal, modal.isOpened, phantom === null || phantom === void 0 ? void 0 : phantom.isConnected]);
13350
+ // While custom modal is open, block pointer events on everything behind it.
13351
+ // This guarantees host app modals (e.g. z-50 stacks) can't steal clicks.
13352
+ React$1.useEffect(() => {
13353
+ if (!showWalletModal)
13354
+ return;
13355
+ const container = that.containerElement;
13356
+ if (!container || typeof document === 'undefined')
13357
+ return;
13358
+ const restored = new Map();
13359
+ const bodyChildren = Array.from(document.body.children);
13360
+ for (const el of bodyChildren) {
13361
+ if (el === container)
13362
+ continue;
13363
+ restored.set(el, el.style.pointerEvents);
13364
+ el.style.pointerEvents = 'none';
13365
+ }
13366
+ return () => {
13367
+ for (const [el, prev] of restored.entries()) {
13368
+ el.style.pointerEvents = prev;
13369
+ }
13370
+ };
13371
+ }, [showWalletModal]);
13340
13372
  // Handle connection errors
13341
13373
  React$1.useEffect(() => {
13342
13374
  if (connectError && that.pendingLogin) {
@@ -13418,6 +13450,7 @@ class PhantomWalletProvider {
13418
13450
  }, [phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, solana, solana === null || solana === void 0 ? void 0 : solana.connected, solanaHook.isAvailable]);
13419
13451
  // --- Custom wallet modal handlers ---
13420
13452
  const handleWalletClick = async (options) => {
13453
+ walletClickedRef.current = true;
13421
13454
  setShowWalletModal(false);
13422
13455
  try {
13423
13456
  if (options === null || options === void 0 ? void 0 : options.walletId) {
@@ -13436,6 +13469,7 @@ class PhantomWalletProvider {
13436
13469
  };
13437
13470
  const handleEmailClick = async () => {
13438
13471
  that.loginInProgress = false;
13472
+ walletClickedRef.current = true;
13439
13473
  setShowWalletModal(false);
13440
13474
  if (that.onSwitchToPrivy) {
13441
13475
  try {
@@ -13565,12 +13599,19 @@ class PhantomWalletProvider {
13565
13599
  display: 'flex',
13566
13600
  alignItems: 'center',
13567
13601
  justifyContent: 'center',
13568
- zIndex: '10000',
13602
+ zIndex: 2147483647,
13603
+ pointerEvents: 'auto',
13569
13604
  },
13570
13605
  onClick: (e) => {
13571
13606
  if (e.target === e.currentTarget)
13572
13607
  handleCloseModal();
13573
13608
  },
13609
+ onMouseDown: (e) => {
13610
+ e.stopPropagation();
13611
+ },
13612
+ onPointerDown: (e) => {
13613
+ e.stopPropagation();
13614
+ },
13574
13615
  },
13575
13616
  // Card
13576
13617
  React$1.createElement('div', {
@@ -13582,6 +13623,13 @@ class PhantomWalletProvider {
13582
13623
  padding: '24px',
13583
13624
  position: 'relative',
13584
13625
  boxShadow: '0 20px 60px rgba(0,0,0,0.3)',
13626
+ pointerEvents: 'auto',
13627
+ },
13628
+ onMouseDown: (e) => {
13629
+ e.stopPropagation();
13630
+ },
13631
+ onPointerDown: (e) => {
13632
+ e.stopPropagation();
13585
13633
  },
13586
13634
  },
13587
13635
  // Close button (X)
@@ -34675,4 +34723,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
34675
34723
  exports.signTransaction = signTransaction;
34676
34724
  exports.subscribe = subscribe;
34677
34725
  exports.useAuth = useAuth;
34678
- //# sourceMappingURL=index-C1167UGQ.js.map
34726
+ //# sourceMappingURL=index-ijV9nNFI.js.map