@openfort/react 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { ChainTypeEnum } from '@openfort/openfort-js';
3
- import { useState, useMemo, useEffect } from 'react';
3
+ import { useState, useMemo, useRef, useEffect } from 'react';
4
4
  import Logos from '../../../assets/logos.js';
5
5
  import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
6
6
  import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
@@ -44,10 +44,16 @@ const BuyProcessing = () => {
44
44
  return null;
45
45
  return numeric;
46
46
  }, [buyForm.amount]);
47
- // Create session and open popup on mount
47
+ // Create session and open popup once wallet is ready
48
+ const sessionStartedRef = useRef(false);
48
49
  useEffect(() => {
50
+ if (!address || !chainId)
51
+ return;
52
+ if (sessionStartedRef.current)
53
+ return;
54
+ sessionStartedRef.current = true;
49
55
  const createSessionAndOpenPopup = async () => {
50
- if (!address || !chainId || !fiatAmount || fiatAmount <= 0) {
56
+ if (!fiatAmount || fiatAmount <= 0) {
51
57
  setRoute(routes.BUY_SELECT_PROVIDER);
52
58
  return;
53
59
  }
@@ -123,7 +129,7 @@ const BuyProcessing = () => {
123
129
  }
124
130
  };
125
131
  createSessionAndOpenPopup();
126
- }, []); // Only run once on mount
132
+ }, [address, chainId]); // Run when wallet becomes ready
127
133
  // Trigger resize on mount and when state changes
128
134
  useEffect(() => {
129
135
  triggerResize();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -132,8 +132,6 @@ const BuySelectProvider = () => {
132
132
  }));
133
133
  };
134
134
  const handleContinue = () => {
135
- // Just navigate to the processing screen
136
- // The processing screen will handle session creation and popup
137
135
  setRoute(routes.BUY_PROCESSING);
138
136
  };
139
137
  const handleBack = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- export declare const OPENFORT_VERSION = "1.0.5";
1
+ export declare const OPENFORT_VERSION = "1.0.6";
package/build/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const OPENFORT_VERSION = '1.0.5';
1
+ const OPENFORT_VERSION = '1.0.6';
2
2
 
3
3
  export { OPENFORT_VERSION };
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/react",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "author": "Openfort (https://www.openfort.io)",
5
5
  "license": "BSD-2-Clause license",
6
6
  "description": "The easiest way to integrate Openfort to your project.",