@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.mjs
CHANGED
|
@@ -1033,7 +1033,7 @@ var PollarModalFooter = () => {
|
|
|
1033
1033
|
/* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1034
1034
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1035
1035
|
"v",
|
|
1036
|
-
"0.10.0-rc.
|
|
1036
|
+
"0.10.0-rc.8"
|
|
1037
1037
|
] })
|
|
1038
1038
|
] })
|
|
1039
1039
|
] });
|
|
@@ -1850,35 +1850,15 @@ var GoogleButton = ({ disabled, onClick }) => {
|
|
|
1850
1850
|
] })
|
|
1851
1851
|
] });
|
|
1852
1852
|
};
|
|
1853
|
-
function
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
children: [
|
|
1863
|
-
/* @__PURE__ */ jsx("img", { src: LOGO_FREIGHTER, alt: "Freighter", className: "pollar-wallet-list-icon" }),
|
|
1864
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-wallet-list-name", children: "Freighter" })
|
|
1865
|
-
]
|
|
1866
|
-
}
|
|
1867
|
-
),
|
|
1868
|
-
/* @__PURE__ */ jsxs(
|
|
1869
|
-
"button",
|
|
1870
|
-
{
|
|
1871
|
-
type: "button",
|
|
1872
|
-
disabled: isLoading,
|
|
1873
|
-
className: "pollar-wallet-list-btn",
|
|
1874
|
-
onClick: () => onConnect(WalletType.ALBEDO),
|
|
1875
|
-
children: [
|
|
1876
|
-
/* @__PURE__ */ jsx("img", { src: LOGO_ALBEDO, alt: "Albedo", className: "pollar-wallet-list-icon" }),
|
|
1877
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-wallet-list-name", children: "Albedo" })
|
|
1878
|
-
]
|
|
1879
|
-
}
|
|
1880
|
-
)
|
|
1881
|
-
] });
|
|
1853
|
+
function WalletAdapterButtons({
|
|
1854
|
+
walletAdapters,
|
|
1855
|
+
onConnect,
|
|
1856
|
+
isLoading
|
|
1857
|
+
}) {
|
|
1858
|
+
return /* @__PURE__ */ jsx("div", { className: "pollar-wallet-list", children: walletAdapters.map((a) => /* @__PURE__ */ jsxs("button", { type: "button", disabled: isLoading, className: "pollar-wallet-list-btn", onClick: () => onConnect(a.id), children: [
|
|
1859
|
+
a.meta.iconUrl && /* @__PURE__ */ jsx("img", { src: a.meta.iconUrl, alt: a.meta.label, className: "pollar-wallet-list-icon" }),
|
|
1860
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-wallet-list-name", children: a.meta.label })
|
|
1861
|
+
] }, a.id)) });
|
|
1882
1862
|
}
|
|
1883
1863
|
var AUTH_STATE_MESSAGES = {
|
|
1884
1864
|
idle: "",
|
|
@@ -1926,13 +1906,12 @@ function LoginModalTemplate({
|
|
|
1926
1906
|
embeddedWallets,
|
|
1927
1907
|
smartWallet = false,
|
|
1928
1908
|
providers,
|
|
1929
|
-
|
|
1909
|
+
walletAdapters,
|
|
1930
1910
|
appName,
|
|
1931
1911
|
email = "",
|
|
1932
1912
|
onEmailChange,
|
|
1933
1913
|
onEmailSubmit,
|
|
1934
1914
|
onSocialLogin,
|
|
1935
|
-
onCustomLogin,
|
|
1936
1915
|
onWalletConnect,
|
|
1937
1916
|
onLoginSmartWallet,
|
|
1938
1917
|
onCreateSmartWallet,
|
|
@@ -2014,7 +1993,7 @@ function LoginModalTemplate({
|
|
|
2014
1993
|
] }) : showWalletPicker ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2015
1994
|
/* @__PURE__ */ jsx(BackButton, { onClick: () => setShowWalletPicker(false) }),
|
|
2016
1995
|
renderWallets ? renderWallets({ onConnect: onWalletConnect ?? (() => {
|
|
2017
|
-
}), authState }) : /* @__PURE__ */ jsx(
|
|
1996
|
+
}), authState }) : /* @__PURE__ */ jsx(WalletAdapterButtons, { walletAdapters, onConnect: onWalletConnect ?? (() => {
|
|
2018
1997
|
}), isLoading })
|
|
2019
1998
|
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2020
1999
|
/* @__PURE__ */ jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
@@ -2048,7 +2027,7 @@ function LoginModalTemplate({
|
|
|
2048
2027
|
}
|
|
2049
2028
|
)
|
|
2050
2029
|
] }),
|
|
2051
|
-
emailEnabled &&
|
|
2030
|
+
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
|
|
2052
2031
|
/* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
|
|
2053
2032
|
/* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: "or continue with" }) })
|
|
2054
2033
|
] }),
|
|
@@ -2056,20 +2035,6 @@ function LoginModalTemplate({
|
|
|
2056
2035
|
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
2057
2036
|
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
2058
2037
|
] }),
|
|
2059
|
-
customProviders.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-social-list", children: customProviders.map((p) => /* @__PURE__ */ jsxs(
|
|
2060
|
-
"button",
|
|
2061
|
-
{
|
|
2062
|
-
type: "button",
|
|
2063
|
-
disabled: isLoading,
|
|
2064
|
-
className: "pollar-wallet-entry-btn",
|
|
2065
|
-
onClick: () => onCustomLogin?.(p.id),
|
|
2066
|
-
children: [
|
|
2067
|
-
p.iconUrl && /* @__PURE__ */ jsx("img", { src: p.iconUrl, alt: "", className: "pollar-wallet-list-icon" }),
|
|
2068
|
-
p.label
|
|
2069
|
-
]
|
|
2070
|
-
},
|
|
2071
|
-
p.id
|
|
2072
|
-
)) }),
|
|
2073
2038
|
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
|
|
2074
2039
|
embeddedWallets && /* @__PURE__ */ jsxs(
|
|
2075
2040
|
"button",
|
|
@@ -2139,8 +2104,9 @@ function LoginModalTemplate({
|
|
|
2139
2104
|
}
|
|
2140
2105
|
function LoginModal({ onClose }) {
|
|
2141
2106
|
const [email, setEmail] = useState("");
|
|
2142
|
-
const { getClient, styles, appConfig: config, renderWallets
|
|
2107
|
+
const { getClient, styles, appConfig: config, renderWallets } = usePollar();
|
|
2143
2108
|
const [authState, setAuthState] = useState(() => getClient().getAuthState());
|
|
2109
|
+
const walletAdapters = useMemo(() => getClient().listWalletAdapters(), [getClient]);
|
|
2144
2110
|
const [codeInputKey, setCodeInputKey] = useState(0);
|
|
2145
2111
|
const pendingEmail = useRef(null);
|
|
2146
2112
|
const onCloseRef = useRef(onClose);
|
|
@@ -2189,11 +2155,8 @@ function LoginModal({ onClose }) {
|
|
|
2189
2155
|
function handleSocialLogin(provider) {
|
|
2190
2156
|
getClient().login({ provider });
|
|
2191
2157
|
}
|
|
2192
|
-
function handleCustomLogin(id) {
|
|
2193
|
-
getClient().login({ provider: id });
|
|
2194
|
-
}
|
|
2195
2158
|
function handleWalletConnect(type) {
|
|
2196
|
-
getClient().
|
|
2159
|
+
getClient().login({ provider: type });
|
|
2197
2160
|
}
|
|
2198
2161
|
function handleLoginSmartWallet() {
|
|
2199
2162
|
getClient().loginSmartWallet();
|
|
@@ -2230,13 +2193,12 @@ function LoginModal({ onClose }) {
|
|
|
2230
2193
|
github: !!providers?.github,
|
|
2231
2194
|
apple: !!providers?.apple
|
|
2232
2195
|
},
|
|
2233
|
-
|
|
2196
|
+
walletAdapters,
|
|
2234
2197
|
appName: config.application?.name ?? "Pollar",
|
|
2235
2198
|
email,
|
|
2236
2199
|
onEmailChange: setEmail,
|
|
2237
2200
|
onEmailSubmit: handleEmailSubmit,
|
|
2238
2201
|
onSocialLogin: handleSocialLogin,
|
|
2239
|
-
onCustomLogin: handleCustomLogin,
|
|
2240
2202
|
onWalletConnect: handleWalletConnect,
|
|
2241
2203
|
onLoginSmartWallet: handleLoginSmartWallet,
|
|
2242
2204
|
onCreateSmartWallet: handleCreateSmartWallet,
|
|
@@ -4083,7 +4045,6 @@ function PollarProvider({
|
|
|
4083
4045
|
const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
|
|
4084
4046
|
const refreshAssets = useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
|
|
4085
4047
|
const renderWallets = ui?.renderWallets;
|
|
4086
|
-
const customProviders = ui?.customProviders;
|
|
4087
4048
|
const contextValue = useMemo(() => {
|
|
4088
4049
|
const styles = resolvedConfig.styles ?? {};
|
|
4089
4050
|
return {
|
|
@@ -4140,7 +4101,6 @@ function PollarProvider({
|
|
|
4140
4101
|
appConfig: resolvedConfig,
|
|
4141
4102
|
styles,
|
|
4142
4103
|
renderWallets,
|
|
4143
|
-
customProviders,
|
|
4144
4104
|
adapters
|
|
4145
4105
|
};
|
|
4146
4106
|
}, [
|
|
@@ -4158,8 +4118,7 @@ function PollarProvider({
|
|
|
4158
4118
|
networkState,
|
|
4159
4119
|
resolvedConfig,
|
|
4160
4120
|
adapters,
|
|
4161
|
-
renderWallets
|
|
4162
|
-
customProviders
|
|
4121
|
+
renderWallets
|
|
4163
4122
|
]);
|
|
4164
4123
|
return /* @__PURE__ */ jsxs(PollarContext.Provider, { value: contextValue, children: [
|
|
4165
4124
|
children,
|