@pollar/react 0.8.1 → 0.9.0-rc.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.mts +42 -26
- package/dist/index.d.ts +42 -26
- package/dist/index.js +302 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +302 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.mts
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, 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>;
|
|
@@ -133,6 +130,32 @@ declare function createPollarAdapterHook<T extends PollarAdapter>(key: string):
|
|
|
133
130
|
|
|
134
131
|
declare function WalletButton(): react_jsx_runtime.JSX.Element;
|
|
135
132
|
|
|
133
|
+
interface WalletButtonTemplateProps {
|
|
134
|
+
walletAddress: string | null;
|
|
135
|
+
accentColor: string;
|
|
136
|
+
open: boolean;
|
|
137
|
+
copied: boolean;
|
|
138
|
+
dropdownBg: string;
|
|
139
|
+
dropdownBorder: string;
|
|
140
|
+
itemColor: string;
|
|
141
|
+
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
142
|
+
isInProgress: boolean;
|
|
143
|
+
walletType: WalletId | null;
|
|
144
|
+
onToggleOpen: () => void;
|
|
145
|
+
onCopy: () => void;
|
|
146
|
+
onWalletBalance: () => void;
|
|
147
|
+
onTxHistory: () => void;
|
|
148
|
+
onSend: () => void;
|
|
149
|
+
onReceive: () => void;
|
|
150
|
+
onSessions: () => void;
|
|
151
|
+
onKyc: () => void;
|
|
152
|
+
onRamp: () => void;
|
|
153
|
+
onDistributionRules: () => void;
|
|
154
|
+
onLogout: () => void;
|
|
155
|
+
onLogin: () => void;
|
|
156
|
+
}
|
|
157
|
+
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;
|
|
158
|
+
|
|
136
159
|
interface KycModalProps {
|
|
137
160
|
onClose: () => void;
|
|
138
161
|
/** ISO 3166-1 alpha-2 country code to filter providers. Defaults to 'MX'. */
|
|
@@ -192,6 +215,9 @@ interface LoginModalTemplateProps {
|
|
|
192
215
|
logoUrl: string | null;
|
|
193
216
|
emailEnabled: boolean;
|
|
194
217
|
embeddedWallets: boolean;
|
|
218
|
+
/** Show the "Smart Wallet" (passkey) option. Optional & defaults to off so
|
|
219
|
+
* adding it isn't a breaking change for existing template consumers. */
|
|
220
|
+
smartWallet?: boolean;
|
|
195
221
|
providers: {
|
|
196
222
|
google: boolean;
|
|
197
223
|
discord: boolean;
|
|
@@ -205,6 +231,7 @@ interface LoginModalTemplateProps {
|
|
|
205
231
|
onEmailSubmit?: () => void;
|
|
206
232
|
onSocialLogin?: (provider: 'google' | 'github') => void;
|
|
207
233
|
onWalletConnect?: (id: WalletId) => void;
|
|
234
|
+
onSmartWallet?: () => void;
|
|
208
235
|
/** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
|
|
209
236
|
renderWallets?: RenderWalletsSlot;
|
|
210
237
|
authState: AuthState;
|
|
@@ -214,7 +241,7 @@ interface LoginModalTemplateProps {
|
|
|
214
241
|
onCancel: () => void;
|
|
215
242
|
onRetry: () => void;
|
|
216
243
|
}
|
|
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;
|
|
244
|
+
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
245
|
|
|
219
246
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
220
247
|
interface KycModalTemplateProps {
|
|
@@ -349,17 +376,6 @@ interface ReceiveModalTemplateProps {
|
|
|
349
376
|
}
|
|
350
377
|
declare function ReceiveModalTemplate({ theme, accentColor, walletAddress, copied, onCopy, onClose, }: ReceiveModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
351
378
|
|
|
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
379
|
interface SessionsModalTemplateProps {
|
|
364
380
|
theme: string;
|
|
365
381
|
accentColor: string;
|
|
@@ -386,4 +402,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
386
402
|
}
|
|
387
403
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
388
404
|
|
|
389
|
-
export { type
|
|
405
|
+
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, 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 };
|
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, 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>;
|
|
@@ -133,6 +130,32 @@ declare function createPollarAdapterHook<T extends PollarAdapter>(key: string):
|
|
|
133
130
|
|
|
134
131
|
declare function WalletButton(): react_jsx_runtime.JSX.Element;
|
|
135
132
|
|
|
133
|
+
interface WalletButtonTemplateProps {
|
|
134
|
+
walletAddress: string | null;
|
|
135
|
+
accentColor: string;
|
|
136
|
+
open: boolean;
|
|
137
|
+
copied: boolean;
|
|
138
|
+
dropdownBg: string;
|
|
139
|
+
dropdownBorder: string;
|
|
140
|
+
itemColor: string;
|
|
141
|
+
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
142
|
+
isInProgress: boolean;
|
|
143
|
+
walletType: WalletId | null;
|
|
144
|
+
onToggleOpen: () => void;
|
|
145
|
+
onCopy: () => void;
|
|
146
|
+
onWalletBalance: () => void;
|
|
147
|
+
onTxHistory: () => void;
|
|
148
|
+
onSend: () => void;
|
|
149
|
+
onReceive: () => void;
|
|
150
|
+
onSessions: () => void;
|
|
151
|
+
onKyc: () => void;
|
|
152
|
+
onRamp: () => void;
|
|
153
|
+
onDistributionRules: () => void;
|
|
154
|
+
onLogout: () => void;
|
|
155
|
+
onLogin: () => void;
|
|
156
|
+
}
|
|
157
|
+
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;
|
|
158
|
+
|
|
136
159
|
interface KycModalProps {
|
|
137
160
|
onClose: () => void;
|
|
138
161
|
/** ISO 3166-1 alpha-2 country code to filter providers. Defaults to 'MX'. */
|
|
@@ -192,6 +215,9 @@ interface LoginModalTemplateProps {
|
|
|
192
215
|
logoUrl: string | null;
|
|
193
216
|
emailEnabled: boolean;
|
|
194
217
|
embeddedWallets: boolean;
|
|
218
|
+
/** Show the "Smart Wallet" (passkey) option. Optional & defaults to off so
|
|
219
|
+
* adding it isn't a breaking change for existing template consumers. */
|
|
220
|
+
smartWallet?: boolean;
|
|
195
221
|
providers: {
|
|
196
222
|
google: boolean;
|
|
197
223
|
discord: boolean;
|
|
@@ -205,6 +231,7 @@ interface LoginModalTemplateProps {
|
|
|
205
231
|
onEmailSubmit?: () => void;
|
|
206
232
|
onSocialLogin?: (provider: 'google' | 'github') => void;
|
|
207
233
|
onWalletConnect?: (id: WalletId) => void;
|
|
234
|
+
onSmartWallet?: () => void;
|
|
208
235
|
/** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
|
|
209
236
|
renderWallets?: RenderWalletsSlot;
|
|
210
237
|
authState: AuthState;
|
|
@@ -214,7 +241,7 @@ interface LoginModalTemplateProps {
|
|
|
214
241
|
onCancel: () => void;
|
|
215
242
|
onRetry: () => void;
|
|
216
243
|
}
|
|
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;
|
|
244
|
+
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
245
|
|
|
219
246
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
220
247
|
interface KycModalTemplateProps {
|
|
@@ -349,17 +376,6 @@ interface ReceiveModalTemplateProps {
|
|
|
349
376
|
}
|
|
350
377
|
declare function ReceiveModalTemplate({ theme, accentColor, walletAddress, copied, onCopy, onClose, }: ReceiveModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
351
378
|
|
|
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
379
|
interface SessionsModalTemplateProps {
|
|
364
380
|
theme: string;
|
|
365
381
|
accentColor: string;
|
|
@@ -386,4 +402,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
386
402
|
}
|
|
387
403
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
388
404
|
|
|
389
|
-
export { type
|
|
405
|
+
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, 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 };
|