@pollar/react 0.11.3-rc.1 → 0.11.3
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/README.md +18 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +25 -26
- package/dist/index.d.ts +25 -26
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner,
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
5
5
|
|
|
@@ -22,13 +22,13 @@ interface PollarContextValue {
|
|
|
22
22
|
/**
|
|
23
23
|
* The authenticated user's wallet as a discriminated union over `custody`
|
|
24
24
|
* (`internal` | `smart` | `external`), or `null` when unauthenticated. Every
|
|
25
|
-
* field is meaningful for any login method
|
|
25
|
+
* field is meaningful for any login method - `custody` is always present and
|
|
26
26
|
* strictly determines the shape of `provider`. Use `wallet.address` for the
|
|
27
27
|
* on-chain address and `wallet.provider` for the wallet/login provider.
|
|
28
28
|
*/
|
|
29
29
|
wallet: WalletInfo | null;
|
|
30
30
|
/**
|
|
31
|
-
* Every wallet the user holds, one per chain
|
|
31
|
+
* Every wallet the user holds, one per chain - a superset of {@link wallet},
|
|
32
32
|
* with `chain` populated. `[]` when unauthenticated. Drives the network
|
|
33
33
|
* selector in the Send / Wallet Balance / Assets modals: each entry is a
|
|
34
34
|
* network the user can switch to, and the first one is the default.
|
|
@@ -40,7 +40,7 @@ interface PollarContextValue {
|
|
|
40
40
|
/**
|
|
41
41
|
* `true` once the server has confirmed the session (login / refresh /
|
|
42
42
|
* `/auth/session/resume`). `false` while a cold-start session is still
|
|
43
|
-
* optimistic
|
|
43
|
+
* optimistic - gate sensitive actions (e.g. signing) on this.
|
|
44
44
|
*/
|
|
45
45
|
verified: boolean;
|
|
46
46
|
login: (options: PollarLoginOptions) => void;
|
|
@@ -52,7 +52,7 @@ interface PollarContextValue {
|
|
|
52
52
|
styles: PollarStyles;
|
|
53
53
|
/** Remote app-config load state. 'loading' while the initial fetch is in
|
|
54
54
|
* flight, 'error' if it failed (styles fall back to empty defaults), 'ready'
|
|
55
|
-
* once resolved
|
|
55
|
+
* once resolved - or immediately 'ready' when `appConfig` is passed as a prop.
|
|
56
56
|
* The login modal shows a spinner/retry instead of an empty shell until this
|
|
57
57
|
* is 'ready'. */
|
|
58
58
|
configStatus: 'loading' | 'ready' | 'error';
|
|
@@ -66,7 +66,7 @@ interface PollarContextValue {
|
|
|
66
66
|
/** External-wallet only. Custodial flows should use `signAndSubmitTx`. */
|
|
67
67
|
signTx: (unsignedXdr: string) => Promise<SignOutcome>;
|
|
68
68
|
submitTx: (signedXdr: string) => Promise<SubmitOutcome>;
|
|
69
|
-
/** One-shot: build
|
|
69
|
+
/** One-shot: build -> sign -> submit. Drives the same TransactionState flow as the split calls. */
|
|
70
70
|
buildAndSignAndSubmitTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<SubmitOutcome>;
|
|
71
71
|
/** Alias of `buildAndSignAndSubmitTx`. */
|
|
72
72
|
runTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<SubmitOutcome>;
|
|
@@ -194,13 +194,13 @@ interface PollarProviderProps {
|
|
|
194
194
|
* bypass the type anyway (plain JS, or a cast), each missing field lands on a
|
|
195
195
|
* default scattered across the components rather than on anything central:
|
|
196
196
|
*
|
|
197
|
-
* chains absent
|
|
197
|
+
* chains absent -> the chain order/filter falls back to the order the
|
|
198
198
|
* session listed the user's wallets in (see useChains)
|
|
199
|
-
* name absent
|
|
200
|
-
* theme absent
|
|
201
|
-
* accentColor absent
|
|
199
|
+
* name absent -> 'Pollar'
|
|
200
|
+
* theme absent -> 'light'
|
|
201
|
+
* accentColor absent -> '#005DB4'
|
|
202
202
|
* emailEnabled, providers, embeddedWallets, smartWallet
|
|
203
|
-
* absent
|
|
203
|
+
* absent -> false. NOTE: that means EVERY login method is off
|
|
204
204
|
* and the login modal renders with no way in.
|
|
205
205
|
*
|
|
206
206
|
* Leave this `undefined` to have the SDK fetch `/applications/config` on
|
|
@@ -235,16 +235,16 @@ declare function createPollarAdapterHook<T extends PollarAdapter>(key: string):
|
|
|
235
235
|
*
|
|
236
236
|
* `mode` is set explicitly by the caller's button, so there's no ambiguous
|
|
237
237
|
* autodetect:
|
|
238
|
-
* - `'login'`
|
|
238
|
+
* - `'login'` -> `get()` only (returning user - the OS shows the account
|
|
239
239
|
* picker for discoverable credentials on this domain). A
|
|
240
240
|
* failure here is surfaced as-is; it never falls through to
|
|
241
241
|
* registration, so cancelling the prompt can't accidentally
|
|
242
242
|
* create a second wallet.
|
|
243
|
-
* - `'register'`
|
|
243
|
+
* - `'register'` -> `create()` only (new user -> the server deploys the
|
|
244
244
|
* C-address).
|
|
245
245
|
*
|
|
246
246
|
* rpId = the current page's hostname (the customer app's domain), which is what
|
|
247
|
-
* the passkey is bound to
|
|
247
|
+
* the passkey is bound to - the anti-phishing guarantee.
|
|
248
248
|
*/
|
|
249
249
|
declare const browserPasskeyCeremony: PasskeyCeremony;
|
|
250
250
|
/**
|
|
@@ -268,7 +268,6 @@ interface WalletButtonTemplateProps {
|
|
|
268
268
|
itemColor: string;
|
|
269
269
|
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
270
270
|
isInProgress: boolean;
|
|
271
|
-
walletType: WalletId | null;
|
|
272
271
|
/** Show the "Create account" action (external wallet not yet on-chain, IMMEDIATE funding). */
|
|
273
272
|
showCreateAccount: boolean;
|
|
274
273
|
creatingAccount: boolean;
|
|
@@ -295,7 +294,7 @@ declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied
|
|
|
295
294
|
*/
|
|
296
295
|
declare function resolveChain(chain: WalletChain | undefined): WalletChain;
|
|
297
296
|
/**
|
|
298
|
-
* The selectable chains
|
|
297
|
+
* The selectable chains - the first is the default everywhere (network picker,
|
|
299
298
|
* the address the wallet button shows). De-duplicated because two wallets on one
|
|
300
299
|
* chain (e.g. a custodial and a linked external Stellar wallet) are still one
|
|
301
300
|
* network choice.
|
|
@@ -370,7 +369,7 @@ declare function RampWidget({ onClose }: RampWidgetProps): react_jsx_runtime.JSX
|
|
|
370
369
|
|
|
371
370
|
interface RouteDisplayProps {
|
|
372
371
|
quote: RampQuote;
|
|
373
|
-
/** This route is the one being started
|
|
372
|
+
/** This route is the one being started - it owns the in-flight request. */
|
|
374
373
|
busy?: boolean;
|
|
375
374
|
/** Another route is starting, so this one is not selectable meanwhile. */
|
|
376
375
|
disabled?: boolean;
|
|
@@ -428,7 +427,7 @@ interface ModalStyleOverrides {
|
|
|
428
427
|
* keeps its theme color, so the two stay distinguishable. */
|
|
429
428
|
textColor?: string | null | undefined;
|
|
430
429
|
/** Fill of the SECONDARY buttons (the wallet / social / provider entries, the
|
|
431
|
-
* retry button). The primary button is the accent's job. Unset
|
|
430
|
+
* retry button). The primary button is the accent's job. Unset => the theme's
|
|
432
431
|
* own surface color, which is what these buttons always used. */
|
|
433
432
|
buttonColor?: string | null | undefined;
|
|
434
433
|
/** Radius of the modal card itself, in px. */
|
|
@@ -438,17 +437,17 @@ interface ModalStyleOverrides {
|
|
|
438
437
|
}
|
|
439
438
|
/** Text color that stays legible on `background`. The primary button's label was
|
|
440
439
|
* hardcoded white, which a light fill (the Amber accent preset, say) turns
|
|
441
|
-
* invisible
|
|
440
|
+
* invisible - so it follows the fill's luminance instead. Unparseable colors
|
|
442
441
|
* keep white, the pre-existing behavior. */
|
|
443
442
|
declare function readableTextOn(background: string): string;
|
|
444
443
|
/** How much room a modal gives its header. 'hero' is the identity-forward set
|
|
445
444
|
* (login, KYC, ramp, the Privy sub-modal): roomier padding and a larger
|
|
446
445
|
* centered heading. 'compact' is every utility modal (send, balance, history,
|
|
447
|
-
*
|
|
446
|
+
* ...), which keeps the card's own 1.75rem padding. */
|
|
448
447
|
type ModalVariant = 'hero' | 'compact';
|
|
449
448
|
/** Theme-derived CSS custom properties shared by every Pollar modal, plus the
|
|
450
449
|
* per-app overrides on top. One definition so the whole modal family stays
|
|
451
|
-
* visually in lockstep
|
|
450
|
+
* visually in lockstep - a var added here reaches all of them at once. */
|
|
452
451
|
declare function buildModalCssVars(theme: string, accentColor: string, overrides?: ModalStyleOverrides, variant?: ModalVariant): CSSProperties;
|
|
453
452
|
/** Everything a modal wrapper needs to dress itself from the app's branding:
|
|
454
453
|
* the theme pair its template already took, the overrides to forward to that
|
|
@@ -490,7 +489,7 @@ interface LoginModalTemplateProps {
|
|
|
490
489
|
github: boolean;
|
|
491
490
|
apple: boolean;
|
|
492
491
|
};
|
|
493
|
-
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy,
|
|
492
|
+
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, ...). */
|
|
494
493
|
walletAdapters: WalletAdapterEntry[];
|
|
495
494
|
appName: string;
|
|
496
495
|
email?: string;
|
|
@@ -537,7 +536,7 @@ interface RampFieldSpec {
|
|
|
537
536
|
label: string;
|
|
538
537
|
type: 'text' | 'email' | 'tel' | 'select';
|
|
539
538
|
bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH' | 'BREB';
|
|
540
|
-
/** For `type: 'select'`
|
|
539
|
+
/** For `type: 'select'` - dropdown choices (e.g. Stereum's Bolivian banks). */
|
|
541
540
|
options?: {
|
|
542
541
|
value: string;
|
|
543
542
|
label: string;
|
|
@@ -587,7 +586,7 @@ interface RampWidgetTemplateProps {
|
|
|
587
586
|
tosUrl: string | null;
|
|
588
587
|
/** Provider gated the flow on KYC and published no link; nothing was signed. */
|
|
589
588
|
kycBlocking: boolean;
|
|
590
|
-
/** The gate has since cleared
|
|
589
|
+
/** The gate has since cleared - the user needs a fresh quote to continue. */
|
|
591
590
|
kycJustApproved: boolean;
|
|
592
591
|
stellarTxHash: string | null;
|
|
593
592
|
/** Stellar Expert URL for `stellarTxHash` (network-aware); null when unknown. */
|
|
@@ -678,7 +677,7 @@ interface WalletBalanceModalTemplateProps {
|
|
|
678
677
|
/** Networks the user holds a wallet on; the first one is the default. */
|
|
679
678
|
chains: WalletChain[];
|
|
680
679
|
selectedChain: WalletChain | null;
|
|
681
|
-
/** testnet vs mainnet
|
|
680
|
+
/** testnet vs mainnet - gates the Solana devnet faucet hint. */
|
|
682
681
|
network: StellarNetwork;
|
|
683
682
|
onSelectChain: (chain: WalletChain) => void;
|
|
684
683
|
onRefresh: () => void;
|
|
@@ -796,7 +795,7 @@ interface SwapModalTemplateProps {
|
|
|
796
795
|
smartUnsupported: boolean;
|
|
797
796
|
/** Swap config is still loading. */
|
|
798
797
|
configLoading: boolean;
|
|
799
|
-
/** Config loaded and this app exposes no swap venues
|
|
798
|
+
/** Config loaded and this app exposes no swap venues - swap is disabled. */
|
|
800
799
|
swapUnavailable: boolean;
|
|
801
800
|
/** Buying the selected asset will create a trustline first (~0.5 XLM reserve). */
|
|
802
801
|
buyNeedsTrustline: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner,
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
5
5
|
|
|
@@ -22,13 +22,13 @@ interface PollarContextValue {
|
|
|
22
22
|
/**
|
|
23
23
|
* The authenticated user's wallet as a discriminated union over `custody`
|
|
24
24
|
* (`internal` | `smart` | `external`), or `null` when unauthenticated. Every
|
|
25
|
-
* field is meaningful for any login method
|
|
25
|
+
* field is meaningful for any login method - `custody` is always present and
|
|
26
26
|
* strictly determines the shape of `provider`. Use `wallet.address` for the
|
|
27
27
|
* on-chain address and `wallet.provider` for the wallet/login provider.
|
|
28
28
|
*/
|
|
29
29
|
wallet: WalletInfo | null;
|
|
30
30
|
/**
|
|
31
|
-
* Every wallet the user holds, one per chain
|
|
31
|
+
* Every wallet the user holds, one per chain - a superset of {@link wallet},
|
|
32
32
|
* with `chain` populated. `[]` when unauthenticated. Drives the network
|
|
33
33
|
* selector in the Send / Wallet Balance / Assets modals: each entry is a
|
|
34
34
|
* network the user can switch to, and the first one is the default.
|
|
@@ -40,7 +40,7 @@ interface PollarContextValue {
|
|
|
40
40
|
/**
|
|
41
41
|
* `true` once the server has confirmed the session (login / refresh /
|
|
42
42
|
* `/auth/session/resume`). `false` while a cold-start session is still
|
|
43
|
-
* optimistic
|
|
43
|
+
* optimistic - gate sensitive actions (e.g. signing) on this.
|
|
44
44
|
*/
|
|
45
45
|
verified: boolean;
|
|
46
46
|
login: (options: PollarLoginOptions) => void;
|
|
@@ -52,7 +52,7 @@ interface PollarContextValue {
|
|
|
52
52
|
styles: PollarStyles;
|
|
53
53
|
/** Remote app-config load state. 'loading' while the initial fetch is in
|
|
54
54
|
* flight, 'error' if it failed (styles fall back to empty defaults), 'ready'
|
|
55
|
-
* once resolved
|
|
55
|
+
* once resolved - or immediately 'ready' when `appConfig` is passed as a prop.
|
|
56
56
|
* The login modal shows a spinner/retry instead of an empty shell until this
|
|
57
57
|
* is 'ready'. */
|
|
58
58
|
configStatus: 'loading' | 'ready' | 'error';
|
|
@@ -66,7 +66,7 @@ interface PollarContextValue {
|
|
|
66
66
|
/** External-wallet only. Custodial flows should use `signAndSubmitTx`. */
|
|
67
67
|
signTx: (unsignedXdr: string) => Promise<SignOutcome>;
|
|
68
68
|
submitTx: (signedXdr: string) => Promise<SubmitOutcome>;
|
|
69
|
-
/** One-shot: build
|
|
69
|
+
/** One-shot: build -> sign -> submit. Drives the same TransactionState flow as the split calls. */
|
|
70
70
|
buildAndSignAndSubmitTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<SubmitOutcome>;
|
|
71
71
|
/** Alias of `buildAndSignAndSubmitTx`. */
|
|
72
72
|
runTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<SubmitOutcome>;
|
|
@@ -194,13 +194,13 @@ interface PollarProviderProps {
|
|
|
194
194
|
* bypass the type anyway (plain JS, or a cast), each missing field lands on a
|
|
195
195
|
* default scattered across the components rather than on anything central:
|
|
196
196
|
*
|
|
197
|
-
* chains absent
|
|
197
|
+
* chains absent -> the chain order/filter falls back to the order the
|
|
198
198
|
* session listed the user's wallets in (see useChains)
|
|
199
|
-
* name absent
|
|
200
|
-
* theme absent
|
|
201
|
-
* accentColor absent
|
|
199
|
+
* name absent -> 'Pollar'
|
|
200
|
+
* theme absent -> 'light'
|
|
201
|
+
* accentColor absent -> '#005DB4'
|
|
202
202
|
* emailEnabled, providers, embeddedWallets, smartWallet
|
|
203
|
-
* absent
|
|
203
|
+
* absent -> false. NOTE: that means EVERY login method is off
|
|
204
204
|
* and the login modal renders with no way in.
|
|
205
205
|
*
|
|
206
206
|
* Leave this `undefined` to have the SDK fetch `/applications/config` on
|
|
@@ -235,16 +235,16 @@ declare function createPollarAdapterHook<T extends PollarAdapter>(key: string):
|
|
|
235
235
|
*
|
|
236
236
|
* `mode` is set explicitly by the caller's button, so there's no ambiguous
|
|
237
237
|
* autodetect:
|
|
238
|
-
* - `'login'`
|
|
238
|
+
* - `'login'` -> `get()` only (returning user - the OS shows the account
|
|
239
239
|
* picker for discoverable credentials on this domain). A
|
|
240
240
|
* failure here is surfaced as-is; it never falls through to
|
|
241
241
|
* registration, so cancelling the prompt can't accidentally
|
|
242
242
|
* create a second wallet.
|
|
243
|
-
* - `'register'`
|
|
243
|
+
* - `'register'` -> `create()` only (new user -> the server deploys the
|
|
244
244
|
* C-address).
|
|
245
245
|
*
|
|
246
246
|
* rpId = the current page's hostname (the customer app's domain), which is what
|
|
247
|
-
* the passkey is bound to
|
|
247
|
+
* the passkey is bound to - the anti-phishing guarantee.
|
|
248
248
|
*/
|
|
249
249
|
declare const browserPasskeyCeremony: PasskeyCeremony;
|
|
250
250
|
/**
|
|
@@ -268,7 +268,6 @@ interface WalletButtonTemplateProps {
|
|
|
268
268
|
itemColor: string;
|
|
269
269
|
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
270
270
|
isInProgress: boolean;
|
|
271
|
-
walletType: WalletId | null;
|
|
272
271
|
/** Show the "Create account" action (external wallet not yet on-chain, IMMEDIATE funding). */
|
|
273
272
|
showCreateAccount: boolean;
|
|
274
273
|
creatingAccount: boolean;
|
|
@@ -295,7 +294,7 @@ declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied
|
|
|
295
294
|
*/
|
|
296
295
|
declare function resolveChain(chain: WalletChain | undefined): WalletChain;
|
|
297
296
|
/**
|
|
298
|
-
* The selectable chains
|
|
297
|
+
* The selectable chains - the first is the default everywhere (network picker,
|
|
299
298
|
* the address the wallet button shows). De-duplicated because two wallets on one
|
|
300
299
|
* chain (e.g. a custodial and a linked external Stellar wallet) are still one
|
|
301
300
|
* network choice.
|
|
@@ -370,7 +369,7 @@ declare function RampWidget({ onClose }: RampWidgetProps): react_jsx_runtime.JSX
|
|
|
370
369
|
|
|
371
370
|
interface RouteDisplayProps {
|
|
372
371
|
quote: RampQuote;
|
|
373
|
-
/** This route is the one being started
|
|
372
|
+
/** This route is the one being started - it owns the in-flight request. */
|
|
374
373
|
busy?: boolean;
|
|
375
374
|
/** Another route is starting, so this one is not selectable meanwhile. */
|
|
376
375
|
disabled?: boolean;
|
|
@@ -428,7 +427,7 @@ interface ModalStyleOverrides {
|
|
|
428
427
|
* keeps its theme color, so the two stay distinguishable. */
|
|
429
428
|
textColor?: string | null | undefined;
|
|
430
429
|
/** Fill of the SECONDARY buttons (the wallet / social / provider entries, the
|
|
431
|
-
* retry button). The primary button is the accent's job. Unset
|
|
430
|
+
* retry button). The primary button is the accent's job. Unset => the theme's
|
|
432
431
|
* own surface color, which is what these buttons always used. */
|
|
433
432
|
buttonColor?: string | null | undefined;
|
|
434
433
|
/** Radius of the modal card itself, in px. */
|
|
@@ -438,17 +437,17 @@ interface ModalStyleOverrides {
|
|
|
438
437
|
}
|
|
439
438
|
/** Text color that stays legible on `background`. The primary button's label was
|
|
440
439
|
* hardcoded white, which a light fill (the Amber accent preset, say) turns
|
|
441
|
-
* invisible
|
|
440
|
+
* invisible - so it follows the fill's luminance instead. Unparseable colors
|
|
442
441
|
* keep white, the pre-existing behavior. */
|
|
443
442
|
declare function readableTextOn(background: string): string;
|
|
444
443
|
/** How much room a modal gives its header. 'hero' is the identity-forward set
|
|
445
444
|
* (login, KYC, ramp, the Privy sub-modal): roomier padding and a larger
|
|
446
445
|
* centered heading. 'compact' is every utility modal (send, balance, history,
|
|
447
|
-
*
|
|
446
|
+
* ...), which keeps the card's own 1.75rem padding. */
|
|
448
447
|
type ModalVariant = 'hero' | 'compact';
|
|
449
448
|
/** Theme-derived CSS custom properties shared by every Pollar modal, plus the
|
|
450
449
|
* per-app overrides on top. One definition so the whole modal family stays
|
|
451
|
-
* visually in lockstep
|
|
450
|
+
* visually in lockstep - a var added here reaches all of them at once. */
|
|
452
451
|
declare function buildModalCssVars(theme: string, accentColor: string, overrides?: ModalStyleOverrides, variant?: ModalVariant): CSSProperties;
|
|
453
452
|
/** Everything a modal wrapper needs to dress itself from the app's branding:
|
|
454
453
|
* the theme pair its template already took, the overrides to forward to that
|
|
@@ -490,7 +489,7 @@ interface LoginModalTemplateProps {
|
|
|
490
489
|
github: boolean;
|
|
491
490
|
apple: boolean;
|
|
492
491
|
};
|
|
493
|
-
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy,
|
|
492
|
+
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, ...). */
|
|
494
493
|
walletAdapters: WalletAdapterEntry[];
|
|
495
494
|
appName: string;
|
|
496
495
|
email?: string;
|
|
@@ -537,7 +536,7 @@ interface RampFieldSpec {
|
|
|
537
536
|
label: string;
|
|
538
537
|
type: 'text' | 'email' | 'tel' | 'select';
|
|
539
538
|
bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH' | 'BREB';
|
|
540
|
-
/** For `type: 'select'`
|
|
539
|
+
/** For `type: 'select'` - dropdown choices (e.g. Stereum's Bolivian banks). */
|
|
541
540
|
options?: {
|
|
542
541
|
value: string;
|
|
543
542
|
label: string;
|
|
@@ -587,7 +586,7 @@ interface RampWidgetTemplateProps {
|
|
|
587
586
|
tosUrl: string | null;
|
|
588
587
|
/** Provider gated the flow on KYC and published no link; nothing was signed. */
|
|
589
588
|
kycBlocking: boolean;
|
|
590
|
-
/** The gate has since cleared
|
|
589
|
+
/** The gate has since cleared - the user needs a fresh quote to continue. */
|
|
591
590
|
kycJustApproved: boolean;
|
|
592
591
|
stellarTxHash: string | null;
|
|
593
592
|
/** Stellar Expert URL for `stellarTxHash` (network-aware); null when unknown. */
|
|
@@ -678,7 +677,7 @@ interface WalletBalanceModalTemplateProps {
|
|
|
678
677
|
/** Networks the user holds a wallet on; the first one is the default. */
|
|
679
678
|
chains: WalletChain[];
|
|
680
679
|
selectedChain: WalletChain | null;
|
|
681
|
-
/** testnet vs mainnet
|
|
680
|
+
/** testnet vs mainnet - gates the Solana devnet faucet hint. */
|
|
682
681
|
network: StellarNetwork;
|
|
683
682
|
onSelectChain: (chain: WalletChain) => void;
|
|
684
683
|
onRefresh: () => void;
|
|
@@ -796,7 +795,7 @@ interface SwapModalTemplateProps {
|
|
|
796
795
|
smartUnsupported: boolean;
|
|
797
796
|
/** Swap config is still loading. */
|
|
798
797
|
configLoading: boolean;
|
|
799
|
-
/** Config loaded and this app exposes no swap venues
|
|
798
|
+
/** Config loaded and this app exposes no swap venues - swap is disabled. */
|
|
800
799
|
swapUnavailable: boolean;
|
|
801
800
|
/** Buying the selected asset will create a trustline first (~0.5 XLM reserve). */
|
|
802
801
|
buyNeedsTrustline: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1035,7 +1035,7 @@ var PollarModalFooter = () => {
|
|
|
1035
1035
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1036
1036
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1037
1037
|
"v",
|
|
1038
|
-
"0.11.3
|
|
1038
|
+
"0.11.3"
|
|
1039
1039
|
] })
|
|
1040
1040
|
] })
|
|
1041
1041
|
] });
|
|
@@ -1219,7 +1219,7 @@ var REASON_LABEL = {
|
|
|
1219
1219
|
DISTRIBUTION_RULE_NOT_STARTED: "Not started yet",
|
|
1220
1220
|
DISTRIBUTION_RULE_EXPIRED: "Expired",
|
|
1221
1221
|
DISTRIBUTION_RULE_EXHAUSTED: "Fully claimed",
|
|
1222
|
-
// Per-user, per-window claim limit (resets next period)
|
|
1222
|
+
// Per-user, per-window claim limit (resets next period) - not permanent.
|
|
1223
1223
|
DISTRIBUTION_RATE_LIMIT_EXCEEDED: "Claimed for this period"
|
|
1224
1224
|
};
|
|
1225
1225
|
function reasonLabel(reason) {
|
|
@@ -4069,7 +4069,7 @@ function SendModalTemplate({
|
|
|
4069
4069
|
options: assets.map((a) => ({
|
|
4070
4070
|
key: assetKey3(a),
|
|
4071
4071
|
code: a.code,
|
|
4072
|
-
// Unreadable (null) drops the "
|
|
4072
|
+
// Unreadable (null) drops the "- X available" suffix instead of
|
|
4073
4073
|
// claiming a zero balance.
|
|
4074
4074
|
available: a.available ?? void 0,
|
|
4075
4075
|
enabledInApp: a.enabledInApp
|
|
@@ -6106,7 +6106,7 @@ var browserPasskeyCeremony = async ({ challenge, mode }) => {
|
|
|
6106
6106
|
challenge,
|
|
6107
6107
|
rp: { id: rpId, name: rpId },
|
|
6108
6108
|
user: { id: userId, name: "Smart Wallet", displayName: "Smart Wallet" },
|
|
6109
|
-
// ES256 (secp256r1)
|
|
6109
|
+
// ES256 (secp256r1) - the curve the on-chain WebAuthn verifier expects.
|
|
6110
6110
|
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
|
|
6111
6111
|
authenticatorSelection: { residentKey: "required", userVerification: "required" },
|
|
6112
6112
|
attestation: "none",
|
|
@@ -6141,6 +6141,7 @@ function sessionsEqual(a, b) {
|
|
|
6141
6141
|
return a.clientSessionId === b.clientSessionId && a.userId === b.userId && a.status === b.status && a.token?.accessToken === b.token?.accessToken && a.token?.refreshToken === b.token?.refreshToken && a.token?.expiresAt === b.token?.expiresAt && a.wallet?.address === b.wallet?.address;
|
|
6142
6142
|
}
|
|
6143
6143
|
var PollarContext = react.createContext(null);
|
|
6144
|
+
var clientByConfig = /* @__PURE__ */ new WeakMap();
|
|
6144
6145
|
function PollarProvider({
|
|
6145
6146
|
client,
|
|
6146
6147
|
appConfig: appConfigProp,
|
|
@@ -6149,20 +6150,29 @@ function PollarProvider({
|
|
|
6149
6150
|
children
|
|
6150
6151
|
}) {
|
|
6151
6152
|
const [pollarClient] = react.useState(() => {
|
|
6152
|
-
if (
|
|
6153
|
+
if (core.isPollarClient(client)) {
|
|
6153
6154
|
client.setPasskeyDefaults({ passkey: browserPasskeyCeremony, passkeySign: browserPasskeySigner });
|
|
6154
6155
|
return client;
|
|
6155
6156
|
}
|
|
6156
|
-
|
|
6157
|
+
const alreadyBuilt = clientByConfig.get(client);
|
|
6158
|
+
if (alreadyBuilt) return alreadyBuilt;
|
|
6159
|
+
const built = new core.PollarClient({
|
|
6157
6160
|
...client,
|
|
6158
6161
|
passkey: client.passkey ?? browserPasskeyCeremony,
|
|
6159
6162
|
passkeySign: client.passkeySign ?? browserPasskeySigner
|
|
6160
6163
|
});
|
|
6164
|
+
clientByConfig.set(client, built);
|
|
6165
|
+
return built;
|
|
6161
6166
|
});
|
|
6162
|
-
const ownsClientRef = react.useRef(!(client
|
|
6167
|
+
const ownsClientRef = react.useRef(!core.isPollarClient(client));
|
|
6163
6168
|
const destroyTimerRef = react.useRef(null);
|
|
6169
|
+
const builtFromConfigRef = react.useRef(core.isPollarClient(client) ? null : client);
|
|
6164
6170
|
react.useEffect(() => {
|
|
6165
6171
|
if (!ownsClientRef.current) return;
|
|
6172
|
+
if (builtFromConfigRef.current) {
|
|
6173
|
+
clientByConfig.delete(builtFromConfigRef.current);
|
|
6174
|
+
builtFromConfigRef.current = null;
|
|
6175
|
+
}
|
|
6166
6176
|
if (destroyTimerRef.current) {
|
|
6167
6177
|
clearTimeout(destroyTimerRef.current);
|
|
6168
6178
|
destroyTimerRef.current = null;
|
|
@@ -6806,7 +6816,6 @@ function WalletButton() {
|
|
|
6806
6816
|
} = usePollar();
|
|
6807
6817
|
const { primaryAddress } = useChains();
|
|
6808
6818
|
const walletAddress = primaryAddress || (wallet?.address ?? "");
|
|
6809
|
-
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
6810
6819
|
const [open, setOpen] = react.useState(false);
|
|
6811
6820
|
const [copied, setCopied] = react.useState(false);
|
|
6812
6821
|
const [creating, setCreating] = react.useState(false);
|
|
@@ -6907,7 +6916,6 @@ function WalletButton() {
|
|
|
6907
6916
|
itemColor,
|
|
6908
6917
|
wrapperRef,
|
|
6909
6918
|
isInProgress,
|
|
6910
|
-
walletType,
|
|
6911
6919
|
showCreateAccount: canCreateAccount,
|
|
6912
6920
|
creatingAccount: creating,
|
|
6913
6921
|
onToggleOpen: () => setOpen((v) => !v),
|