@fluent.xyz/connect 0.5.1 → 0.5.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/INTEGRATION.md +30 -2
- package/README.md +2 -1
- package/dist/fluent-connect.css +1 -1
- package/dist/index.js +51 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,9 +21,9 @@ import { twMerge } from 'tailwind-merge';
|
|
|
21
21
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
22
22
|
import { cva } from 'class-variance-authority';
|
|
23
23
|
import { XIcon, Trash2, RefreshCw, X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Loader2, ChevronDownIcon, CheckIcon, AlertTriangle, Layers, Plus, Loader2Icon, ChevronUpIcon, CircleHelp, LogIn, Send, RotateCw, KeyRound, Mail, Wallet, Check, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
24
|
+
import { QueryClient, QueryClientContext, QueryClientProvider, useInfiniteQuery, useQuery } from '@tanstack/react-query';
|
|
24
25
|
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
|
25
26
|
import { createAppKit, useAppKit } from '@reown/appkit/react';
|
|
26
|
-
import { QueryClient, QueryClientContext, QueryClientProvider, useInfiniteQuery, useQuery } from '@tanstack/react-query';
|
|
27
27
|
import { WagmiContext, WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain, useConnect, usePublicClient, useBalance, useReadContract, useWriteContract, useWaitForTransactionReceipt } from 'wagmi';
|
|
28
28
|
import { hydrate } from '@wagmi/core';
|
|
29
29
|
import { reconnect } from 'wagmi/actions';
|
|
@@ -5295,7 +5295,8 @@ var FLUENT_WIDGET_USER_TOKENS_IMPORT_MARKER_KEY = "fluent:widget:tokens-import:v
|
|
|
5295
5295
|
var FLUENT_WIDGET_REFRESH_CREDENTIAL_STORAGE_PREFIX = "fluent:widget:refresh:v1";
|
|
5296
5296
|
|
|
5297
5297
|
// src/core/config.ts
|
|
5298
|
-
var
|
|
5298
|
+
var FLUENT_CONNECT_TESTNET_PRIVY_APP_ID = "cmi7li7v901yojv0dmtfuf0v4";
|
|
5299
|
+
var FLUENT_CONNECT_MAINNET_PRIVY_APP_ID = "cmig3bvhd005hkz0c2q8vdg3s";
|
|
5299
5300
|
var FLUENT_CONNECT_REOWN_PROJECT_ID = "fbf7578f67b4a34e5101051131829ac0";
|
|
5300
5301
|
var FLUENT_CONNECT_TESTNET_ZERODEV_PROJECT_ID = "893acc63-da39-4b57-8789-5784ed7f1969";
|
|
5301
5302
|
var FLUENT_CONNECT_MAINNET_ZERODEV_PROJECT_ID = "216ca7d9-2b97-4894-ac23-7aa6a287dd97";
|
|
@@ -5351,6 +5352,13 @@ var FLUENT_CONNECT_ZERODEV_PROJECT_IDS = {
|
|
|
5351
5352
|
function getFluentZeroDevProjectId(network) {
|
|
5352
5353
|
return FLUENT_CONNECT_ZERODEV_PROJECT_IDS[network];
|
|
5353
5354
|
}
|
|
5355
|
+
var FLUENT_CONNECT_PRIVY_APP_IDS = {
|
|
5356
|
+
testnet: FLUENT_CONNECT_TESTNET_PRIVY_APP_ID,
|
|
5357
|
+
mainnet: FLUENT_CONNECT_MAINNET_PRIVY_APP_ID
|
|
5358
|
+
};
|
|
5359
|
+
function getFluentPrivyAppId(network) {
|
|
5360
|
+
return FLUENT_CONNECT_PRIVY_APP_IDS[network];
|
|
5361
|
+
}
|
|
5354
5362
|
var FLUENT_CONNECT_DEFAULT_ASSETS = {
|
|
5355
5363
|
fluentLogo: FLUENT_CONNECT_BUNDLED_ASSETS.fluentLogo,
|
|
5356
5364
|
walletConnectIcon: FLUENT_CONNECT_BUNDLED_ASSETS.walletConnectIcon,
|
|
@@ -8069,6 +8077,14 @@ var buttonVariants = cva(
|
|
|
8069
8077
|
}
|
|
8070
8078
|
}
|
|
8071
8079
|
);
|
|
8080
|
+
var linkVariants = {
|
|
8081
|
+
default: "text-primary-foreground! no-underline!",
|
|
8082
|
+
outline: "text-inherit! hover:text-foreground! aria-expanded:text-foreground! no-underline!",
|
|
8083
|
+
secondary: "text-button-foreground! no-underline!",
|
|
8084
|
+
ghost: "text-inherit! hover:text-foreground! no-underline!",
|
|
8085
|
+
destructive: "text-destructive! no-underline!",
|
|
8086
|
+
link: "text-primary! no-underline! hover:underline!"
|
|
8087
|
+
};
|
|
8072
8088
|
var Button = forwardRef(function Button2({ className, variant = "default", size = "default", href, target, rel, render, ...props }, ref) {
|
|
8073
8089
|
const isLink = href !== void 0;
|
|
8074
8090
|
return /* @__PURE__ */ jsx(
|
|
@@ -8077,7 +8093,7 @@ var Button = forwardRef(function Button2({ className, variant = "default", size
|
|
|
8077
8093
|
ref,
|
|
8078
8094
|
"data-slot": "button",
|
|
8079
8095
|
nativeButton: isLink ? false : void 0,
|
|
8080
|
-
className: cn(buttonVariants({ variant, size, className
|
|
8096
|
+
className: cn(buttonVariants({ variant, size }), isLink && linkVariants[variant ?? "default"], className),
|
|
8081
8097
|
render: isLink ? /* @__PURE__ */ jsx("a", { href, target, rel }) : render,
|
|
8082
8098
|
...props
|
|
8083
8099
|
}
|
|
@@ -9678,7 +9694,7 @@ function useFluentIframeBridge(iframeRef, { allowedOrigin }) {
|
|
|
9678
9694
|
}
|
|
9679
9695
|
|
|
9680
9696
|
// package.json
|
|
9681
|
-
var version = "0.5.
|
|
9697
|
+
var version = "0.5.3";
|
|
9682
9698
|
|
|
9683
9699
|
// src/core/analytics.ts
|
|
9684
9700
|
var INSTANCE_NAME = "fluent";
|
|
@@ -10332,7 +10348,7 @@ function ConsentLink({ href, children }) {
|
|
|
10332
10348
|
href,
|
|
10333
10349
|
target: "_blank",
|
|
10334
10350
|
rel: "noopener noreferrer",
|
|
10335
|
-
className: "whitespace-nowrap text-
|
|
10351
|
+
className: "whitespace-nowrap text-(--link)! underline! underline-offset-2 hover:text-(--link-hover)!",
|
|
10336
10352
|
children
|
|
10337
10353
|
}
|
|
10338
10354
|
);
|
|
@@ -15754,7 +15770,7 @@ function BridgeForm({
|
|
|
15754
15770
|
target: "_blank",
|
|
15755
15771
|
rel: "noopener noreferrer",
|
|
15756
15772
|
title: recipient,
|
|
15757
|
-
className: "underline underline-offset-2 hover:opacity-80",
|
|
15773
|
+
className: "text-inherit! underline! underline-offset-2 hover:opacity-80",
|
|
15758
15774
|
children: formatAddress(recipient)
|
|
15759
15775
|
}
|
|
15760
15776
|
) : /* @__PURE__ */ jsx("span", { className: "text-foreground/60", children: "Not signed in" }),
|
|
@@ -18315,7 +18331,8 @@ function FluentWidgetContent({
|
|
|
18315
18331
|
handledInlineLoginRequest,
|
|
18316
18332
|
authTokenState,
|
|
18317
18333
|
userSettingsRef,
|
|
18318
|
-
connectedPresentation
|
|
18334
|
+
connectedPresentation,
|
|
18335
|
+
appQueryClient
|
|
18319
18336
|
}) {
|
|
18320
18337
|
const internalWallet = useReownWallet();
|
|
18321
18338
|
const isMobile = useIsMobile();
|
|
@@ -18508,13 +18525,23 @@ function FluentWidgetContent({
|
|
|
18508
18525
|
commitSilentSigningEnabled(FLUENT_CONNECT_DEFAULT_SILENT_SIGNING);
|
|
18509
18526
|
connectedPresentation.current.connected = null;
|
|
18510
18527
|
connectedPresentation.current.rebuilding = null;
|
|
18511
|
-
clearPrivyRecentLoginMethod(
|
|
18528
|
+
clearPrivyRecentLoginMethod(getFluentPrivyAppId(resolvedConfig.network));
|
|
18512
18529
|
if (activeWallet?.connected) activeWallet.disconnect();
|
|
18513
18530
|
} finally {
|
|
18514
18531
|
disconnectingRef.current = false;
|
|
18515
18532
|
}
|
|
18516
18533
|
if (awaitAuthSession) await authSessionEnded;
|
|
18517
|
-
}, [
|
|
18534
|
+
}, [
|
|
18535
|
+
activeWallet,
|
|
18536
|
+
authenticated,
|
|
18537
|
+
commitSilentSigningEnabled,
|
|
18538
|
+
connectedPresentation,
|
|
18539
|
+
fluentConnect,
|
|
18540
|
+
logout,
|
|
18541
|
+
resolvedConfig.network,
|
|
18542
|
+
setDirectAuthRequested,
|
|
18543
|
+
setSession
|
|
18544
|
+
]);
|
|
18518
18545
|
const requestDisconnect = useCallback(() => {
|
|
18519
18546
|
track("wallet_disconnected");
|
|
18520
18547
|
return handleDisconnect({ awaitAuthSession: true });
|
|
@@ -19281,6 +19308,11 @@ function FluentWidgetContent({
|
|
|
19281
19308
|
linkX
|
|
19282
19309
|
]
|
|
19283
19310
|
);
|
|
19311
|
+
const appPage = (() => {
|
|
19312
|
+
const page = mode === "page" ? renderPage?.(context) : renderHome?.(context);
|
|
19313
|
+
if (!appQueryClient) return page;
|
|
19314
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: appQueryClient, children: page });
|
|
19315
|
+
})();
|
|
19284
19316
|
const widget = /* @__PURE__ */ jsxs(FluentPortalContainerProvider, { children: [
|
|
19285
19317
|
/* @__PURE__ */ jsx(FluentTopLayerBridge, {}),
|
|
19286
19318
|
!session && connectedWalletAddress !== void 0 ? /* @__PURE__ */ jsx(LinkXSiweSource, { source: linkXSiwe }) : null,
|
|
@@ -19375,7 +19407,7 @@ function FluentWidgetContent({
|
|
|
19375
19407
|
)
|
|
19376
19408
|
}
|
|
19377
19409
|
) }),
|
|
19378
|
-
/* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children:
|
|
19410
|
+
/* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: appPage }),
|
|
19379
19411
|
/* @__PURE__ */ jsxs("div", { className: WIDGET_STYLE_SCOPE, children: [
|
|
19380
19412
|
showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
|
|
19381
19413
|
DebugPanel,
|
|
@@ -19442,6 +19474,7 @@ function LinkXSiweSource({
|
|
|
19442
19474
|
var SILENT_SIGNING_REMOUNT_MS = 220;
|
|
19443
19475
|
function FluentWidget(props) {
|
|
19444
19476
|
setDebugLogging(props.debugLogging ?? false);
|
|
19477
|
+
const appQueryClient = useContext(QueryClientContext);
|
|
19445
19478
|
const resolvedConfig = useMemo(
|
|
19446
19479
|
() => resolveFluentWidgetConfig(props.config),
|
|
19447
19480
|
[props.config]
|
|
@@ -19467,6 +19500,7 @@ function FluentWidget(props) {
|
|
|
19467
19500
|
);
|
|
19468
19501
|
const resolvedNetwork = resolvedConfig.network;
|
|
19469
19502
|
const privyClientId = resolvedConfig.privyClientId;
|
|
19503
|
+
const privyAppId = getFluentPrivyAppId(resolvedNetwork);
|
|
19470
19504
|
const analyticsContext = useRef({});
|
|
19471
19505
|
const externalWallet = useRef({ intent: false, connected: false });
|
|
19472
19506
|
const track = useMemo(
|
|
@@ -19573,8 +19607,8 @@ function FluentWidget(props) {
|
|
|
19573
19607
|
]
|
|
19574
19608
|
);
|
|
19575
19609
|
useLayoutEffect(() => {
|
|
19576
|
-
clearPrivyRecentLoginMethod(
|
|
19577
|
-
}, []);
|
|
19610
|
+
clearPrivyRecentLoginMethod(privyAppId);
|
|
19611
|
+
}, [privyAppId]);
|
|
19578
19612
|
const applySilentSigningEnabled = useCallback((enabled) => {
|
|
19579
19613
|
setSilentSigningEnabled(enabled);
|
|
19580
19614
|
}, []);
|
|
@@ -19603,9 +19637,9 @@ function FluentWidget(props) {
|
|
|
19603
19637
|
[applySilentSigningEnabled]
|
|
19604
19638
|
);
|
|
19605
19639
|
const requestPrivyLogin = useCallback(() => {
|
|
19606
|
-
clearPrivyRecentLoginMethod(
|
|
19640
|
+
clearPrivyRecentLoginMethod(privyAppId);
|
|
19607
19641
|
setInlineLoginRequest((value) => value + 1);
|
|
19608
|
-
}, []);
|
|
19642
|
+
}, [privyAppId]);
|
|
19609
19643
|
useEffect(() => {
|
|
19610
19644
|
return () => {
|
|
19611
19645
|
if (silentSigningRemountTimer.current) {
|
|
@@ -19624,7 +19658,7 @@ function FluentWidget(props) {
|
|
|
19624
19658
|
FluentPrivyProvider,
|
|
19625
19659
|
{
|
|
19626
19660
|
adapter: props.privyAdapter,
|
|
19627
|
-
appId:
|
|
19661
|
+
appId: privyAppId,
|
|
19628
19662
|
clientId: privyClientId,
|
|
19629
19663
|
config: privyConfig,
|
|
19630
19664
|
children: /* @__PURE__ */ jsx(
|
|
@@ -19649,7 +19683,8 @@ function FluentWidget(props) {
|
|
|
19649
19683
|
handledInlineLoginRequest,
|
|
19650
19684
|
authTokenState,
|
|
19651
19685
|
userSettingsRef: userSettings,
|
|
19652
|
-
connectedPresentation
|
|
19686
|
+
connectedPresentation,
|
|
19687
|
+
appQueryClient
|
|
19653
19688
|
}
|
|
19654
19689
|
)
|
|
19655
19690
|
},
|