@pollar/react 0.8.1 → 0.9.0-rc.1
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.css +61 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +66 -26
- package/dist/index.d.ts +66 -26
- package/dist/index.js +425 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -114
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { WalletId, AuthState, pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TxHistoryState, PollarAdapter, KycStatus as KycStatus$1, RampQuote, KycProvider, KycStartResponse, RampDirection, PaymentInstructions, WalletBalanceRecord, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
|
+
export { SessionsState } from '@pollar/core';
|
|
3
4
|
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
|
|
@@ -22,17 +23,6 @@ interface RenderWalletsProps {
|
|
|
22
23
|
* with whatever the slot returns (typically a kit-powered wallet grid).
|
|
23
24
|
*/
|
|
24
25
|
type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
|
|
25
|
-
interface AuthProviderProps {
|
|
26
|
-
config: PollarClientConfig;
|
|
27
|
-
children: React.ReactNode;
|
|
28
|
-
}
|
|
29
|
-
interface AuthContextValue {
|
|
30
|
-
session: PollarApplicationConfigContent | null;
|
|
31
|
-
isLoading: boolean;
|
|
32
|
-
isAuthenticated: boolean;
|
|
33
|
-
login: (options: PollarLoginOptions) => void;
|
|
34
|
-
logout: () => Promise<void>;
|
|
35
|
-
}
|
|
36
26
|
interface LoginButtonProps {
|
|
37
27
|
onSuccess?: () => void;
|
|
38
28
|
onError?: (error: Error) => void;
|
|
@@ -50,8 +40,15 @@ interface PollarContextValue {
|
|
|
50
40
|
getClient: () => PollarClient;
|
|
51
41
|
openLoginModal: () => void;
|
|
52
42
|
isAuthenticated: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* `true` once the server has confirmed the session (login / refresh /
|
|
45
|
+
* `/auth/session/resume`). `false` while a cold-start session is still
|
|
46
|
+
* optimistic — gate sensitive actions (e.g. signing) on this.
|
|
47
|
+
*/
|
|
48
|
+
verified: boolean;
|
|
53
49
|
login: (options: PollarLoginOptions) => void;
|
|
54
50
|
logout: () => void;
|
|
51
|
+
sessions: SessionsState;
|
|
55
52
|
/** Open the active-sessions modal. */
|
|
56
53
|
openSessionsModal: () => void;
|
|
57
54
|
appConfig: PollarConfig;
|
|
@@ -61,7 +58,7 @@ interface PollarContextValue {
|
|
|
61
58
|
openTxModal: () => void;
|
|
62
59
|
tx: TransactionState;
|
|
63
60
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
|
|
64
|
-
signAndSubmitTx: (unsignedXdr
|
|
61
|
+
signAndSubmitTx: (unsignedXdr?: string) => Promise<SubmitOutcome>;
|
|
65
62
|
/** External-wallet only. Custodial flows should use `signAndSubmitTx`. */
|
|
66
63
|
signTx: (unsignedXdr: string) => Promise<SignOutcome>;
|
|
67
64
|
submitTx: (signedXdr: string) => Promise<SubmitOutcome>;
|
|
@@ -74,6 +71,15 @@ interface PollarContextValue {
|
|
|
74
71
|
setNetwork: (network: StellarNetwork) => void;
|
|
75
72
|
walletBalance: WalletBalanceState;
|
|
76
73
|
refreshWalletBalance: () => Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* The application's dashboard-enabled assets paired with the authenticated
|
|
76
|
+
* wallet's on-chain trustline state (`trustlineEstablished` per asset). Driven
|
|
77
|
+
* by {@link refreshAssets}; mirrors {@link walletBalance}.
|
|
78
|
+
*/
|
|
79
|
+
enabledAssets: EnabledAssetsState;
|
|
80
|
+
refreshAssets: () => Promise<void>;
|
|
81
|
+
/** Open the enabled-assets / trustline-state modal. */
|
|
82
|
+
openEnabledAssetsModal: () => void;
|
|
77
83
|
openKycModal: (options?: {
|
|
78
84
|
country?: string;
|
|
79
85
|
level?: 'basic' | 'intermediate' | 'enhanced';
|
|
@@ -133,6 +139,32 @@ declare function createPollarAdapterHook<T extends PollarAdapter>(key: string):
|
|
|
133
139
|
|
|
134
140
|
declare function WalletButton(): react_jsx_runtime.JSX.Element;
|
|
135
141
|
|
|
142
|
+
interface WalletButtonTemplateProps {
|
|
143
|
+
walletAddress: string | null;
|
|
144
|
+
accentColor: string;
|
|
145
|
+
open: boolean;
|
|
146
|
+
copied: boolean;
|
|
147
|
+
dropdownBg: string;
|
|
148
|
+
dropdownBorder: string;
|
|
149
|
+
itemColor: string;
|
|
150
|
+
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
151
|
+
isInProgress: boolean;
|
|
152
|
+
walletType: WalletId | null;
|
|
153
|
+
onToggleOpen: () => void;
|
|
154
|
+
onCopy: () => void;
|
|
155
|
+
onWalletBalance: () => void;
|
|
156
|
+
onTxHistory: () => void;
|
|
157
|
+
onSend: () => void;
|
|
158
|
+
onReceive: () => void;
|
|
159
|
+
onSessions: () => void;
|
|
160
|
+
onKyc: () => void;
|
|
161
|
+
onRamp: () => void;
|
|
162
|
+
onDistributionRules: () => void;
|
|
163
|
+
onLogout: () => void;
|
|
164
|
+
onLogin: () => void;
|
|
165
|
+
}
|
|
166
|
+
declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, onToggleOpen, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
|
|
167
|
+
|
|
136
168
|
interface KycModalProps {
|
|
137
169
|
onClose: () => void;
|
|
138
170
|
/** ISO 3166-1 alpha-2 country code to filter providers. Defaults to 'MX'. */
|
|
@@ -166,6 +198,11 @@ interface WalletBalanceModalProps {
|
|
|
166
198
|
}
|
|
167
199
|
declare function WalletBalanceModal({ onClose }: WalletBalanceModalProps): react_jsx_runtime.JSX.Element;
|
|
168
200
|
|
|
201
|
+
interface EnabledAssetsModalProps {
|
|
202
|
+
onClose: () => void;
|
|
203
|
+
}
|
|
204
|
+
declare function EnabledAssetsModal({ onClose }: EnabledAssetsModalProps): react_jsx_runtime.JSX.Element;
|
|
205
|
+
|
|
169
206
|
interface SendModalProps {
|
|
170
207
|
onClose: () => void;
|
|
171
208
|
}
|
|
@@ -192,6 +229,9 @@ interface LoginModalTemplateProps {
|
|
|
192
229
|
logoUrl: string | null;
|
|
193
230
|
emailEnabled: boolean;
|
|
194
231
|
embeddedWallets: boolean;
|
|
232
|
+
/** Show the "Smart Wallet" (passkey) option. Optional & defaults to off so
|
|
233
|
+
* adding it isn't a breaking change for existing template consumers. */
|
|
234
|
+
smartWallet?: boolean;
|
|
195
235
|
providers: {
|
|
196
236
|
google: boolean;
|
|
197
237
|
discord: boolean;
|
|
@@ -205,6 +245,7 @@ interface LoginModalTemplateProps {
|
|
|
205
245
|
onEmailSubmit?: () => void;
|
|
206
246
|
onSocialLogin?: (provider: 'google' | 'github') => void;
|
|
207
247
|
onWalletConnect?: (id: WalletId) => void;
|
|
248
|
+
onSmartWallet?: () => void;
|
|
208
249
|
/** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
|
|
209
250
|
renderWallets?: RenderWalletsSlot;
|
|
210
251
|
authState: AuthState;
|
|
@@ -214,7 +255,7 @@ interface LoginModalTemplateProps {
|
|
|
214
255
|
onCancel: () => void;
|
|
215
256
|
onRetry: () => void;
|
|
216
257
|
}
|
|
217
|
-
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, providers, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onSmartWallet, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
218
259
|
|
|
219
260
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
220
261
|
interface KycModalTemplateProps {
|
|
@@ -307,6 +348,16 @@ interface WalletBalanceModalTemplateProps {
|
|
|
307
348
|
}
|
|
308
349
|
declare function WalletBalanceModalTemplate({ theme, accentColor, walletBalance, walletAddress, onRefresh, onClose, }: WalletBalanceModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
309
350
|
|
|
351
|
+
interface EnabledAssetsModalTemplateProps {
|
|
352
|
+
theme: string;
|
|
353
|
+
accentColor: string;
|
|
354
|
+
enabledAssets: EnabledAssetsState;
|
|
355
|
+
walletAddress: string;
|
|
356
|
+
onRefresh: () => void;
|
|
357
|
+
onClose: () => void;
|
|
358
|
+
}
|
|
359
|
+
declare function EnabledAssetsModalTemplate({ theme, accentColor, enabledAssets, walletAddress, onRefresh, onClose, }: EnabledAssetsModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
360
|
+
|
|
310
361
|
interface SendModalTemplateProps {
|
|
311
362
|
theme: string;
|
|
312
363
|
accentColor: string;
|
|
@@ -349,17 +400,6 @@ interface ReceiveModalTemplateProps {
|
|
|
349
400
|
}
|
|
350
401
|
declare function ReceiveModalTemplate({ theme, accentColor, walletAddress, copied, onCopy, onClose, }: ReceiveModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
351
402
|
|
|
352
|
-
type SessionsState = {
|
|
353
|
-
step: 'idle';
|
|
354
|
-
} | {
|
|
355
|
-
step: 'loading';
|
|
356
|
-
} | {
|
|
357
|
-
step: 'loaded';
|
|
358
|
-
sessions: SessionInfo[];
|
|
359
|
-
} | {
|
|
360
|
-
step: 'error';
|
|
361
|
-
message: string;
|
|
362
|
-
};
|
|
363
403
|
interface SessionsModalTemplateProps {
|
|
364
404
|
theme: string;
|
|
365
405
|
accentColor: string;
|
|
@@ -386,4 +426,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
386
426
|
}
|
|
387
427
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
388
428
|
|
|
389
|
-
export { type
|
|
429
|
+
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, type RenderWalletsProps, type RenderWalletsSlot, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
|