@alien_org/react 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ function setSafeAreaCssVars(insets) {
36
36
  */
37
37
  function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
38
38
  const readySent = (0, react.useRef)(false);
39
+ const launchParamsLoaded = (0, react.useRef)(false);
39
40
  const ready = (0, react.useCallback)(() => {
40
41
  if (readySent.current) return;
41
42
  readySent.current = true;
@@ -50,6 +51,7 @@ function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
50
51
  useIsomorphicLayoutEffect$1(() => {
51
52
  const launchParams = (0, _alien_org_bridge.getLaunchParams)();
52
53
  const bridgeAvailable = (0, _alien_org_bridge.isBridgeAvailable)();
54
+ launchParamsLoaded.current = !!launchParams;
53
55
  setValue({
54
56
  authToken: launchParams?.authToken,
55
57
  contractVersion: launchParams?.contractVersion,
@@ -60,7 +62,7 @@ function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
60
62
  if (!bridgeAvailable) console.warn("[@alien_org/react] Bridge is not available. Running in dev mode? The SDK will handle errors gracefully, but bridge communication will not work.");
61
63
  }, [ready]);
62
64
  (0, react.useEffect)(() => {
63
- if (autoReady) ready();
65
+ if (autoReady && launchParamsLoaded.current) ready();
64
66
  }, [autoReady, ready]);
65
67
  (0, react.useEffect)(() => {
66
68
  if (interceptLinks) return (0, _alien_org_bridge.enableLinkInterceptor)();
package/dist/index.mjs CHANGED
@@ -36,6 +36,7 @@ function setSafeAreaCssVars(insets) {
36
36
  */
37
37
  function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
38
38
  const readySent = useRef(false);
39
+ const launchParamsLoaded = useRef(false);
39
40
  const ready = useCallback(() => {
40
41
  if (readySent.current) return;
41
42
  readySent.current = true;
@@ -50,6 +51,7 @@ function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
50
51
  useIsomorphicLayoutEffect$1(() => {
51
52
  const launchParams = getLaunchParams();
52
53
  const bridgeAvailable = isBridgeAvailable();
54
+ launchParamsLoaded.current = !!launchParams;
53
55
  setValue({
54
56
  authToken: launchParams?.authToken,
55
57
  contractVersion: launchParams?.contractVersion,
@@ -60,7 +62,7 @@ function AlienProvider({ children, autoReady = true, interceptLinks = true }) {
60
62
  if (!bridgeAvailable) console.warn("[@alien_org/react] Bridge is not available. Running in dev mode? The SDK will handle errors gracefully, but bridge communication will not work.");
61
63
  }, [ready]);
62
64
  useEffect(() => {
63
- if (autoReady) ready();
65
+ if (autoReady && launchParamsLoaded.current) ready();
64
66
  }, [autoReady, ready]);
65
67
  useEffect(() => {
66
68
  if (interceptLinks) return enableLinkInterceptor();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/react",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",