@yodlpay/react-native 0.1.2 → 0.2.0

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.d.cts CHANGED
@@ -2,6 +2,10 @@ import { ViewStyle } from "react-native";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/types.d.ts
5
+ /** Any JSON-RPC payload value — used wherever provider params/results cross the wire. */
6
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
7
+ [key: string]: JsonValue;
8
+ };
5
9
  /**
6
10
  * Minimal EIP-1193 provider interface.
7
11
  * Works with any wallet SDK: Privy, MetaMask, Coinbase, Rainbow, WalletConnect, etc.
@@ -9,8 +13,8 @@ import { ReactNode } from "react";
9
13
  interface EIP1193Provider {
10
14
  request: (args: {
11
15
  method: string;
12
- params?: unknown[];
13
- }) => Promise<unknown>;
16
+ params?: JsonValue[] | object;
17
+ }) => Promise<JsonValue>;
14
18
  }
15
19
  type SupportedChainIds = number[];
16
20
  type YodlPaymentLifecycleStatus = 'submitted' | 'processing' | 'success' | 'failure';
@@ -55,7 +59,7 @@ interface YodlPaymentDetails {
55
59
  streakMultiplier?: string;
56
60
  berserMultiplier?: number;
57
61
  };
58
- raw?: unknown;
62
+ raw?: JsonValue;
59
63
  }
60
64
  /** Runtime wallet connection shared across the provider, context, and Yodl UI host. */
