@pollar/react 0.10.0-rc.0 → 0.10.0-rc.8
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 +15 -36
- package/dist/index.d.ts +15 -36
- package/dist/index.js +18 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,10 +9,10 @@ type PollarStyles = PollarConfig['styles'];
|
|
|
9
9
|
/**
|
|
10
10
|
* Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
|
|
11
11
|
* picker components receive these and call `onConnect(id)` when the user picks
|
|
12
|
-
* a wallet; `@pollar/react` wraps that into `client.
|
|
12
|
+
* a wallet; `@pollar/react` wraps that into `client.login({ provider: id })`.
|
|
13
13
|
*/
|
|
14
14
|
interface RenderWalletsProps {
|
|
15
|
-
/** Wrapper around `client.
|
|
15
|
+
/** Wrapper around `client.login({ provider: id })`. */
|
|
16
16
|
onConnect: (id: WalletId) => void;
|
|
17
17
|
/** Current auth state — picker can disable buttons / surface loading. */
|
|
18
18
|
authState: AuthState;
|
|
@@ -23,24 +23,6 @@ interface RenderWalletsProps {
|
|
|
23
23
|
* with whatever the slot returns (typically a kit-powered wallet grid).
|
|
24
24
|
*/
|
|
25
25
|
type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* Presentation metadata for a custom login provider button in the LoginModal
|
|
28
|
-
* (e.g. Privy, Magic). Pairs with a {@link PollarAuthProvider} registered on the
|
|
29
|
-
* client via its `providers` config: clicking the button calls
|
|
30
|
-
* `client.login({ provider: id })`, and the provider opens its own UI.
|
|
31
|
-
*
|
|
32
|
-
* Logic (the actual login) lives in the `PollarAuthProvider`; this is only the
|
|
33
|
-
* button's look. Keeping them separate means React never needs to know how a
|
|
34
|
-
* provider authenticates.
|
|
35
|
-
*/
|
|
36
|
-
interface CustomLoginProvider {
|
|
37
|
-
/** Must match the `id` of a registered `PollarAuthProvider`. */
|
|
38
|
-
id: string;
|
|
39
|
-
/** Button label, e.g. "Continue with Privy". */
|
|
40
|
-
label: string;
|
|
41
|
-
/** Optional icon URL rendered in the button. */
|
|
42
|
-
iconUrl?: string;
|
|
43
|
-
}
|
|
44
26
|
interface LoginButtonProps {
|
|
45
27
|
onSuccess?: () => void;
|
|
46
28
|
onError?: (error: Error) => void;
|
|
@@ -78,10 +60,8 @@ interface PollarContextValue {
|
|
|
78
60
|
openSessionsModal: () => void;
|
|
79
61
|
appConfig: PollarConfig;
|
|
80
62
|
styles: PollarStyles;
|
|
81
|
-
/** UI slot
|
|
63
|
+
/** UI slot overriding the per-adapter wallet button list (forwarded from provider props). */
|
|
82
64
|
renderWallets?: RenderWalletsSlot;
|
|
83
|
-
/** Custom login provider buttons (forwarded from `ui.customProviders`). */
|
|
84
|
-
customProviders?: CustomLoginProvider[];
|
|
85
65
|
openTxModal: () => void;
|
|
86
66
|
tx: TransactionState;
|
|
87
67
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
|
|
@@ -152,14 +132,8 @@ interface PollarProviderProps {
|
|
|
152
132
|
appConfig?: PollarConfig;
|
|
153
133
|
/** UI customization slots. */
|
|
154
134
|
ui?: {
|
|
155
|
-
/** Replaces the default
|
|
135
|
+
/** Replaces the default per-adapter wallet button list with a custom picker. */
|
|
156
136
|
renderWallets?: RenderWalletsSlot;
|
|
157
|
-
/**
|
|
158
|
-
* Custom login provider buttons (e.g. Privy) shown in the LoginModal. Each
|
|
159
|
-
* must match a {@link PollarAuthProvider} registered on the client; clicking
|
|
160
|
-
* one calls `client.login({ provider: id })` and the provider opens its own UI.
|
|
161
|
-
*/
|
|
162
|
-
customProviders?: CustomLoginProvider[];
|
|
163
137
|
};
|
|
164
138
|
adapters?: PollarAdapters;
|
|
165
139
|
/**
|
|
@@ -268,6 +242,13 @@ interface DistributionRulesModalProps {
|
|
|
268
242
|
}
|
|
269
243
|
declare function DistributionRulesModal({ onClose }: DistributionRulesModalProps): react_jsx_runtime.JSX.Element;
|
|
270
244
|
|
|
245
|
+
type WalletAdapterEntry = {
|
|
246
|
+
id: WalletId;
|
|
247
|
+
meta: {
|
|
248
|
+
label: string;
|
|
249
|
+
iconUrl?: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
271
252
|
interface LoginModalTemplateProps {
|
|
272
253
|
theme: string;
|
|
273
254
|
accentColor: string;
|
|
@@ -284,15 +265,13 @@ interface LoginModalTemplateProps {
|
|
|
284
265
|
github: boolean;
|
|
285
266
|
apple: boolean;
|
|
286
267
|
};
|
|
287
|
-
/**
|
|
288
|
-
|
|
268
|
+
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, …). */
|
|
269
|
+
walletAdapters: WalletAdapterEntry[];
|
|
289
270
|
appName: string;
|
|
290
271
|
email?: string;
|
|
291
272
|
onEmailChange?: (email: string) => void;
|
|
292
273
|
onEmailSubmit?: () => void;
|
|
293
274
|
onSocialLogin?: (provider: 'google' | 'github') => void;
|
|
294
|
-
/** Triggers a custom provider login by id (wraps `client.login({ provider: id })`). */
|
|
295
|
-
onCustomLogin?: (id: string) => void;
|
|
296
275
|
onWalletConnect?: (id: WalletId) => void;
|
|
297
276
|
/** Log in with an existing passkey (returning user). */
|
|
298
277
|
onLoginSmartWallet?: () => void;
|
|
@@ -307,7 +286,7 @@ interface LoginModalTemplateProps {
|
|
|
307
286
|
onCancel: () => void;
|
|
308
287
|
onRetry: () => void;
|
|
309
288
|
}
|
|
310
|
-
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers,
|
|
289
|
+
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
311
290
|
|
|
312
291
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
313
292
|
interface KycModalTemplateProps {
|
|
@@ -483,4 +462,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
483
462
|
}
|
|
484
463
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
485
464
|
|
|
486
|
-
export { type AuthModalProps,
|
|
465
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ type PollarStyles = PollarConfig['styles'];
|
|
|
9
9
|
/**
|
|
10
10
|
* Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
|
|
11
11
|
* picker components receive these and call `onConnect(id)` when the user picks
|
|
12
|
-
* a wallet; `@pollar/react` wraps that into `client.
|
|
12
|
+
* a wallet; `@pollar/react` wraps that into `client.login({ provider: id })`.
|
|
13
13
|
*/
|
|
14
14
|
interface RenderWalletsProps {
|
|
15
|
-
/** Wrapper around `client.
|
|
15
|
+
/** Wrapper around `client.login({ provider: id })`. */
|
|
16
16
|
onConnect: (id: WalletId) => void;
|
|
17
17
|
/** Current auth state — picker can disable buttons / surface loading. */
|
|
18
18
|
authState: AuthState;
|
|
@@ -23,24 +23,6 @@ interface RenderWalletsProps {
|
|
|
23
23
|
* with whatever the slot returns (typically a kit-powered wallet grid).
|
|
24
24
|
*/
|
|
25
25
|
type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* Presentation metadata for a custom login provider button in the LoginModal
|
|
28
|
-
* (e.g. Privy, Magic). Pairs with a {@link PollarAuthProvider} registered on the
|
|
29
|
-
* client via its `providers` config: clicking the button calls
|
|
30
|
-
* `client.login({ provider: id })`, and the provider opens its own UI.
|
|
31
|
-
*
|
|
32
|
-
* Logic (the actual login) lives in the `PollarAuthProvider`; this is only the
|
|
33
|
-
* button's look. Keeping them separate means React never needs to know how a
|
|
34
|
-
* provider authenticates.
|
|
35
|
-
*/
|
|
36
|
-
interface CustomLoginProvider {
|
|
37
|
-
/** Must match the `id` of a registered `PollarAuthProvider`. */
|
|
38
|
-
id: string;
|
|
39
|
-
/** Button label, e.g. "Continue with Privy". */
|
|
40
|
-
label: string;
|
|
41
|
-
/** Optional icon URL rendered in the button. */
|
|
42
|
-
iconUrl?: string;
|
|
43
|
-
}
|
|
44
26
|
interface LoginButtonProps {
|
|
45
27
|
onSuccess?: () => void;
|
|
46
28
|
onError?: (error: Error) => void;
|
|
@@ -78,10 +60,8 @@ interface PollarContextValue {
|
|
|
78
60
|
openSessionsModal: () => void;
|
|
79
61
|
appConfig: PollarConfig;
|
|
80
62
|
styles: PollarStyles;
|
|
81
|
-
/** UI slot
|
|
63
|
+
/** UI slot overriding the per-adapter wallet button list (forwarded from provider props). */
|
|
82
64
|
renderWallets?: RenderWalletsSlot;
|
|
83
|
-
/** Custom login provider buttons (forwarded from `ui.customProviders`). */
|
|
84
|
-
customProviders?: CustomLoginProvider[];
|
|
85
65
|
openTxModal: () => void;
|
|
86
66
|
tx: TransactionState;
|
|
87
67
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
|
|
@@ -152,14 +132,8 @@ interface PollarProviderProps {
|
|
|
152
132
|
appConfig?: PollarConfig;
|
|
153
133
|
/** UI customization slots. */
|
|
154
134
|
ui?: {
|
|
155
|
-
/** Replaces the default
|
|
135
|
+
/** Replaces the default per-adapter wallet button list with a custom picker. */
|
|
156
136
|
renderWallets?: RenderWalletsSlot;
|
|
157
|
-
/**
|
|
158
|
-
* Custom login provider buttons (e.g. Privy) shown in the LoginModal. Each
|
|
159
|
-
* must match a {@link PollarAuthProvider} registered on the client; clicking
|
|
160
|
-
* one calls `client.login({ provider: id })` and the provider opens its own UI.
|
|
161
|
-
*/
|
|
162
|
-
customProviders?: CustomLoginProvider[];
|
|
163
137
|
};
|
|
164
138
|
adapters?: PollarAdapters;
|
|
165
139
|
/**
|
|
@@ -268,6 +242,13 @@ interface DistributionRulesModalProps {
|
|
|
268
242
|
}
|
|
269
243
|
declare function DistributionRulesModal({ onClose }: DistributionRulesModalProps): react_jsx_runtime.JSX.Element;
|
|
270
244
|
|
|
245
|
+
type WalletAdapterEntry = {
|
|
246
|
+
id: WalletId;
|
|
247
|
+
meta: {
|
|
248
|
+
label: string;
|
|
249
|
+
iconUrl?: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
271
252
|
interface LoginModalTemplateProps {
|
|
272
253
|
theme: string;
|
|
273
254
|
accentColor: string;
|
|
@@ -284,15 +265,13 @@ interface LoginModalTemplateProps {
|
|
|
284
265
|
github: boolean;
|
|
285
266
|
apple: boolean;
|
|
286
267
|
};
|
|
287
|
-
/**
|
|
288
|
-
|
|
268
|
+
/** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, …). */
|
|
269
|
+
walletAdapters: WalletAdapterEntry[];
|
|
289
270
|
appName: string;
|
|
290
271
|
email?: string;
|
|
291
272
|
onEmailChange?: (email: string) => void;
|
|
292
273
|
onEmailSubmit?: () => void;
|
|
293
274
|
onSocialLogin?: (provider: 'google' | 'github') => void;
|
|
294
|
-
/** Triggers a custom provider login by id (wraps `client.login({ provider: id })`). */
|
|
295
|
-
onCustomLogin?: (id: string) => void;
|
|
296
275
|
onWalletConnect?: (id: WalletId) => void;
|
|
297
276
|
/** Log in with an existing passkey (returning user). */
|
|
298
277
|
onLoginSmartWallet?: () => void;
|
|
@@ -307,7 +286,7 @@ interface LoginModalTemplateProps {
|
|
|
307
286
|
onCancel: () => void;
|
|
308
287
|
onRetry: () => void;
|
|
309
288
|
}
|
|
310
|
-
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers,
|
|
289
|
+
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
311
290
|
|
|
312
291
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
313
292
|
interface KycModalTemplateProps {
|
|
@@ -483,4 +462,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
483
462
|
}
|
|
484
463
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
485
464
|
|
|
486
|
-
export { type AuthModalProps,
|
|
465
|
+
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 };
|
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.10.0-rc.
|
|
1038
|
+
"0.10.0-rc.8"
|
|
1039
1039
|
] })
|
|
1040
1040
|
] })
|
|
1041
1041
|
] });
|
|
@@ -1852,35 +1852,15 @@ var GoogleButton = ({ disabled, onClick }) => {
|
|
|
1852
1852
|
] })
|
|
1853
1853
|
] });
|
|
1854
1854
|
};
|
|
1855
|
-
function
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
children: [
|
|
1865
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_FREIGHTER, alt: "Freighter", className: "pollar-wallet-list-icon" }),
|
|
1866
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Freighter" })
|
|
1867
|
-
]
|
|
1868
|
-
}
|
|
1869
|
-
),
|
|
1870
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1871
|
-
"button",
|
|
1872
|
-
{
|
|
1873
|
-
type: "button",
|
|
1874
|
-
disabled: isLoading,
|
|
1875
|
-
className: "pollar-wallet-list-btn",
|
|
1876
|
-
onClick: () => onConnect(core.WalletType.ALBEDO),
|
|
1877
|
-
children: [
|
|
1878
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_ALBEDO, alt: "Albedo", className: "pollar-wallet-list-icon" }),
|
|
1879
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Albedo" })
|
|
1880
|
-
]
|
|
1881
|
-
}
|
|
1882
|
-
)
|
|
1883
|
-
] });
|
|
1855
|
+
function WalletAdapterButtons({
|
|
1856
|
+
walletAdapters,
|
|
1857
|
+
onConnect,
|
|
1858
|
+
isLoading
|
|
1859
|
+
}) {
|
|
1860
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-list", children: walletAdapters.map((a) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", disabled: isLoading, className: "pollar-wallet-list-btn", onClick: () => onConnect(a.id), children: [
|
|
1861
|
+
a.meta.iconUrl && /* @__PURE__ */ jsxRuntime.jsx("img", { src: a.meta.iconUrl, alt: a.meta.label, className: "pollar-wallet-list-icon" }),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: a.meta.label })
|
|
1863
|
+
] }, a.id)) });
|
|
1884
1864
|
}
|
|
1885
1865
|
var AUTH_STATE_MESSAGES = {
|
|
1886
1866
|
idle: "",
|
|
@@ -1928,13 +1908,12 @@ function LoginModalTemplate({
|
|
|
1928
1908
|
embeddedWallets,
|
|
1929
1909
|
smartWallet = false,
|
|
1930
1910
|
providers,
|
|
1931
|
-
|
|
1911
|
+
walletAdapters,
|
|
1932
1912
|
appName,
|
|
1933
1913
|
email = "",
|
|
1934
1914
|
onEmailChange,
|
|
1935
1915
|
onEmailSubmit,
|
|
1936
1916
|
onSocialLogin,
|
|
1937
|
-
onCustomLogin,
|
|
1938
1917
|
onWalletConnect,
|
|
1939
1918
|
onLoginSmartWallet,
|
|
1940
1919
|
onCreateSmartWallet,
|
|
@@ -2016,7 +1995,7 @@ function LoginModalTemplate({
|
|
|
2016
1995
|
] }) : showWalletPicker ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2017
1996
|
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowWalletPicker(false) }),
|
|
2018
1997
|
renderWallets ? renderWallets({ onConnect: onWalletConnect ?? (() => {
|
|
2019
|
-
}), authState }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
}), authState }) : /* @__PURE__ */ jsxRuntime.jsx(WalletAdapterButtons, { walletAdapters, onConnect: onWalletConnect ?? (() => {
|
|
2020
1999
|
}), isLoading })
|
|
2021
2000
|
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2022
2001
|
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
@@ -2050,7 +2029,7 @@ function LoginModalTemplate({
|
|
|
2050
2029
|
}
|
|
2051
2030
|
)
|
|
2052
2031
|
] }),
|
|
2053
|
-
emailEnabled &&
|
|
2032
|
+
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
|
|
2054
2033
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
|
|
2055
2034
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: "or continue with" }) })
|
|
2056
2035
|
] }),
|
|
@@ -2058,20 +2037,6 @@ function LoginModalTemplate({
|
|
|
2058
2037
|
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
2059
2038
|
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
2060
2039
|
] }),
|
|
2061
|
-
customProviders.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-social-list", children: customProviders.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2062
|
-
"button",
|
|
2063
|
-
{
|
|
2064
|
-
type: "button",
|
|
2065
|
-
disabled: isLoading,
|
|
2066
|
-
className: "pollar-wallet-entry-btn",
|
|
2067
|
-
onClick: () => onCustomLogin?.(p.id),
|
|
2068
|
-
children: [
|
|
2069
|
-
p.iconUrl && /* @__PURE__ */ jsxRuntime.jsx("img", { src: p.iconUrl, alt: "", className: "pollar-wallet-list-icon" }),
|
|
2070
|
-
p.label
|
|
2071
|
-
]
|
|
2072
|
-
},
|
|
2073
|
-
p.id
|
|
2074
|
-
)) }),
|
|
2075
2040
|
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
2076
2041
|
embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2077
2042
|
"button",
|
|
@@ -2141,8 +2106,9 @@ function LoginModalTemplate({
|
|
|
2141
2106
|
}
|
|
2142
2107
|
function LoginModal({ onClose }) {
|
|
2143
2108
|
const [email, setEmail] = react.useState("");
|
|
2144
|
-
const { getClient, styles, appConfig: config, renderWallets
|
|
2109
|
+
const { getClient, styles, appConfig: config, renderWallets } = usePollar();
|
|
2145
2110
|
const [authState, setAuthState] = react.useState(() => getClient().getAuthState());
|
|
2111
|
+
const walletAdapters = react.useMemo(() => getClient().listWalletAdapters(), [getClient]);
|
|
2146
2112
|
const [codeInputKey, setCodeInputKey] = react.useState(0);
|
|
2147
2113
|
const pendingEmail = react.useRef(null);
|
|
2148
2114
|
const onCloseRef = react.useRef(onClose);
|
|
@@ -2191,11 +2157,8 @@ function LoginModal({ onClose }) {
|
|
|
2191
2157
|
function handleSocialLogin(provider) {
|
|
2192
2158
|
getClient().login({ provider });
|
|
2193
2159
|
}
|
|
2194
|
-
function handleCustomLogin(id) {
|
|
2195
|
-
getClient().login({ provider: id });
|
|
2196
|
-
}
|
|
2197
2160
|
function handleWalletConnect(type) {
|
|
2198
|
-
getClient().
|
|
2161
|
+
getClient().login({ provider: type });
|
|
2199
2162
|
}
|
|
2200
2163
|
function handleLoginSmartWallet() {
|
|
2201
2164
|
getClient().loginSmartWallet();
|
|
@@ -2232,13 +2195,12 @@ function LoginModal({ onClose }) {
|
|
|
2232
2195
|
github: !!providers?.github,
|
|
2233
2196
|
apple: !!providers?.apple
|
|
2234
2197
|
},
|
|
2235
|
-
|
|
2198
|
+
walletAdapters,
|
|
2236
2199
|
appName: config.application?.name ?? "Pollar",
|
|
2237
2200
|
email,
|
|
2238
2201
|
onEmailChange: setEmail,
|
|
2239
2202
|
onEmailSubmit: handleEmailSubmit,
|
|
2240
2203
|
onSocialLogin: handleSocialLogin,
|
|
2241
|
-
onCustomLogin: handleCustomLogin,
|
|
2242
2204
|
onWalletConnect: handleWalletConnect,
|
|
2243
2205
|
onLoginSmartWallet: handleLoginSmartWallet,
|
|
2244
2206
|
onCreateSmartWallet: handleCreateSmartWallet,
|
|
@@ -4085,7 +4047,6 @@ function PollarProvider({
|
|
|
4085
4047
|
const refreshWalletBalance = react.useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
|
|
4086
4048
|
const refreshAssets = react.useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
|
|
4087
4049
|
const renderWallets = ui?.renderWallets;
|
|
4088
|
-
const customProviders = ui?.customProviders;
|
|
4089
4050
|
const contextValue = react.useMemo(() => {
|
|
4090
4051
|
const styles = resolvedConfig.styles ?? {};
|
|
4091
4052
|
return {
|
|
@@ -4142,7 +4103,6 @@ function PollarProvider({
|
|
|
4142
4103
|
appConfig: resolvedConfig,
|
|
4143
4104
|
styles,
|
|
4144
4105
|
renderWallets,
|
|
4145
|
-
customProviders,
|
|
4146
4106
|
adapters
|
|
4147
4107
|
};
|
|
4148
4108
|
}, [
|
|
@@ -4160,8 +4120,7 @@ function PollarProvider({
|
|
|
4160
4120
|
networkState,
|
|
4161
4121
|
resolvedConfig,
|
|
4162
4122
|
adapters,
|
|
4163
|
-
renderWallets
|
|
4164
|
-
customProviders
|
|
4123
|
+
renderWallets
|
|
4165
4124
|
]);
|
|
4166
4125
|
return /* @__PURE__ */ jsxRuntime.jsxs(PollarContext.Provider, { value: contextValue, children: [
|
|
4167
4126
|
children,
|