@pooflabs/core 0.0.23 → 0.0.25

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,4 +1,35 @@
1
1
  import { AuthProvider } from '../types';
2
+ /**
3
+ * Context passed to the redirect URL resolver function.
4
+ * Allows dynamic redirect URL selection based on the current environment.
5
+ */
6
+ export interface RedirectUrlContext {
7
+ /** The current platform (best effort detection) */
8
+ platform: 'android' | 'ios' | 'web' | 'unknown';
9
+ /** The user agent string */
10
+ userAgent: string;
11
+ /** Whether this appears to be a WebView */
12
+ isWebView: boolean;
13
+ /** The current URL origin */
14
+ origin: string;
15
+ }
16
+ /**
17
+ * Redirect URL can be a static string or a function that returns a string.
18
+ * Using a function allows dynamic selection based on platform/environment.
19
+ *
20
+ * @example
21
+ * // Static string
22
+ * redirectUrl: 'seekerwheel://callback'
23
+ *
24
+ * @example
25
+ * // Dynamic function
26
+ * redirectUrl: (context) => {
27
+ * if (context.platform === 'android') return 'seekerwheel://callback';
28
+ * if (context.platform === 'ios') return 'seekerwheel://callback';
29
+ * return context.origin; // web fallback
30
+ * }
31
+ */
32
+ export type RedirectUrlResolver = string | ((context: RedirectUrlContext) => string);
2
33
  export interface ClientConfig {
3
34
  name: string;
4
35
  logoUrl: string;
@@ -13,6 +44,27 @@ export interface ClientConfig {
13
44
  skipBackendInit: boolean;
14
45
  authProvider: AuthProvider | null;
15
46
  isServer: boolean;
47
+ /**
48
+ * Custom redirect URL for OAuth flows.
49
+ * Can be a static string or a function that dynamically determines the URL based on platform.
50
+ * Required for Android/iOS apps with custom URI schemes (e.g., 'seekerwheel://callback').
51
+ * This tells the wallet/OAuth provider where to redirect after authentication.
52
+ * Works with both Privy and Phantom auth methods.
53
+ *
54
+ * @example
55
+ * // Static - always use custom scheme
56
+ * redirectUrl: 'seekerwheel://callback'
57
+ *
58
+ * @example
59
+ * // Dynamic - use custom scheme only on mobile
60
+ * redirectUrl: (context) => {
61
+ * if (context.platform === 'android' || context.platform === 'ios') {
62
+ * return 'seekerwheel://callback';
63
+ * }
64
+ * return context.origin; // web uses standard redirect
65
+ * }
66
+ */
67
+ redirectUrl?: RedirectUrlResolver;
16
68
  privyConfig?: {
17
69
  appId: string;
18
70
  config: any;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { init } from './client/config';
2
- export { getConfig, ClientConfig } from './client/config';
2
+ export { getConfig, ClientConfig, RedirectUrlContext, RedirectUrlResolver } from './client/config';
3
3
  export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, runExpression, runExpressionMany, signMessage, signTransaction, signAndSubmitTransaction, SetOptions, RunExpressionOptions, RunExpressionResult } from './client/operations';
4
4
  export { subscribe, closeAllSubscriptions, clearCache, getCachedData, reconnectWithNewAuth } from './client/subscription';
5
5
  export * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pooflabs/core",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "Core functionality for Poof SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",