@spicenet-io/spiceflow-ui 1.15.0 → 1.15.1
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/auth-privy.cjs.js +2 -2
- package/dist/components/SpiceDeposit/DepositRecoveryPrompt.d.ts +15 -0
- package/dist/components/SpiceDeposit/SpiceDeposit.d.ts +8 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/usePendingDeposit.d.ts +17 -0
- package/dist/hooks/useSpicePendingDeposits.d.ts +11 -0
- package/dist/index.cjs.js +20 -20
- package/dist/index.d.ts +3 -3
- package/dist/index.js +20 -20
- package/dist/types/lock.d.ts +1 -6
- package/dist/utils/pendingDeposit.d.ts +16 -0
- package/package.json +1 -1
package/dist/auth-privy.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-Cn16gFtO.js"),x=require("@privy-io/react-auth"),B=({onAuthSuccess:u,onAuthError:a,theme:
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-Cn16gFtO.js"),x=require("@privy-io/react-auth"),B=({onAuthSuccess:u,onAuthError:a,theme:p="light",className:l="",buttonText:f="Login with Privy",autoTrigger:h=!1})=>{const d=c.createTheme(p),[m,j]=o.useState(!1),[g,v]=o.useState(!1),{ready:i,authenticated:n,user:r}=x.usePrivy(),{login:b}=x.useLogin(),{logout:L}=x.useLogout();o.useEffect(()=>{j(!0)},[]),o.useEffect(()=>{h&&i&&!n&&m&&!g&&(v(!0),y())},[h,i,n,m,g]),o.useEffect(()=>{if(i&&n&&r&&u){const t=r.wallet?.address||r.email?.address;t&&u(t)}},[i,n,r,u]),o.useEffect(()=>{},[i,n,a]);const y=()=>{try{b()}catch(t){const s=`Login failed: ${String(t)}`;a?a(s):console.error(s)}},S=()=>{try{L()}catch(t){const s=`Logout failed: ${String(t)}`;a?a(s):console.error(s)}};if(!m)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:d,children:f})});if(!i)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:d,children:"Loading..."})});if(n&&r){const t=r.wallet?.address||r.email?.address,s=t?`${t.slice(0,6)}...${t.slice(-4)}`:"Connected";return e.jsx("div",{className:l,children:e.jsxs(c.Button,{variant:"primary",onClick:S,theme:d,children:["Logout (",s,")"]})})}return h?e.jsxs("div",{className:l,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx("div",{style:{width:"40px",height:"40px",border:"3px solid #e5e7eb",borderTop:"3px solid #3b82f6",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("p",{style:{color:"#6b7280",fontSize:"14px"},children:"Opening login..."})]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
3
3
|
@keyframes spin {
|
|
4
4
|
0% { transform: rotate(0deg); }
|
|
5
5
|
100% { transform: rotate(360deg); }
|
|
6
6
|
}
|
|
7
|
-
`}})]}):e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",onClick:
|
|
7
|
+
`}})]}):e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",onClick:y,theme:d,children:f})})};exports.PrivyLogin=B;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CustomStyles } from "../../types/theme";
|
|
3
|
+
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
4
|
+
export interface DepositRecoveryPromptProps {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
deposits: VerifiedPendingDeposit[];
|
|
8
|
+
onComplete: (deposit: VerifiedPendingDeposit) => void;
|
|
9
|
+
onCancel: (deposit: VerifiedPendingDeposit) => void;
|
|
10
|
+
onSkip: () => void;
|
|
11
|
+
isProcessing: boolean;
|
|
12
|
+
error?: string | null;
|
|
13
|
+
styles?: CustomStyles;
|
|
14
|
+
}
|
|
15
|
+
export declare const DepositRecoveryPrompt: React.FC<DepositRecoveryPromptProps>;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CustomStyles } from "../../types/theme";
|
|
3
3
|
import { ChainBatch } from "../../types/authorization";
|
|
4
|
+
export interface EscrowRecovery {
|
|
5
|
+
chainId: number;
|
|
6
|
+
tokenAddress: string;
|
|
7
|
+
tokenSymbol: string;
|
|
8
|
+
tokenDecimals: number;
|
|
9
|
+
amount: string;
|
|
10
|
+
}
|
|
4
11
|
export interface SpiceDepositProps {
|
|
5
12
|
isOpen: boolean;
|
|
6
13
|
onClose: () => void;
|
|
@@ -17,6 +24,7 @@ export interface SpiceDepositProps {
|
|
|
17
24
|
postDepositInstructionLabel?: string;
|
|
18
25
|
airdrop?: boolean;
|
|
19
26
|
sponsorGas?: boolean;
|
|
27
|
+
escrowRecovery?: EscrowRecovery;
|
|
20
28
|
escrowOnly?: boolean;
|
|
21
29
|
escrowChainId?: number;
|
|
22
30
|
escrowTokenAddress?: string;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -19,3 +19,6 @@ export { useGaslessExecution } from "./useGaslessExecution";
|
|
|
19
19
|
export type { GaslessProgress, GaslessStep, OnProgress, } from "./useGaslessExecution";
|
|
20
20
|
export { useLockDuration } from "./useLockDuration";
|
|
21
21
|
export type { UseLockDurationReturn } from "./useLockDuration";
|
|
22
|
+
export type { VerifiedPendingDeposit } from "./usePendingDeposit";
|
|
23
|
+
export { useSpicePendingDeposits } from "./useSpicePendingDeposits";
|
|
24
|
+
export type { UseSpicePendingDepositsOptions, UseSpicePendingDepositsReturn, } from "./useSpicePendingDeposits";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
import { PendingDepositRecord } from "../utils/pendingDeposit";
|
|
3
|
+
export interface VerifiedPendingDeposit extends PendingDepositRecord {
|
|
4
|
+
verifiedBalance: bigint;
|
|
5
|
+
hasFullBalance: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface UsePendingDepositOptions {
|
|
8
|
+
network?: "mainnet" | "devnet";
|
|
9
|
+
pollIntervalMs?: number;
|
|
10
|
+
chainIds?: number[];
|
|
11
|
+
}
|
|
12
|
+
export interface UsePendingDepositReturn {
|
|
13
|
+
pendingDeposits: VerifiedPendingDeposit[];
|
|
14
|
+
loading: boolean;
|
|
15
|
+
refresh: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function usePendingDeposit(embeddedWalletAddress: Address | undefined, options?: UsePendingDepositOptions): UsePendingDepositReturn;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
import { UsePendingDepositReturn } from "./usePendingDeposit";
|
|
3
|
+
export interface UseSpicePendingDepositsOptions {
|
|
4
|
+
pollIntervalMs?: number;
|
|
5
|
+
chainIds?: number[];
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseSpicePendingDepositsReturn extends UsePendingDepositReturn {
|
|
9
|
+
embeddedWalletAddress: Address | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function useSpicePendingDeposits(options?: UseSpicePendingDepositsOptions): UseSpicePendingDepositsReturn;
|