@pooflabs/web 0.0.45 → 0.0.46

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,5 +1,5 @@
1
1
  export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from "./providers/phantom-wallet-provider";
2
- export { PrivyWalletProvider } from "./providers/privy-wallet-provider";
2
+ export { PrivyWalletProvider, RedirectUrlContext, RedirectUrlResolver, } from "./providers/privy-wallet-provider";
3
3
  export { MockAuthProvider, DEFAULT_TEST_ADDRESS, } from "./providers/mock-auth-provider";
4
4
  export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./providers/offchain-auth-provider";
5
5
  import { AuthProvider, User, ClientConfig } from "@pooflabs/core";
@@ -1,5 +1,36 @@
1
1
  import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
2
2
  import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
3
+ /**
4
+ * Context passed to the redirect URL resolver function.
5
+ * Allows dynamic redirect URL selection based on the current environment.
6
+ */
7
+ export interface RedirectUrlContext {
8
+ /** The current platform (best effort detection) */
9
+ platform: 'android' | 'ios' | 'web' | 'unknown';
10
+ /** The user agent string */
11
+ userAgent: string;
12
+ /** Whether this appears to be a WebView */
13
+ isWebView: boolean;
14
+ /** The current URL origin */
15
+ origin: string;
16
+ }
17
+ /**
18
+ * Redirect URL can be a static string or a function that returns a string.
19
+ * Using a function allows dynamic selection based on platform/environment.
20
+ *
21
+ * @example
22
+ * // Static string
23
+ * redirectUrl: 'seekerwheel://callback'
24
+ *
25
+ * @example
26
+ * // Dynamic function
27
+ * redirectUrl: (context) => {
28
+ * if (context.platform === 'android') return 'seekerwheel://callback';
29
+ * if (context.platform === 'ios') return 'seekerwheel://callback';
30
+ * return context.origin; // web fallback
31
+ * }
32
+ */
33
+ export type RedirectUrlResolver = string | ((context: RedirectUrlContext) => string);
3
34
  export declare class PrivyWalletProvider implements AuthProvider {
4
35
  private static instance;
5
36
  private containerElement;
@@ -9,15 +40,71 @@ export declare class PrivyWalletProvider implements AuthProvider {
9
40
  private privyMethods;
10
41
  private privyConfig;
11
42
  private pendingLogin;
43
+ /**
44
+ * Custom redirect URL for OAuth flows.
45
+ * Can be a static string or a function that dynamically determines the URL.
46
+ * Required for Android/iOS apps with custom URI schemes (e.g., 'seekerwheel://callback').
47
+ */
48
+ private redirectUrl;
12
49
  private pendingTransaction;
13
50
  private pendingSignTransaction;
14
51
  private pendingSignMessage;
15
52
  private pendingSignAndSubmitTransaction;
53
+ /**
54
+ * Create a new PrivyWalletProvider instance.
55
+ *
56
+ * @param appName - App name displayed in the Privy modal
57
+ * @param appLogoUrl - App logo URL displayed in the Privy modal
58
+ * @param privyConfig - Custom Privy configuration (optional, uses default if not provided)
59
+ * @param networkUrl - Custom RPC URL (optional)
60
+ * @param redirectUrl - Custom redirect URL for OAuth flows. Can be a string or a function
61
+ * that returns a string based on the current context (platform, WebView, etc.)
62
+ *
63
+ * @example
64
+ * // Static string
65
+ * new PrivyWalletProvider('MyApp', null, null, null, 'seekerwheel://callback')
66
+ *
67
+ * @example
68
+ * // Dynamic function
69
+ * new PrivyWalletProvider('MyApp', null, null, null, (context) => {
70
+ * if (context.platform === 'android' || context.platform === 'ios') {
71
+ * return 'seekerwheel://callback';
72
+ * }
73
+ * return context.origin; // web fallback
74
+ * })
75
+ */
16
76
  constructor(appName: string | null, appLogoUrl: string | null, privyConfig?: {
17
77
  appId: string;
18
78
  config: any;
19
- }, networkUrl?: string | null);
20
- static getInstance(appName: string | null, appLogoUrl: string | null, privyConfig: any): PrivyWalletProvider;
79
+ }, networkUrl?: string | null, redirectUrl?: RedirectUrlResolver | null);
80
+ static getInstance(appName: string | null, appLogoUrl: string | null, privyConfig: any, networkUrl?: string | null, redirectUrl?: RedirectUrlResolver | null): PrivyWalletProvider;
81
+ /**
82
+ * Get the resolved redirect URL for OAuth flows.
83
+ * If a function was provided, it will be called with the current context.
84
+ *
85
+ * IMPORTANT: This URL must be added to your Privy Dashboard under
86
+ * "Allowed OAuth Redirect URLs" for social OAuth (Google, Apple, etc.) to work.
87
+ *
88
+ * For Android apps:
89
+ * 1. Add an intent filter in AndroidManifest.xml for your custom scheme
90
+ * 2. Add the scheme (e.g., 'seekerwheel://callback') to Privy Dashboard
91
+ * 3. Pass the same URL as `redirectUrl` when initializing the SDK
92
+ *
93
+ * For iOS apps:
94
+ * 1. Add the URL scheme to Info.plist under CFBundleURLTypes
95
+ * 2. Add the scheme to Privy Dashboard
96
+ * 3. Pass the same URL as `redirectUrl` when initializing the SDK
97
+ *
98
+ * @returns The resolved redirect URL or null if not set
99
+ */
100
+ getRedirectUrl(): string | null;
101
+ /**
102
+ * Get the current redirect URL context.
103
+ * Useful for debugging or determining what platform was detected.
104
+ *
105
+ * @returns The context object with platform, userAgent, isWebView, and origin
106
+ */
107
+ getRedirectUrlContext(): RedirectUrlContext;
21
108
  private initialize;
22
109
  login(): Promise<User | null>;
23
110
  getNativeMethods(): Promise<any>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useContext, createContext, useState, useMemo, useRef, useEffect, useCallback } from 'react';
3
3
  import globalAxios, { isAxiosError } from 'axios';
4
- import { b as bufferExports, g as getDefaultExportFromCjs } from './index-B3v_lUWN.esm.js';
4
+ import { b as bufferExports, g as getDefaultExportFromCjs } from './index-Cwg0PKbk.esm.js';
5
5
  import { Transaction as Transaction$1, VersionedTransaction } from '@solana/web3.js';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import '@coral-xyz/anchor';
@@ -16499,4 +16499,4 @@ function ConnectBox({ maxWidth = "350px", transparent = false, appIcon, appName
16499
16499
  }
16500
16500
 
16501
16501
  export { DerivationInfoAddressFormatEnum as AddressType, ConnectBox, ConnectButton, DebugLevel, NetworkId, PhantomProvider, darkTheme, debug, isMobileDevice, lightTheme, mergeTheme, useAccounts, useAutoConfirm, useConnect, useDisconnect, useDiscoveredWallets, useEthereum, useIsExtensionInstalled, useIsPhantomLoginAvailable, useModal, usePhantom, useSolana, useTheme };
16502
- //# sourceMappingURL=index-BwHoGmVJ.esm.js.map
16502
+ //# sourceMappingURL=index-BwzodgFt.esm.js.map