61
65
  interface YodlWallet {
@@ -80,6 +84,12 @@ interface YodlEventHandlers {
80
84
  /** Props shared by the Yodl UI components (YodlPayment, YodlDashboard). */
81
85
  interface YodlComponentProps extends YodlEventHandlers {
82
86
  style?: ViewStyle;
87
+ /**
88
+ * Color painted behind the WebView and in the loading overlay while the Yodl
89
+ * UI loads, preventing a white flash before the page's first paint. Defaults
90
+ * to the Yodl UI's dark theme (#18181b).
91
+ */
92
+ backgroundColor?: string;
83
93
  }
84
94
  //#endregion
85
95
  //#region src/components/YodlDashboard.d.ts
@@ -93,31 +103,38 @@ declare function YodlDashboard({
93
103
  onTransactionSent,
94
104
  onPaymentDetails,
95
105
  onError,
96
- style
106
+ style,
107
+ backgroundColor
97
108
  }: YodlDashboardProps): import("react/jsx-runtime").JSX.Element;
98
109
  //#endregion
99
110
  //#region src/components/YodlPayment.d.ts
100
111
  interface YodlPaymentProps extends YodlComponentProps {
101
- /** Raw QR data string — the component builds the Yodl UI URL internally. */
112
+ /** Raw scanned QR data. The component resolves it to the Yodl UI URL. */
102
113
  qrData: string;
103
114
  }
104
115
  /**
105
116
  * Renders the Yodl payment flow for a scanned QR code. Reads the SDK instance
106
- * and wallet state from <YodlProvider>. The Yodl UI is origin-locked to the
107
- * configured Yodl host.
117
+ * and wallet state from <YodlProvider> and resolves the QR to the Yodl UI URL
118
+ * (e.g. the `/resolve` screen on the configured host). The Yodl UI is
119
+ * origin-locked to that host. Renders nothing for empty/unsupported QR data.
108
120
  */
109
121
  declare function YodlPayment({
110
122
  qrData,
111
123
  onTransactionSent,
112
124
  onPaymentDetails,
113
125
  onError,
114
- style
126
+ style,
127
+ backgroundColor
115
128
  }: YodlPaymentProps): import("react/jsx-runtime").JSX.Element | null;
116
129
  //#endregion
117
130
  //#region src/sdk/yodl.d.ts
118
131
  /**
119
132
  * App-host configuration for the Yodl React Native SDK.
120
133
  * Injected once via {@link createSdk}.
134
+ *
135
+ * No RPC endpoint is needed: the embedded Yodl UI reads chain state through its
136
+ * own provider, and the injected wallet bridge only forwards signing/wallet
137
+ * methods to the host wallet.
121
138
  */
122
139
  interface YodlConfig {
123
140
  /** Identifies the SDK integrator/wallet app in Yodl-owned request headers. */
@@ -132,24 +149,13 @@ type ResolvedYodlConfig = Omit<YodlConfig, 'yodlUiBaseUrl'> & {
132
149
  yodlUiBaseUrl: string;
133
150
  };
134
151
  /**
135
- * The Yodl SDK instance. Mirrors the namespaced shape of `@yodlpay/sdk-core`
136
- * (e.g. `sdk.qr.*`) while wrapping — never re-exporting — sdk-core internals.
152
+ * The Yodl SDK instance. Holds the resolved app config that `<YodlProvider>`
153
+ * and the components read at runtime. Stateless QR helpers are exported as
154
+ * standalone functions (e.g. {@link isPaymentQr}) rather than instance methods.
137
155
  */
138
156
  declare class Yodl {
139
157
  readonly config: ResolvedYodlConfig;
140
158
  constructor(config: YodlConfig);
141
- get qr(): {
142
- /**
143
- * Returns true if the QR data is a Yodl-supported payment QR code.
144
- * Accepts a single string or an array — true if any entry is supported.
145
- */
146
- isPaymentQr(qrData: string | string[]): boolean;
147
- };
148
- /**
149
- * Warm up SDK caches ahead of a payment. No-op today — reserved for future
150
- * prefetching of rates, token lists, and processor metadata.
151
- */
152
- prefetch(): Promise<void>;
153
159
  }
154
160
  /**
155
161
  * Create a Yodl SDK instance. Factory pattern, consistent with
@@ -181,4 +187,16 @@ declare function YodlProvider({
181
187
  children
182
188
  }: YodlProviderProps): import("react/jsx-runtime").JSX.Element;
183
189
  //#endregion
184
- export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk };
190
+ //#region src/sdk/qr.d.ts
191
+ /**
192
+ * Returns true if the QR data is a Yodl-supported payment QR code — one the SDK
193
+ * can route to the resolve flow that `<YodlPayment>` renders. Accepts a single
194
+ * string or an array (true if any entry is supported). Provider-hosted
195
+ * `webview`-action QRs are not handled and return false.
196
+ *
197
+ * Pure helper: no SDK instance or config needed, so it can guard a render
198
+ * before `<YodlProvider>` is mounted.
199
+ */
200
+ declare function isPaymentQr(qrData: string | string[]): boolean;
201
+ //#endregion
202
+ export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk, isPaymentQr };
package/dist/index.d.mts CHANGED
@@ -2,6 +2,10 @@ import { ReactNode } from "react";
2
2
  import { ViewStyle } from "react-native";
3
3
 
4
4
  //#region src/types.d.ts
5
+ /** Any JSON-RPC payload value — used wherever provider params/results cross the wire. */
6
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
7
+ [key: string]: JsonValue;
8
+ };
5
9
  /**
6
10
  * Minimal EIP-1193 provider interface.
7
11
  * Works with any wallet SDK: Privy, MetaMask, Coinbase, Rainbow, WalletConnect, etc.
@@ -9,8 +13,8 @@ import { ViewStyle } from "react-native";
9
13
  interface EIP1193Provider {
10
14
  request: (args: {
11
15
  method: string;
12
- params?: unknown[];
13
- }) => Promise<unknown>;
16
+ params?: JsonValue[] | object;
17
+ }) => Promise<JsonValue>;
14
18
  }
15
19
  type SupportedChainIds = number[];
16
20
  type YodlPaymentLifecycleStatus = 'submitted' | 'processing' | 'success' | 'failure';
@@ -55,7 +59,7 @@ interface YodlPaymentDetails {
55
59
  streakMultiplier?: string;
56
60
  berserMultiplier?: number;
57
61
  };
58
- raw?: unknown;
62
+ raw?: JsonValue;
59
63
  }
60
64
  /** Runtime wallet connection shared across the provider, context, and Yodl UI host. */
61
65
  interface YodlWallet {
@@ -80,6 +84,12 @@ interface YodlEventHandlers {
80
84
  /** Props shared by the Yodl UI components (YodlPayment, YodlDashboard). */
81
85
  interface YodlComponentProps extends YodlEventHandlers {
82
86
  style?: ViewStyle;
87
+ /**
88
+ * Color painted behind the WebView and in the loading overlay while the Yodl
89
+ * UI loads, preventing a white flash before the page's first paint. Defaults
90
+ * to the Yodl UI's dark theme (#18181b).
91
+ */
92
+ backgroundColor?: string;
83
93
  }
84
94
  //#endregion
85
95
  //#region src/components/YodlDashboard.d.ts
@@ -93,31 +103,38 @@ declare function YodlDashboard({
93
103
  onTransactionSent,
94
104
  onPaymentDetails,
95
105
  onError,
96
- style
106
+ style,
107
+ backgroundColor
97
108
  }: YodlDashboardProps): import("react/jsx-runtime").JSX.Element;
98
109
  //#endregion
99
110
  //#region src/components/YodlPayment.d.ts
100
111
  interface YodlPaymentProps extends YodlComponentProps {
101
- /** Raw QR data string — the component builds the Yodl UI URL internally. */
112
+ /** Raw scanned QR data. The component resolves it to the Yodl UI URL. */
102
113
  qrData: string;
103
114
  }
104
115
  /**
105
116
  * Renders the Yodl payment flow for a scanned QR code. Reads the SDK instance
106
- * and wallet state from <YodlProvider>. The Yodl UI is origin-locked to the
107
- * configured Yodl host.
117
+ * and wallet state from <YodlProvider> and resolves the QR to the Yodl UI URL
118
+ * (e.g. the `/resolve` screen on the configured host). The Yodl UI is
119
+ * origin-locked to that host. Renders nothing for empty/unsupported QR data.
108
120
  */
109
121
  declare function YodlPayment({
110
122
  qrData,
111
123
  onTransactionSent,
112
124
  onPaymentDetails,
113
125
  onError,
114
- style
126
+ style,
127
+ backgroundColor
115
128
  }: YodlPaymentProps): import("react/jsx-runtime").JSX.Element | null;
116
129
  //#endregion
117
130
  //#region src/sdk/yodl.d.ts
118
131
  /**
119
132
  * App-host configuration for the Yodl React Native SDK.
120
133
  * Injected once via {@link createSdk}.
134
+ *
135
+ * No RPC endpoint is needed: the embedded Yodl UI reads chain state through its
136
+ * own provider, and the injected wallet bridge only forwards signing/wallet
137
+ * methods to the host wallet.
121
138
  */
122
139
  interface YodlConfig {
123
140
  /** Identifies the SDK integrator/wallet app in Yodl-owned request headers. */
@@ -132,24 +149,13 @@ type ResolvedYodlConfig = Omit<YodlConfig, 'yodlUiBaseUrl'> & {
132
149
  yodlUiBaseUrl: string;
133
150
  };
134
151
  /**
135
- * The Yodl SDK instance. Mirrors the namespaced shape of `@yodlpay/sdk-core`
136
- * (e.g. `sdk.qr.*`) while wrapping — never re-exporting — sdk-core internals.
152
+ * The Yodl SDK instance. Holds the resolved app config that `<YodlProvider>`
153
+ * and the components read at runtime. Stateless QR helpers are exported as
154
+ * standalone functions (e.g. {@link isPaymentQr}) rather than instance methods.
137
155
  */
138
156
  declare class Yodl {
139
157
  readonly config: ResolvedYodlConfig;
140
158
  constructor(config: YodlConfig);
141
- get qr(): {
142
- /**
143
- * Returns true if the QR data is a Yodl-supported payment QR code.
144
- * Accepts a single string or an array — true if any entry is supported.
145
- */
146
- isPaymentQr(qrData: string | string[]): boolean;
147
- };
148
- /**
149
- * Warm up SDK caches ahead of a payment. No-op today — reserved for future
150
- * prefetching of rates, token lists, and processor metadata.
151
- */
152
- prefetch(): Promise<void>;
153
159
  }
154
160
  /**
155
161
  * Create a Yodl SDK instance. Factory pattern, consistent with
@@ -181,4 +187,16 @@ declare function YodlProvider({
181
187
  children
182
188
  }: YodlProviderProps): import("react/jsx-runtime").JSX.Element;
183
189
  //#endregion
184
- export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk };
190
+ //#region src/sdk/qr.d.ts
191
+ /**
192
+ * Returns true if the QR data is a Yodl-supported payment QR code — one the SDK
193
+ * can route to the resolve flow that `<YodlPayment>` renders. Accepts a single
194
+ * string or an array (true if any entry is supported). Provider-hosted
195
+ * `webview`-action QRs are not handled and return false.
196
+ *
197
+ * Pure helper: no SDK instance or config needed, so it can guard a render
198
+ * before `<YodlProvider>` is mounted.
199
+ */
200
+ declare function isPaymentQr(qrData: string | string[]): boolean;
201
+ //#endregion
202
+ export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk, isPaymentQr };