@swype-org/react-sdk 0.1.216 → 0.1.218
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.cjs +6 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +9 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -262,6 +262,12 @@ interface BlinkProviderProps {
|
|
|
262
262
|
apiBaseUrl: string;
|
|
263
263
|
/** Light or dark mode */
|
|
264
264
|
theme?: ThemeMode;
|
|
265
|
+
/**
|
|
266
|
+
* Override the Privy App ID used for authentication.
|
|
267
|
+
* @internal Blink-internal only — used for dev/test environments (e.g. smokebox).
|
|
268
|
+
* Not intended for merchant integrations.
|
|
269
|
+
*/
|
|
270
|
+
privyAppId?: string;
|
|
265
271
|
children: React.ReactNode;
|
|
266
272
|
}
|
|
267
273
|
/**
|
|
@@ -278,7 +284,7 @@ interface BlinkProviderProps {
|
|
|
278
284
|
* </BlinkProvider>
|
|
279
285
|
* ```
|
|
280
286
|
*/
|
|
281
|
-
declare function BlinkProvider({ apiBaseUrl, theme, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
287
|
+
declare function BlinkProvider({ apiBaseUrl, theme, privyAppId, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
282
288
|
/** Access the Blink SDK configuration. Throws if used outside BlinkProvider. */
|
|
283
289
|
declare function useBlinkConfig(): BlinkConfig;
|
|
284
290
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,12 @@ interface BlinkProviderProps {
|
|
|
262
262
|
apiBaseUrl: string;
|
|
263
263
|
/** Light or dark mode */
|
|
264
264
|
theme?: ThemeMode;
|
|
265
|
+
/**
|
|
266
|
+
* Override the Privy App ID used for authentication.
|
|
267
|
+
* @internal Blink-internal only — used for dev/test environments (e.g. smokebox).
|
|
268
|
+
* Not intended for merchant integrations.
|
|
269
|
+
*/
|
|
270
|
+
privyAppId?: string;
|
|
265
271
|
children: React.ReactNode;
|
|
266
272
|
}
|
|
267
273
|
/**
|
|
@@ -278,7 +284,7 @@ interface BlinkProviderProps {
|
|
|
278
284
|
* </BlinkProvider>
|
|
279
285
|
* ```
|
|
280
286
|
*/
|
|
281
|
-
declare function BlinkProvider({ apiBaseUrl, theme, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
287
|
+
declare function BlinkProvider({ apiBaseUrl, theme, privyAppId, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
282
288
|
/** Access the Blink SDK configuration. Throws if used outside BlinkProvider. */
|
|
283
289
|
declare function useBlinkConfig(): BlinkConfig;
|
|
284
290
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createContext, useRef,
|
|
1
|
+
import { createContext, useRef, useState, useCallback, useMemo, useContext, useEffect, useReducer, Component } from 'react';
|
|
2
2
|
import { PrivyProvider, usePrivy, useLoginWithOAuth, useLoginWithEmail, useLoginWithSms } from '@privy-io/react-auth';
|
|
3
3
|
import { createConfig, http, WagmiProvider, useConfig, useConnect, useSwitchChain } from 'wagmi';
|
|
4
4
|
import { mainnet, arbitrum, base, polygon, bsc } from 'wagmi/chains';
|
|
5
|
-
import { injected
|
|
5
|
+
import { injected } from 'wagmi/connectors';
|
|
6
6
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { recoverTypedDataAddress, decodeAbiParameters, walletActions, createClient, custom } from 'viem';
|
|
@@ -14,19 +14,6 @@ var __export = (target, all) => {
|
|
|
14
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
// src/contentsquare.ts
|
|
18
|
-
var SCRIPT_SRC = "https://t.contentsquare.net/uxa/9537de3817f8f.js";
|
|
19
|
-
var injected = false;
|
|
20
|
-
function loadContentsquare() {
|
|
21
|
-
if (injected) return;
|
|
22
|
-
if (typeof document === "undefined") return;
|
|
23
|
-
injected = true;
|
|
24
|
-
const script = document.createElement("script");
|
|
25
|
-
script.src = SCRIPT_SRC;
|
|
26
|
-
script.async = true;
|
|
27
|
-
document.head.appendChild(script);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
17
|
// src/theme.ts
|
|
31
18
|
var darkTheme = {
|
|
32
19
|
bg: "#071216",
|
|
@@ -88,7 +75,7 @@ function getTheme(mode) {
|
|
|
88
75
|
var BLINK_PRIVY_APP_ID = "cmlil87uv004n0ck0blwumwek";
|
|
89
76
|
var wagmiConfig = createConfig({
|
|
90
77
|
chains: [mainnet, arbitrum, base, polygon, bsc],
|
|
91
|
-
connectors: [injected
|
|
78
|
+
connectors: [injected({ shimDisconnect: true, unstable_shimAsyncInject: 2e3 })],
|
|
92
79
|
transports: {
|
|
93
80
|
[mainnet.id]: http(),
|
|
94
81
|
[arbitrum.id]: http(),
|
|
@@ -101,15 +88,13 @@ var BlinkContext = createContext(null);
|
|
|
101
88
|
function BlinkProvider({
|
|
102
89
|
apiBaseUrl,
|
|
103
90
|
theme = "dark",
|
|
91
|
+
privyAppId,
|
|
104
92
|
children
|
|
105
93
|
}) {
|
|
106
94
|
const queryClientRef = useRef(null);
|
|
107
95
|
if (!queryClientRef.current) {
|
|
108
96
|
queryClientRef.current = new QueryClient();
|
|
109
97
|
}
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
loadContentsquare();
|
|
112
|
-
}, []);
|
|
113
98
|
const [depositAmount, setDepositAmountRaw] = useState(null);
|
|
114
99
|
const setDepositAmount = useCallback((amount) => {
|
|
115
100
|
setDepositAmountRaw(amount);
|
|
@@ -127,7 +112,7 @@ function BlinkProvider({
|
|
|
127
112
|
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClientRef.current, children: /* @__PURE__ */ jsx(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx(
|
|
128
113
|
PrivyProvider,
|
|
129
114
|
{
|
|
130
|
-
appId: BLINK_PRIVY_APP_ID,
|
|
115
|
+
appId: privyAppId ?? BLINK_PRIVY_APP_ID,
|
|
131
116
|
config: {
|
|
132
117
|
appearance: {
|
|
133
118
|
theme,
|
|
@@ -3279,13 +3264,8 @@ function WalletPickerScreen({
|
|
|
3279
3264
|
}
|
|
3280
3265
|
}, [onPrepareProvider]);
|
|
3281
3266
|
const hasPending = pendingConnections != null && pendingConnections.length > 0;
|
|
3282
|
-
const
|
|
3283
|
-
|
|
3284
|
-
{ id: "rabby", name: "Rabby" },
|
|
3285
|
-
{ id: "ora", name: "Ora" },
|
|
3286
|
-
{ id: "phantom", name: "Phantom" }
|
|
3287
|
-
];
|
|
3288
|
-
const selectedProvider = displayProviders.find((p) => p.id === selectedProviderId);
|
|
3267
|
+
const providersLoading = providers.length === 0;
|
|
3268
|
+
const selectedProvider = providers.find((p) => p.id === selectedProviderId);
|
|
3289
3269
|
if (loading) {
|
|
3290
3270
|
return /* @__PURE__ */ jsxs(ScreenLayout, { children: [
|
|
3291
3271
|
/* @__PURE__ */ jsx(ScreenHeader, { title: "Set up Blink", onBack, onLogout }),
|
|
@@ -3380,7 +3360,8 @@ function WalletPickerScreen({
|
|
|
3380
3360
|
]
|
|
3381
3361
|
}
|
|
3382
3362
|
),
|
|
3383
|
-
cryptoExpanded && /* @__PURE__ */ jsx("div", { style:
|
|
3363
|
+
cryptoExpanded && providersLoading && /* @__PURE__ */ jsx("div", { style: { textAlign: "center", padding: "24px 0" }, children: /* @__PURE__ */ jsx(Spinner, { label: "Loading wallets..." }) }),
|
|
3364
|
+
cryptoExpanded && !providersLoading && /* @__PURE__ */ jsx("div", { style: gridStyle, children: providers.map((p) => {
|
|
3384
3365
|
const logoSrc = "logoURI" in p && p.logoURI || KNOWN_LOGOS[p.name.toLowerCase()];
|
|
3385
3366
|
const emoji = WALLET_EMOJIS[p.name.toLowerCase()] ?? p.name.charAt(0);
|
|
3386
3367
|
const isSelected = selectedProviderId === p.id;
|