diff --git a/package.json b/package.json index a78e5f5ec2..064664b10a 100644 --- a/package.json +++ b/package.json @@ -143,22 +143,22 @@ "default": "./esm/identity/index.js" }, "./nft": { - "types": "./esm/nft/index.d.ts", - "module": "./esm/nft/index.js", - "import": "./esm/nft/index.js", - "default": "./esm/nft/index.js" + "types": "./esm/ui/react/nft/index.d.ts", + "module": "./esm/ui/react/nft/index.js", + "import": "./esm/ui/react/nft/index.js", + "default": "./esm/ui/react/nft/index.js" }, "./nft/view": { - "types": "./esm/nft/components/view/index.d.ts", - "module": "./esm/nft/components/view/index.js", - "import": "./esm/nft/components/view/index.js", - "default": "./esm/nft/components/view/index.js" + "types": "./esm/ui/react/nft/view/index.d.ts", + "module": "./esm/ui/react/nft/view/index.js", + "import": "./esm/ui/react/nft/view/index.js", + "default": "./esm/ui/react/nft/view/index.js" }, "./nft/mint": { - "types": "./esm/nft/components/mint/index.d.ts", - "module": "./esm/nft/components/mint/index.js", - "import": "./esm/nft/components/mint/index.js", - "default": "./esm/nft/components/mint/index.js" + "types": "./esm/ui/react/nft/mint/index.d.ts", + "module": "./esm/ui/react/nft/mint/index.js", + "import": "./esm/ui/react/nft/mint/index.js", + "default": "./esm/ui/react/nft/mint/index.js" }, "./swap": { "types": "./esm/swap/index.d.ts", diff --git a/playground/nextjs-app-router/onchainkit/package.json b/playground/nextjs-app-router/onchainkit/package.json index 6ea8b9d2ef..064664b10a 100644 --- a/playground/nextjs-app-router/onchainkit/package.json +++ b/playground/nextjs-app-router/onchainkit/package.json @@ -1,6 +1,6 @@ { "name": "@coinbase/onchainkit", - "version": "0.35.8", + "version": "0.36.0", "type": "module", "repository": "https://github.com/coinbase/onchainkit.git", "license": "MIT", @@ -143,22 +143,22 @@ "default": "./esm/identity/index.js" }, "./nft": { - "types": "./esm/nft/index.d.ts", - "module": "./esm/nft/index.js", - "import": "./esm/nft/index.js", - "default": "./esm/nft/index.js" + "types": "./esm/ui/react/nft/index.d.ts", + "module": "./esm/ui/react/nft/index.js", + "import": "./esm/ui/react/nft/index.js", + "default": "./esm/ui/react/nft/index.js" }, "./nft/view": { - "types": "./esm/nft/components/view/index.d.ts", - "module": "./esm/nft/components/view/index.js", - "import": "./esm/nft/components/view/index.js", - "default": "./esm/nft/components/view/index.js" + "types": "./esm/ui/react/nft/view/index.d.ts", + "module": "./esm/ui/react/nft/view/index.js", + "import": "./esm/ui/react/nft/view/index.js", + "default": "./esm/ui/react/nft/view/index.js" }, "./nft/mint": { - "types": "./esm/nft/components/mint/index.d.ts", - "module": "./esm/nft/components/mint/index.js", - "import": "./esm/nft/components/mint/index.js", - "default": "./esm/nft/components/mint/index.js" + "types": "./esm/ui/react/nft/mint/index.d.ts", + "module": "./esm/ui/react/nft/mint/index.js", + "import": "./esm/ui/react/nft/mint/index.js", + "default": "./esm/ui/react/nft/mint/index.js" }, "./swap": { "types": "./esm/swap/index.d.ts", diff --git a/src/nft/hooks/useLifecycleStatus.test.ts b/src/core-react/nft/hooks/useLifecycleStatus.test.ts similarity index 100% rename from src/nft/hooks/useLifecycleStatus.test.ts rename to src/core-react/nft/hooks/useLifecycleStatus.test.ts diff --git a/src/nft/hooks/useLifecycleStatus.ts b/src/core-react/nft/hooks/useLifecycleStatus.ts similarity index 100% rename from src/nft/hooks/useLifecycleStatus.ts rename to src/core-react/nft/hooks/useLifecycleStatus.ts diff --git a/src/nft/hooks/useMintData.test.ts b/src/core-react/nft/hooks/useMintData.test.ts similarity index 95% rename from src/nft/hooks/useMintData.test.ts rename to src/core-react/nft/hooks/useMintData.test.ts index b2cf08b47e..3f38bfa6c1 100644 --- a/src/nft/hooks/useMintData.test.ts +++ b/src/core-react/nft/hooks/useMintData.test.ts @@ -9,11 +9,11 @@ import { vi, } from 'vitest'; import { useAccount } from 'wagmi'; -import { useNFTLifecycleContext } from '../components/NFTLifecycleProvider'; +import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import { useMintData } from './useMintData'; import { useMintDetails } from './useMintDetails'; -vi.mock('../components/NFTLifecycleProvider'); +vi.mock('../providers/NFTLifecycleProvider'); vi.mock('./useMintDetails'); vi.mock('wagmi'); diff --git a/src/nft/hooks/useMintData.ts b/src/core-react/nft/hooks/useMintData.ts similarity index 87% rename from src/nft/hooks/useMintData.ts rename to src/core-react/nft/hooks/useMintData.ts index 9e6a89b6c2..444faad37c 100644 --- a/src/nft/hooks/useMintData.ts +++ b/src/core-react/nft/hooks/useMintData.ts @@ -1,8 +1,9 @@ +import type { NFTError } from '@/core/api/types'; +import { convertIpfsToHttps } from '@/core/nft/utils/ipfs'; import { useEffect, useState } from 'react'; import { useAccount } from 'wagmi'; -import { useNFTLifecycleContext } from '../components/NFTLifecycleProvider'; -import type { NFTData, NFTError } from '../types'; -import { convertIpfsToHttps } from '../utils/ipfs'; +import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; +import type { NFTData } from '../types'; import { useMintDetails } from './useMintDetails'; export function useMintData( diff --git a/src/nft/hooks/useMintDetails.test.ts b/src/core-react/nft/hooks/useMintDetails.test.ts similarity index 91% rename from src/nft/hooks/useMintDetails.test.ts rename to src/core-react/nft/hooks/useMintDetails.test.ts index 1497a6f228..6df34015dc 100644 --- a/src/nft/hooks/useMintDetails.test.ts +++ b/src/core-react/nft/hooks/useMintDetails.test.ts @@ -1,10 +1,10 @@ +import { getMintDetails } from '@/core/api/getMintDetails'; import { renderHook, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { getMintDetails } from '../../core/api/getMintDetails'; -import { getNewReactQueryTestProvider } from '../../identity/hooks/getNewReactQueryTestProvider'; +import { getNewReactQueryTestProvider } from '../../../identity/hooks/getNewReactQueryTestProvider'; import { useMintDetails } from './useMintDetails'; -vi.mock('../../core/api/getMintDetails'); +vi.mock('@/core/api/getMintDetails'); describe('useMintDetails', () => { beforeEach(() => { diff --git a/src/nft/hooks/useMintDetails.ts b/src/core-react/nft/hooks/useMintDetails.ts similarity index 77% rename from src/nft/hooks/useMintDetails.ts rename to src/core-react/nft/hooks/useMintDetails.ts index 9bbc48f594..d7a33ca1ff 100644 --- a/src/nft/hooks/useMintDetails.ts +++ b/src/core-react/nft/hooks/useMintDetails.ts @@ -1,7 +1,7 @@ +import { getMintDetails } from '@/core/api/getMintDetails'; +import type { GetMintDetailsParams, MintDetails } from '@/core/api/types'; +import { isNFTError } from '@/core/nft/utils/isNFTError'; import { type UseQueryResult, useQuery } from '@tanstack/react-query'; -import { getMintDetails } from '../../core/api/getMintDetails'; -import type { GetMintDetailsParams, MintDetails } from '../../core/api/types'; -import { isNFTError } from '../utils/isNFTError'; export function useMintDetails({ contractAddress, diff --git a/src/nft/hooks/useNFTData.test.ts b/src/core-react/nft/hooks/useNFTData.test.ts similarity index 94% rename from src/nft/hooks/useNFTData.test.ts rename to src/core-react/nft/hooks/useNFTData.test.ts index e7330cec3b..aa3598c681 100644 --- a/src/nft/hooks/useNFTData.test.ts +++ b/src/core-react/nft/hooks/useNFTData.test.ts @@ -8,12 +8,12 @@ import { it, vi, } from 'vitest'; -import { useNFTLifecycleContext } from '../components/NFTLifecycleProvider'; +import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import { useNFTData } from './useNFTData'; import { useTokenDetails } from './useTokenDetails'; vi.mock('./useTokenDetails'); -vi.mock('../components/NFTLifecycleProvider'); +vi.mock('../providers/NFTLifecycleProvider'); describe('useNFTData', () => { const mockUpdateLifecycleStatus = vi.fn(); diff --git a/src/nft/hooks/useNFTData.ts b/src/core-react/nft/hooks/useNFTData.ts similarity index 83% rename from src/nft/hooks/useNFTData.ts rename to src/core-react/nft/hooks/useNFTData.ts index 27af8cc6ae..4e52a51456 100644 --- a/src/nft/hooks/useNFTData.ts +++ b/src/core-react/nft/hooks/useNFTData.ts @@ -1,7 +1,8 @@ +import type { ContractType, NFTError } from '@/core/api/types'; +import { convertIpfsToHttps } from '@/core/nft/utils/ipfs'; import { useEffect, useState } from 'react'; -import { useNFTLifecycleContext } from '../components/NFTLifecycleProvider'; -import type { ContractType, NFTData, NFTError } from '../types'; -import { convertIpfsToHttps } from '../utils/ipfs'; +import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; +import type { NFTData } from '../types'; import { useTokenDetails } from './useTokenDetails'; export function useNFTData( diff --git a/src/nft/hooks/useTokenDetails.test.ts b/src/core-react/nft/hooks/useTokenDetails.test.ts similarity index 91% rename from src/nft/hooks/useTokenDetails.test.ts rename to src/core-react/nft/hooks/useTokenDetails.test.ts index d5c93d8204..b9e2905d1b 100644 --- a/src/nft/hooks/useTokenDetails.test.ts +++ b/src/core-react/nft/hooks/useTokenDetails.test.ts @@ -1,10 +1,10 @@ +import { getTokenDetails } from '@/core/api/getTokenDetails'; import { renderHook, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { getTokenDetails } from '../../core/api/getTokenDetails'; -import { getNewReactQueryTestProvider } from '../../identity/hooks/getNewReactQueryTestProvider'; +import { getNewReactQueryTestProvider } from '../../../identity/hooks/getNewReactQueryTestProvider'; import { useTokenDetails } from './useTokenDetails'; -vi.mock('../../core/api/getTokenDetails'); +vi.mock('@/core/api/getTokenDetails'); describe('useTokenDetails', () => { beforeEach(() => { diff --git a/src/nft/hooks/useTokenDetails.ts b/src/core-react/nft/hooks/useTokenDetails.ts similarity index 76% rename from src/nft/hooks/useTokenDetails.ts rename to src/core-react/nft/hooks/useTokenDetails.ts index 383ad10c8c..433ff81a2c 100644 --- a/src/nft/hooks/useTokenDetails.ts +++ b/src/core-react/nft/hooks/useTokenDetails.ts @@ -1,7 +1,7 @@ +import { getTokenDetails } from '@/core/api/getTokenDetails'; +import type { GetTokenDetailsParams, TokenDetails } from '@/core/api/types'; +import { isNFTError } from '@/core/nft/utils/isNFTError'; import { type UseQueryResult, useQuery } from '@tanstack/react-query'; -import { getTokenDetails } from '../../core/api/getTokenDetails'; -import type { GetTokenDetailsParams, TokenDetails } from '../../core/api/types'; -import { isNFTError } from '../utils/isNFTError'; export function useTokenDetails({ contractAddress, diff --git a/src/nft/components/NFTLifecycleProvider.test.tsx b/src/core-react/nft/providers/NFTLifecycleProvider.test.tsx similarity index 97% rename from src/nft/components/NFTLifecycleProvider.test.tsx rename to src/core-react/nft/providers/NFTLifecycleProvider.test.tsx index cf386e9ada..4df0b2a911 100644 --- a/src/nft/components/NFTLifecycleProvider.test.tsx +++ b/src/core-react/nft/providers/NFTLifecycleProvider.test.tsx @@ -1,13 +1,9 @@ import '@testing-library/jest-dom'; +import type { NFTError } from '@/core/api/types'; import { fireEvent, render } from '@testing-library/react'; import type { TransactionReceipt } from 'viem'; import { describe, expect, it, vi } from 'vitest'; -import { - type LifecycleStatus, - LifecycleType, - MediaType, - type NFTError, -} from '../types'; +import { type LifecycleStatus, LifecycleType, MediaType } from '../types'; import { NFTLifecycleProvider, useNFTLifecycleContext, diff --git a/src/nft/components/NFTLifecycleProvider.tsx b/src/core-react/nft/providers/NFTLifecycleProvider.tsx similarity index 96% rename from src/nft/components/NFTLifecycleProvider.tsx rename to src/core-react/nft/providers/NFTLifecycleProvider.tsx index e6f3793990..b02a57bb54 100644 --- a/src/nft/components/NFTLifecycleProvider.tsx +++ b/src/core-react/nft/providers/NFTLifecycleProvider.tsx @@ -1,5 +1,5 @@ import { createContext, useContext, useEffect } from 'react'; -import { useValue } from '../../core-react/internal/hooks/useValue'; +import { useValue } from '../../internal/hooks/useValue'; import { useLifecycleStatus } from '../hooks/useLifecycleStatus'; import type { NFTLifecycleContextType, diff --git a/src/nft/components/NFTProvider.test.tsx b/src/core-react/nft/providers/NFTProvider.test.tsx similarity index 100% rename from src/nft/components/NFTProvider.test.tsx rename to src/core-react/nft/providers/NFTProvider.test.tsx diff --git a/src/nft/components/NFTProvider.tsx b/src/core-react/nft/providers/NFTProvider.tsx similarity index 94% rename from src/nft/components/NFTProvider.tsx rename to src/core-react/nft/providers/NFTProvider.tsx index c09465a4aa..eda877f14b 100644 --- a/src/nft/components/NFTProvider.tsx +++ b/src/core-react/nft/providers/NFTProvider.tsx @@ -1,5 +1,5 @@ import { createContext, useCallback, useContext, useState } from 'react'; -import { useValue } from '../../core-react/internal/hooks/useValue'; +import { useValue } from '../../internal/hooks/useValue'; import type { NFTContextType, NFTProviderReact } from '../types'; const emptyContext = {} as NFTContextType; diff --git a/src/nft/types.ts b/src/core-react/nft/types.ts similarity index 92% rename from src/nft/types.ts rename to src/core-react/nft/types.ts index 3d7ae6b06b..5b94dcf6a8 100644 --- a/src/nft/types.ts +++ b/src/core-react/nft/types.ts @@ -1,8 +1,7 @@ +import type { ContractType, NFTError, NFTPrice } from '@/core/api/types'; import type { ReactNode } from 'react'; import type { Address, Hex, TransactionReceipt } from 'viem'; -import type { Call, TransactionError } from '../transaction/types'; - -export type ContractType = 'ERC721' | 'ERC1155'; +import type { Call } from '../../transaction/types'; export enum MediaType { Image = 'image', @@ -52,12 +51,6 @@ export type NFTProviderReact = { buildMintTransaction?: BuildMintTransaction; }; -export type NFTPrice = { - amount?: string; // Amount in Currency - currency?: string; // Currency - amountUSD?: string; // Amount in USD -}; - /** * Note: exported as public Type */ @@ -160,18 +153,6 @@ export type NFTMintCardReact = { */ export type NFTMintCardDefaultReact = Omit; -/** -/** - * Note: exported as public Type - */ -export type NFTError = - | { - code: string; // The error code representing the type of nft error. - error: string; // The error message providing details about the nft error. - message: string; // The error message providing details about the nft error. - } - | TransactionError; - export type LifecycleStatus = | { statusName: 'init'; diff --git a/src/core/api/types.ts b/src/core/api/types.ts index 59277133dc..281fc3bc7b 100644 --- a/src/core/api/types.ts +++ b/src/core/api/types.ts @@ -1,5 +1,4 @@ import type { Address } from 'viem'; -import type { ContractType, NFTPrice } from '../../nft/types'; import type { Fee, QuoteWarning, @@ -19,6 +18,17 @@ export type APIError = { message: string; // The Error short message }; +/** + * Note: exported as public Type + */ +export type TransactionError = APIError; + +/** +/** + * Note: exported as public Type + */ +export type NFTError = APIError | TransactionError; + /** * Note: exported as public Type */ @@ -150,6 +160,14 @@ export type RawTransactionData = { export type SwapAPIParams = GetQuoteAPIParams | GetSwapAPIParams; +export type ContractType = 'ERC721' | 'ERC1155'; + +export type NFTPrice = { + amount?: string; // Amount in Currency + currency?: string; // Currency + amountUSD?: string; // Amount in USD +}; + /** * Note: exported as public Type */ diff --git a/src/nft/utils/buildMintTransactionData.test.ts b/src/core/nft/utils/buildMintTransactionData.test.ts similarity index 94% rename from src/nft/utils/buildMintTransactionData.test.ts rename to src/core/nft/utils/buildMintTransactionData.test.ts index 0917712945..662220f841 100644 --- a/src/nft/utils/buildMintTransactionData.test.ts +++ b/src/core/nft/utils/buildMintTransactionData.test.ts @@ -1,9 +1,9 @@ import type { Address } from 'viem'; import { type Mock, describe, expect, it, vi } from 'vitest'; -import { buildMintTransaction as buildMintTransationApi } from '../../core/api/buildMintTransaction'; +import { buildMintTransaction as buildMintTransationApi } from '../../api/buildMintTransaction'; import { buildMintTransactionData } from './buildMintTransactionData'; -vi.mock('../../core/api/buildMintTransaction'); +vi.mock('../../api/buildMintTransaction'); describe('buildMintTransactionData', () => { const mockBuildMintTransaction = buildMintTransationApi as Mock; diff --git a/src/nft/utils/buildMintTransactionData.ts b/src/core/nft/utils/buildMintTransactionData.ts similarity index 85% rename from src/nft/utils/buildMintTransactionData.ts rename to src/core/nft/utils/buildMintTransactionData.ts index 20409d42a0..8006fe4a3b 100644 --- a/src/nft/utils/buildMintTransactionData.ts +++ b/src/core/nft/utils/buildMintTransactionData.ts @@ -1,7 +1,7 @@ import type { Address } from 'viem'; -import { buildMintTransaction as buildMintTransactionApi } from '../../core/api/buildMintTransaction'; -import type { BuildMintTransactionParams } from '../../core/api/types'; -import type { Call } from '../../transaction/types'; +import type { Call } from '../../../transaction/types'; +import { buildMintTransaction as buildMintTransactionApi } from '../../api/buildMintTransaction'; +import type { BuildMintTransactionParams } from '../../api/types'; async function getMintTransaction({ mintAddress, diff --git a/src/nft/utils/ipfs.test.ts b/src/core/nft/utils/ipfs.test.ts similarity index 100% rename from src/nft/utils/ipfs.test.ts rename to src/core/nft/utils/ipfs.test.ts diff --git a/src/nft/utils/ipfs.ts b/src/core/nft/utils/ipfs.ts similarity index 100% rename from src/nft/utils/ipfs.ts rename to src/core/nft/utils/ipfs.ts diff --git a/src/nft/utils/isNFTError.test.ts b/src/core/nft/utils/isNFTError.test.ts similarity index 100% rename from src/nft/utils/isNFTError.test.ts rename to src/core/nft/utils/isNFTError.test.ts diff --git a/src/nft/utils/isNFTError.ts b/src/core/nft/utils/isNFTError.ts similarity index 76% rename from src/nft/utils/isNFTError.ts rename to src/core/nft/utils/isNFTError.ts index 1d1353365a..3291fc18ce 100644 --- a/src/nft/utils/isNFTError.ts +++ b/src/core/nft/utils/isNFTError.ts @@ -1,4 +1,4 @@ -import type { NFTError } from '../types'; +import type { NFTError } from '@/core/api/types'; export function isNFTError(response: unknown): response is NFTError { return ( diff --git a/src/nft/index.ts b/src/nft/index.ts deleted file mode 100644 index 4a66cecc08..0000000000 --- a/src/nft/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export { NFTMintCard } from './components/NFTMintCard'; -export { NFTMintCardDefault } from './components/NFTMintCardDefault'; -export { NFTCard } from './components/NFTCard'; -export { NFTCardDefault } from './components/NFTCardDefault'; - -export type { - BuildMintTransaction, - LifecycleStatus, - NFTCardReact, - NFTCardDefaultReact, - NFTData, - NFTError, - NFTMintCardReact, - NFTMintCardDefaultReact, - UseNFTData, -} from './types'; diff --git a/src/transaction/index.ts b/src/transaction/index.ts index b337f30764..0040aa62f1 100644 --- a/src/transaction/index.ts +++ b/src/transaction/index.ts @@ -13,7 +13,6 @@ export { TransactionToastLabel } from './components/TransactionToastLabel'; export type { LifecycleStatus, TransactionButtonReact, - TransactionError, TransactionReact, TransactionResponse, TransactionSponsorReact, @@ -26,3 +25,4 @@ export type { TransactionToastLabelReact, WalletCapabilities, } from './types'; +export type { TransactionError } from '@/core/api/types'; diff --git a/src/transaction/types.ts b/src/transaction/types.ts index 2539a01846..460700a733 100644 --- a/src/transaction/types.ts +++ b/src/transaction/types.ts @@ -1,4 +1,5 @@ // 🌲☀🌲 +import type { TransactionError } from '@/core/api/types'; import type { ReactNode } from 'react'; import type { Address, @@ -120,15 +121,6 @@ export type TransactionDefaultReact = { disabled?: boolean; } & Omit; -/** - * Note: exported as public Type - */ -export type TransactionError = { - code: string; // The error code representing the type of transaction error. - error: string; // The error message providing details about the transaction error. - message: string; // The error message providing details about the transaction error. -}; - export type Calls = Call[] | Promise | (() => Promise); export type Contracts = | ContractFunctionParameters[] diff --git a/src/nft/components/NFTCard.test.tsx b/src/ui/react/nft/NFTCard.test.tsx similarity index 90% rename from src/nft/components/NFTCard.test.tsx rename to src/ui/react/nft/NFTCard.test.tsx index 43be352348..dc94a8b36c 100644 --- a/src/nft/components/NFTCard.test.tsx +++ b/src/ui/react/nft/NFTCard.test.tsx @@ -1,4 +1,6 @@ import '@testing-library/jest-dom'; +import { useIsMounted } from '@/core-react/internal/hooks/useIsMounted'; +import { NFTProvider } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, @@ -10,18 +12,16 @@ import { vi, } from 'vitest'; import { useAccount } from 'wagmi'; -import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; import { NFTCard } from './NFTCard'; -import { NFTProvider } from './NFTProvider'; vi.mock('wagmi', () => ({ useAccount: vi.fn(), })); -vi.mock('../../core-react/internal/hooks/useTheme', () => ({ +vi.mock('@/core-react/internal/hooks/useTheme', () => ({ useTheme: vi.fn(() => 'default-light'), })); -vi.mock('../../core-react/internal/hooks/useIsMounted'); -vi.mock('./NFTProvider', () => ({ +vi.mock('@/core-react/internal/hooks/useIsMounted'); +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ NFTProvider: vi.fn(({ children }) =>
{children}
), })); diff --git a/src/nft/components/NFTCard.tsx b/src/ui/react/nft/NFTCard.tsx similarity index 77% rename from src/nft/components/NFTCard.tsx rename to src/ui/react/nft/NFTCard.tsx index bdd4498c78..e7063fecf7 100644 --- a/src/nft/components/NFTCard.tsx +++ b/src/ui/react/nft/NFTCard.tsx @@ -1,14 +1,14 @@ +import { useIsMounted } from '@/core-react/internal/hooks/useIsMounted'; +import { useTheme } from '@/core-react/internal/hooks/useTheme'; +import { useNFTData as defaultUseNFTData } from '@/core-react/nft/hooks/useNFTData'; +import { NFTLifecycleProvider } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { NFTProvider } from '@/core-react/nft/providers/NFTProvider'; +import { LifecycleType, type NFTCardReact } from '@/core-react/nft/types'; import { useCallback } from 'react'; import { useAccount } from 'wagmi'; -import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; -import { useTheme } from '../../core-react/internal/hooks/useTheme'; -import { border, cn, color, pressable } from '../../styles/theme'; -import { useNFTData as defaultUseNFTData } from '../hooks/useNFTData'; -import { LifecycleType, type NFTCardReact } from '../types'; +import { border, cn, color, pressable } from '../../../styles/theme'; import NFTErrorBoundary from './NFTErrorBoundary'; import { NFTErrorFallback } from './NFTErrorFallback'; -import { NFTLifecycleProvider } from './NFTLifecycleProvider'; -import { NFTProvider } from './NFTProvider'; export function NFTCard({ children, diff --git a/src/nft/components/NFTCardDefault.test.tsx b/src/ui/react/nft/NFTCardDefault.test.tsx similarity index 100% rename from src/nft/components/NFTCardDefault.test.tsx rename to src/ui/react/nft/NFTCardDefault.test.tsx diff --git a/src/nft/components/NFTCardDefault.tsx b/src/ui/react/nft/NFTCardDefault.tsx similarity index 89% rename from src/nft/components/NFTCardDefault.tsx rename to src/ui/react/nft/NFTCardDefault.tsx index c224d9c502..ab993382e6 100644 --- a/src/nft/components/NFTCardDefault.tsx +++ b/src/ui/react/nft/NFTCardDefault.tsx @@ -1,4 +1,4 @@ -import type { NFTCardDefaultReact } from '../types'; +import type { NFTCardDefaultReact } from '@/core-react/nft/types'; import { NFTCard } from './NFTCard'; import { NFTLastSoldPrice, diff --git a/src/nft/components/NFTErrorBoundary.test.tsx b/src/ui/react/nft/NFTErrorBoundary.test.tsx similarity index 100% rename from src/nft/components/NFTErrorBoundary.test.tsx rename to src/ui/react/nft/NFTErrorBoundary.test.tsx diff --git a/src/nft/components/NFTErrorBoundary.tsx b/src/ui/react/nft/NFTErrorBoundary.tsx similarity index 100% rename from src/nft/components/NFTErrorBoundary.tsx rename to src/ui/react/nft/NFTErrorBoundary.tsx diff --git a/src/nft/components/NFTErrorFallback.test.tsx b/src/ui/react/nft/NFTErrorFallback.test.tsx similarity index 84% rename from src/nft/components/NFTErrorFallback.test.tsx rename to src/ui/react/nft/NFTErrorFallback.test.tsx index 14efd9dcab..ea7fba8622 100644 --- a/src/nft/components/NFTErrorFallback.test.tsx +++ b/src/ui/react/nft/NFTErrorFallback.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; +import { useTheme } from '@/core-react/internal/hooks/useTheme'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useTheme } from '../../core-react/internal/hooks/useTheme'; import { NFTErrorFallback } from './NFTErrorFallback'; -vi.mock('../../core-react/internal/hooks/useTheme'); +vi.mock('@/core-react/internal/hooks/useTheme'); describe('NFTErrorFallback', () => { beforeEach(() => { diff --git a/src/nft/components/NFTErrorFallback.tsx b/src/ui/react/nft/NFTErrorFallback.tsx similarity index 79% rename from src/nft/components/NFTErrorFallback.tsx rename to src/ui/react/nft/NFTErrorFallback.tsx index 818391857a..5b1f546981 100644 --- a/src/nft/components/NFTErrorFallback.tsx +++ b/src/ui/react/nft/NFTErrorFallback.tsx @@ -1,5 +1,5 @@ -import { useTheme } from '../../core-react/internal/hooks/useTheme'; -import { background, border, cn, color } from '../../styles/theme'; +import { useTheme } from '@/core-react/internal/hooks/useTheme'; +import { background, border, cn, color } from '../../../styles/theme'; export function NFTErrorFallback({ error }: { error: Error }) { const componentTheme = useTheme(); diff --git a/src/nft/components/NFTMintCard.test.tsx b/src/ui/react/nft/NFTMintCard.test.tsx similarity index 84% rename from src/nft/components/NFTMintCard.test.tsx rename to src/ui/react/nft/NFTMintCard.test.tsx index acb2799e40..c8d50343fa 100644 --- a/src/nft/components/NFTMintCard.test.tsx +++ b/src/ui/react/nft/NFTMintCard.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useIsMounted } from '@/core-react/internal/hooks/useIsMounted'; import { render } from '@testing-library/react'; import { type Mock, @@ -9,14 +10,13 @@ import { it, vi, } from 'vitest'; -import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; import { NFTMintCard } from './NFTMintCard'; -vi.mock('../../core-react/internal/hooks/useTheme', () => ({ +vi.mock('@/core-react/internal/hooks/useTheme', () => ({ useTheme: vi.fn(() => 'default-light'), })); -vi.mock('../../core-react/internal/hooks/useIsMounted'); -vi.mock('./NFTProvider', () => ({ +vi.mock('@/core-react/internal/hooks/useIsMounted'); +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ NFTProvider: vi.fn(({ children }) =>
{children}
), })); diff --git a/src/nft/components/NFTMintCard.tsx b/src/ui/react/nft/NFTMintCard.tsx similarity index 72% rename from src/nft/components/NFTMintCard.tsx rename to src/ui/react/nft/NFTMintCard.tsx index 71cf7982b6..244162c161 100644 --- a/src/nft/components/NFTMintCard.tsx +++ b/src/ui/react/nft/NFTMintCard.tsx @@ -1,13 +1,13 @@ -import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; -import { useTheme } from '../../core-react/internal/hooks/useTheme'; -import { background, border, cn, color } from '../../styles/theme'; -import { useMintData as defaultUseMintData } from '../hooks/useMintData'; -import { LifecycleType, type NFTMintCardReact } from '../types'; -import { buildMintTransactionData as defaultBuildMintTransaction } from '../utils/buildMintTransactionData'; +import { useIsMounted } from '@/core-react/internal/hooks/useIsMounted'; +import { useTheme } from '@/core-react/internal/hooks/useTheme'; +import { useMintData as defaultUseMintData } from '@/core-react/nft/hooks/useMintData'; +import { NFTLifecycleProvider } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { NFTProvider } from '@/core-react/nft/providers/NFTProvider'; +import { LifecycleType, type NFTMintCardReact } from '@/core-react/nft/types'; +import { buildMintTransactionData as defaultBuildMintTransaction } from '@/core/nft/utils/buildMintTransactionData'; +import { background, border, cn, color } from '../../../styles/theme'; import NFTErrorBoundary from './NFTErrorBoundary'; import { NFTErrorFallback } from './NFTErrorFallback'; -import { NFTLifecycleProvider } from './NFTLifecycleProvider'; -import { NFTProvider } from './NFTProvider'; export function NFTMintCard({ children, diff --git a/src/nft/components/NFTMintCardDefault.test.tsx b/src/ui/react/nft/NFTMintCardDefault.test.tsx similarity index 100% rename from src/nft/components/NFTMintCardDefault.test.tsx rename to src/ui/react/nft/NFTMintCardDefault.test.tsx diff --git a/src/nft/components/NFTMintCardDefault.tsx b/src/ui/react/nft/NFTMintCardDefault.tsx similarity index 92% rename from src/nft/components/NFTMintCardDefault.tsx rename to src/ui/react/nft/NFTMintCardDefault.tsx index fd8ad35199..1e743850cd 100644 --- a/src/nft/components/NFTMintCardDefault.tsx +++ b/src/ui/react/nft/NFTMintCardDefault.tsx @@ -1,4 +1,4 @@ -import type { NFTMintCardDefaultReact } from '../types'; +import type { NFTMintCardDefaultReact } from '@/core-react/nft/types'; import { NFTMintCard } from './NFTMintCard'; import { NFTAssetCost, diff --git a/src/ui/react/nft/index.ts b/src/ui/react/nft/index.ts new file mode 100644 index 0000000000..25876d7cbf --- /dev/null +++ b/src/ui/react/nft/index.ts @@ -0,0 +1,16 @@ +export { NFTMintCard } from './NFTMintCard'; +export { NFTMintCardDefault } from './NFTMintCardDefault'; +export { NFTCard } from './NFTCard'; +export { NFTCardDefault } from './NFTCardDefault'; + +export type { + BuildMintTransaction, + LifecycleStatus, + NFTCardReact, + NFTCardDefaultReact, + NFTData, + NFTMintCardReact, + NFTMintCardDefaultReact, + UseNFTData, +} from '@/core-react/nft/types'; +export type { NFTError } from '@/core/api/types'; diff --git a/src/nft/components/mint/NFTAssetCost.test.tsx b/src/ui/react/nft/mint/NFTAssetCost.test.tsx similarity index 94% rename from src/nft/components/mint/NFTAssetCost.test.tsx rename to src/ui/react/nft/mint/NFTAssetCost.test.tsx index 244fdf9e2c..d5ba9132ba 100644 --- a/src/nft/components/mint/NFTAssetCost.test.tsx +++ b/src/ui/react/nft/mint/NFTAssetCost.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, @@ -9,10 +10,9 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTAssetCost } from './NFTAssetCost'; -vi.mock('../NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTProvider'); describe('NFTAssetCost', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/nft/components/mint/NFTAssetCost.tsx b/src/ui/react/nft/mint/NFTAssetCost.tsx similarity index 72% rename from src/nft/components/mint/NFTAssetCost.tsx rename to src/ui/react/nft/mint/NFTAssetCost.tsx index 561b0c0ac7..d315432b9d 100644 --- a/src/nft/components/mint/NFTAssetCost.tsx +++ b/src/ui/react/nft/mint/NFTAssetCost.tsx @@ -1,8 +1,8 @@ -import { multiplyFloats } from '../../../core/utils/multiplyFloats'; -import { cn, text } from '../../../styles/theme'; -import { formatAmount as formatSN } from '../../../swap/utils/formatAmount'; -import { formatAmount } from '../../../token/utils/formatAmount'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { multiplyFloats } from '@/core/utils/multiplyFloats'; +import { cn, text } from '../../../../styles/theme'; +import { formatAmount as formatSN } from '../../../../swap/utils/formatAmount'; +import { formatAmount } from '../../../../token/utils/formatAmount'; type NFTAssetCostReact = { className?: string; diff --git a/src/nft/components/mint/NFTCollectionTitle.test.tsx b/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx similarity index 89% rename from src/nft/components/mint/NFTCollectionTitle.test.tsx rename to src/ui/react/nft/mint/NFTCollectionTitle.test.tsx index b46718713d..8acc5d0822 100644 --- a/src/nft/components/mint/NFTCollectionTitle.test.tsx +++ b/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTCollectionTitle } from './NFTCollectionTitle'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/mint/NFTCollectionTitle.tsx b/src/ui/react/nft/mint/NFTCollectionTitle.tsx similarity index 73% rename from src/nft/components/mint/NFTCollectionTitle.tsx rename to src/ui/react/nft/mint/NFTCollectionTitle.tsx index cee6387c6a..fb09aea31d 100644 --- a/src/nft/components/mint/NFTCollectionTitle.tsx +++ b/src/ui/react/nft/mint/NFTCollectionTitle.tsx @@ -1,5 +1,5 @@ -import { cn, text } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { cn, text } from '../../../../styles/theme'; type NFTCollectionTitleReact = { className?: string; diff --git a/src/nft/components/mint/NFTCreator.test.tsx b/src/ui/react/nft/mint/NFTCreator.test.tsx similarity index 78% rename from src/nft/components/mint/NFTCreator.test.tsx rename to src/ui/react/nft/mint/NFTCreator.test.tsx index cc326a2043..9ad7de175f 100644 --- a/src/nft/components/mint/NFTCreator.test.tsx +++ b/src/ui/react/nft/mint/NFTCreator.test.tsx @@ -1,19 +1,19 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { useNFTContext } from '../NFTProvider'; import { NFTCreator } from './NFTCreator'; -vi.mock('../../../core-react/useOnchainKit', () => ({ +vi.mock('@/core-react/useOnchainKit', () => ({ useOnchainKit: vi.fn(), })); -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); -vi.mock('../../../identity', async () => ({ - ...(await vi.importActual('../../../identity')), +vi.mock('../../../../identity', async () => ({ + ...(await vi.importActual('../../../../identity')), Identity: ({ className }: { className: string }) => (
Identity
), diff --git a/src/nft/components/mint/NFTCreator.tsx b/src/ui/react/nft/mint/NFTCreator.tsx similarity index 70% rename from src/nft/components/mint/NFTCreator.tsx rename to src/ui/react/nft/mint/NFTCreator.tsx index bd8c2c78c3..077f72ddf4 100644 --- a/src/nft/components/mint/NFTCreator.tsx +++ b/src/ui/react/nft/mint/NFTCreator.tsx @@ -1,7 +1,7 @@ -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { Avatar, Badge, Identity, Name } from '../../../identity'; -import { cn } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; +import { Avatar, Badge, Identity, Name } from '../../../../identity'; +import { cn } from '../../../../styles/theme'; type NFTCreatorReact = { className?: string; diff --git a/src/nft/components/mint/NFTMintButton.test.tsx b/src/ui/react/nft/mint/NFTMintButton.test.tsx similarity index 94% rename from src/nft/components/mint/NFTMintButton.test.tsx rename to src/ui/react/nft/mint/NFTMintButton.test.tsx index 548f02793e..1ece57b03e 100644 --- a/src/nft/components/mint/NFTMintButton.test.tsx +++ b/src/ui/react/nft/mint/NFTMintButton.test.tsx @@ -1,5 +1,8 @@ import { render } from '@testing-library/react'; import '@testing-library/jest-dom'; +import { useNFTLifecycleContext } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { base } from 'viem/chains'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -11,14 +14,11 @@ import { useChainId, } from 'wagmi'; import { mock } from 'wagmi/connectors'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; import { NFTMintButton } from './NFTMintButton'; -vi.mock('../NFTProvider'); -vi.mock('../NFTLifecycleProvider'); -vi.mock('../../../core-react/useOnchainKit'); +vi.mock('@/core-react/nft/providers/NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTLifecycleProvider'); +vi.mock('@/core-react/useOnchainKit'); vi.mock('wagmi', async (importOriginal) => { return { ...(await importOriginal()), @@ -29,9 +29,9 @@ vi.mock('wagmi', async (importOriginal) => { vi.mock('../../../internal/components/Spinner', () => ({ Spinner: () =>
Spinner
, })); -vi.mock('../../../transaction', async (importOriginal) => { +vi.mock('../../../../transaction', async (importOriginal) => { return { - ...(await importOriginal()), + ...(await importOriginal()), TransactionLifecycleStatus: vi.fn(), TransactionButton: ({ text, @@ -89,7 +89,7 @@ vi.mock('../../../transaction', async (importOriginal) => { TransactionStatusLabel: vi.fn(), }; }); -vi.mock('../../../wallet', () => ({ +vi.mock('../../../../wallet', () => ({ ConnectWallet: () =>
ConnectWallet
, })); diff --git a/src/nft/components/mint/NFTMintButton.tsx b/src/ui/react/nft/mint/NFTMintButton.tsx similarity index 90% rename from src/nft/components/mint/NFTMintButton.tsx rename to src/ui/react/nft/mint/NFTMintButton.tsx index 5858ee0041..a79e173fe5 100644 --- a/src/nft/components/mint/NFTMintButton.tsx +++ b/src/ui/react/nft/mint/NFTMintButton.tsx @@ -1,7 +1,9 @@ +import { useNFTLifecycleContext } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useAccount, useChainId } from 'wagmi'; -import { Spinner } from '../../../internal/components/Spinner'; -import { cn, color, text } from '../../../styles/theme'; +import { Spinner } from '../../../../internal/components/Spinner'; +import { cn, color, text } from '../../../../styles/theme'; import { Transaction, TransactionButton, @@ -11,11 +13,9 @@ import { TransactionStatus, TransactionStatusAction, TransactionStatusLabel, -} from '../../../transaction'; -import type { Call } from '../../../transaction/types'; -import { ConnectWallet } from '../../../wallet'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; +} from '../../../../transaction'; +import type { Call } from '../../../../transaction/types'; +import { ConnectWallet } from '../../../../wallet'; type NFTMintButtonReact = { className?: string; diff --git a/src/nft/components/mint/NFTMinters.test.tsx b/src/ui/react/nft/mint/NFTMinters.test.tsx similarity index 89% rename from src/nft/components/mint/NFTMinters.test.tsx rename to src/ui/react/nft/mint/NFTMinters.test.tsx index aed94df106..61a7e5003d 100644 --- a/src/nft/components/mint/NFTMinters.test.tsx +++ b/src/ui/react/nft/mint/NFTMinters.test.tsx @@ -1,13 +1,13 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTMinters } from './NFTMinters'; -vi.mock('../NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTProvider'); -vi.mock('../../../identity', async () => ({ - ...(await vi.importActual('../../../identity')), +vi.mock('../../../../identity', async () => ({ + ...(await vi.importActual('../../../../identity')), Identity: ({ className, children, diff --git a/src/nft/components/mint/NFTMinters.tsx b/src/ui/react/nft/mint/NFTMinters.tsx similarity index 82% rename from src/nft/components/mint/NFTMinters.tsx rename to src/ui/react/nft/mint/NFTMinters.tsx index 45a0008b9a..cdafa15270 100644 --- a/src/nft/components/mint/NFTMinters.tsx +++ b/src/ui/react/nft/mint/NFTMinters.tsx @@ -1,7 +1,7 @@ -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { Avatar, Identity, Name } from '../../../identity'; -import { cn, color, text } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; +import { Avatar, Identity, Name } from '../../../../identity'; +import { cn, color, text } from '../../../../styles/theme'; type NFTMintersReact = { className?: string; diff --git a/src/nft/components/mint/NFTQuantitySelector.test.tsx b/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx similarity index 93% rename from src/nft/components/mint/NFTQuantitySelector.test.tsx rename to src/ui/react/nft/mint/NFTQuantitySelector.test.tsx index 1af731c9e9..366ecb8988 100644 --- a/src/nft/components/mint/NFTQuantitySelector.test.tsx +++ b/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { fireEvent, render } from '@testing-library/react'; import { act } from 'react'; import { @@ -10,12 +11,11 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTQuantitySelector } from './NFTQuantitySelector'; -vi.mock('../NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTProvider'); -vi.mock('../../../internal/components/QuantitySelector', () => ({ +vi.mock('../../../../internal/components/QuantitySelector', () => ({ QuantitySelector: ({ onChange, minQuantity, diff --git a/src/nft/components/mint/NFTQuantitySelector.tsx b/src/ui/react/nft/mint/NFTQuantitySelector.tsx similarity index 73% rename from src/nft/components/mint/NFTQuantitySelector.tsx rename to src/ui/react/nft/mint/NFTQuantitySelector.tsx index 43eb81c04a..77e2289fed 100644 --- a/src/nft/components/mint/NFTQuantitySelector.tsx +++ b/src/ui/react/nft/mint/NFTQuantitySelector.tsx @@ -1,6 +1,6 @@ -import { QuantitySelector } from '../../../internal/components/QuantitySelector'; -import { cn } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { QuantitySelector } from '../../../../internal/components/QuantitySelector'; +import { cn } from '../../../../styles/theme'; type NFTQuantitySelectorReact = { className?: string; diff --git a/src/nft/components/mint/NFTTotalCost.test.tsx b/src/ui/react/nft/mint/NFTTotalCost.test.tsx similarity index 97% rename from src/nft/components/mint/NFTTotalCost.test.tsx rename to src/ui/react/nft/mint/NFTTotalCost.test.tsx index 4dce22d588..6e4ca67dc4 100644 --- a/src/nft/components/mint/NFTTotalCost.test.tsx +++ b/src/ui/react/nft/mint/NFTTotalCost.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { fireEvent, render } from '@testing-library/react'; import { type Mock, @@ -9,10 +10,9 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTTotalCost } from './NFTTotalCost'; -vi.mock('../NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTProvider'); describe('NFTTotalCost', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/nft/components/mint/NFTTotalCost.tsx b/src/ui/react/nft/mint/NFTTotalCost.tsx similarity index 90% rename from src/nft/components/mint/NFTTotalCost.tsx rename to src/ui/react/nft/mint/NFTTotalCost.tsx index 45f9191ba1..90ea493617 100644 --- a/src/nft/components/mint/NFTTotalCost.tsx +++ b/src/ui/react/nft/mint/NFTTotalCost.tsx @@ -1,9 +1,9 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { multiplyFloats } from '@/core/utils/multiplyFloats'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; -import { multiplyFloats } from '../../../core/utils/multiplyFloats'; -import { infoSvg } from '../../../internal/svg/infoSvg'; -import { background, border, cn, text } from '../../../styles/theme'; -import { formatAmount } from '../../../token/utils/formatAmount'; -import { useNFTContext } from '../NFTProvider'; +import { infoSvg } from '../../../../internal/svg/infoSvg'; +import { background, border, cn, text } from '../../../../styles/theme'; +import { formatAmount } from '../../../../token/utils/formatAmount'; type NFTTotalCostReact = { className?: string; diff --git a/src/nft/components/mint/index.ts b/src/ui/react/nft/mint/index.ts similarity index 100% rename from src/nft/components/mint/index.ts rename to src/ui/react/nft/mint/index.ts diff --git a/src/nft/components/view/NFTAudio.test.tsx b/src/ui/react/nft/view/NFTAudio.test.tsx similarity index 95% rename from src/nft/components/view/NFTAudio.test.tsx rename to src/ui/react/nft/view/NFTAudio.test.tsx index af462360cf..860e601c65 100644 --- a/src/nft/components/view/NFTAudio.test.tsx +++ b/src/ui/react/nft/view/NFTAudio.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { fireEvent, render } from '@testing-library/react'; import { type Mock, @@ -9,12 +10,11 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTAudio } from './NFTAudio'; const mockAnimationUrl = 'https://example.com/audio.mp3'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTAudio.tsx b/src/ui/react/nft/view/NFTAudio.tsx similarity index 93% rename from src/nft/components/view/NFTAudio.tsx rename to src/ui/react/nft/view/NFTAudio.tsx index 970928bc6b..2f583492ae 100644 --- a/src/nft/components/view/NFTAudio.tsx +++ b/src/ui/react/nft/view/NFTAudio.tsx @@ -1,3 +1,5 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import type { NFTError } from '@/core/api/types'; import { type MouseEvent, useCallback, @@ -5,9 +7,7 @@ import { useRef, useState, } from 'react'; -import { background, cn } from '../../../styles/theme'; -import type { NFTError } from '../../types'; -import { useNFTContext } from '../NFTProvider'; +import { background, cn } from '../../../../styles/theme'; type NFTAudioReact = { className?: string; diff --git a/src/nft/components/view/NFTImage.test.tsx b/src/ui/react/nft/view/NFTImage.test.tsx similarity index 96% rename from src/nft/components/view/NFTImage.test.tsx rename to src/ui/react/nft/view/NFTImage.test.tsx index 206f0c8df7..47ec65c82a 100644 --- a/src/nft/components/view/NFTImage.test.tsx +++ b/src/ui/react/nft/view/NFTImage.test.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { fireEvent, render, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTImage } from './NFTImage'; const mockContext = { @@ -9,7 +9,7 @@ const mockContext = { description: 'Test NFT Image', }; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTImage.tsx b/src/ui/react/nft/view/NFTImage.tsx similarity index 90% rename from src/nft/components/view/NFTImage.tsx rename to src/ui/react/nft/view/NFTImage.tsx index 00404b925f..7fc7757b9f 100644 --- a/src/nft/components/view/NFTImage.tsx +++ b/src/ui/react/nft/view/NFTImage.tsx @@ -1,8 +1,8 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import type { NFTError } from '@/core/api/types'; import { type MouseEvent, useCallback, useEffect, useState } from 'react'; -import { defaultNFTSvg } from '../../../internal/svg/defaultNFTSvg'; -import { cn } from '../../../styles/theme'; -import type { NFTError } from '../../types'; -import { useNFTContext } from '../NFTProvider'; +import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg'; +import { cn } from '../../../../styles/theme'; type NFTImageReact = { className?: string; diff --git a/src/nft/components/view/NFTLastSoldPrice.test.tsx b/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx similarity index 94% rename from src/nft/components/view/NFTLastSoldPrice.test.tsx rename to src/ui/react/nft/view/NFTLastSoldPrice.test.tsx index 10ced254f7..872997f9de 100644 --- a/src/nft/components/view/NFTLastSoldPrice.test.tsx +++ b/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, @@ -9,10 +10,9 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTLastSoldPrice } from './NFTLastSoldPrice'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTLastSoldPrice.tsx b/src/ui/react/nft/view/NFTLastSoldPrice.tsx similarity index 77% rename from src/nft/components/view/NFTLastSoldPrice.tsx rename to src/ui/react/nft/view/NFTLastSoldPrice.tsx index 3a1bfcbaaf..7175bea0f1 100644 --- a/src/nft/components/view/NFTLastSoldPrice.tsx +++ b/src/ui/react/nft/view/NFTLastSoldPrice.tsx @@ -1,8 +1,8 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import type { ReactNode } from 'react'; -import { cn, color, text } from '../../../styles/theme'; -import { formatAmount as formatSN } from '../../../swap/utils/formatAmount'; -import { formatAmount } from '../../../token/utils/formatAmount'; -import { useNFTContext } from '../NFTProvider'; +import { cn, color, text } from '../../../../styles/theme'; +import { formatAmount as formatSN } from '../../../../swap/utils/formatAmount'; +import { formatAmount } from '../../../../token/utils/formatAmount'; type NFTLastSoldPriceReact = { className?: string; diff --git a/src/nft/components/view/NFTMedia.test.tsx b/src/ui/react/nft/view/NFTMedia.test.tsx similarity index 91% rename from src/nft/components/view/NFTMedia.test.tsx rename to src/ui/react/nft/view/NFTMedia.test.tsx index 2356acd94b..21d70a8621 100644 --- a/src/nft/components/view/NFTMedia.test.tsx +++ b/src/ui/react/nft/view/NFTMedia.test.tsx @@ -1,15 +1,15 @@ import '@testing-library/jest-dom'; +import { useNFTLifecycleContext } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { LifecycleType } from '@/core-react/nft/types'; import { fireEvent, render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { LifecycleType } from '../../types'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; import { NFTMedia } from './NFTMedia'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); -vi.mock('../NFTLifecycleProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTLifecycleProvider', () => ({ useNFTLifecycleContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTMedia.tsx b/src/ui/react/nft/view/NFTMedia.tsx similarity index 88% rename from src/nft/components/view/NFTMedia.tsx rename to src/ui/react/nft/view/NFTMedia.tsx index 2b78e776fb..e289f0257a 100644 --- a/src/nft/components/view/NFTMedia.tsx +++ b/src/ui/react/nft/view/NFTMedia.tsx @@ -1,8 +1,9 @@ +import { useNFTLifecycleContext } from '@/core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { LifecycleType, MediaType } from '@/core-react/nft/types'; +import type { NFTError } from '@/core/api/types'; import { useCallback, useMemo } from 'react'; -import { cn } from '../../../styles/theme'; -import { LifecycleType, MediaType, type NFTError } from '../../types'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; +import { cn } from '../../../../styles/theme'; import { NFTAudio } from './NFTAudio'; import { NFTImage } from './NFTImage'; import { NFTVideo } from './NFTVideo'; diff --git a/src/nft/components/view/NFTMintDate.test.tsx b/src/ui/react/nft/view/NFTMintDate.test.tsx similarity index 91% rename from src/nft/components/view/NFTMintDate.test.tsx rename to src/ui/react/nft/view/NFTMintDate.test.tsx index 08f6f1ac93..73b84347e3 100644 --- a/src/nft/components/view/NFTMintDate.test.tsx +++ b/src/ui/react/nft/view/NFTMintDate.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTMintDate } from './NFTMintDate'; -vi.mock('../NFTProvider'); +vi.mock('@/core-react/nft/providers/NFTProvider'); describe('NFTMintDate', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/nft/components/view/NFTMintDate.tsx b/src/ui/react/nft/view/NFTMintDate.tsx similarity index 86% rename from src/nft/components/view/NFTMintDate.tsx rename to src/ui/react/nft/view/NFTMintDate.tsx index 24cb359822..aa23c0e7fa 100644 --- a/src/nft/components/view/NFTMintDate.tsx +++ b/src/ui/react/nft/view/NFTMintDate.tsx @@ -1,6 +1,6 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { type ReactNode, useMemo } from 'react'; -import { cn, color, text } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { cn, color, text } from '../../../../styles/theme'; const DATE_OPTIONS = { year: 'numeric', diff --git a/src/nft/components/view/NFTNetwork.test.tsx b/src/ui/react/nft/view/NFTNetwork.test.tsx similarity index 100% rename from src/nft/components/view/NFTNetwork.test.tsx rename to src/ui/react/nft/view/NFTNetwork.test.tsx diff --git a/src/nft/components/view/NFTNetwork.tsx b/src/ui/react/nft/view/NFTNetwork.tsx similarity index 88% rename from src/nft/components/view/NFTNetwork.tsx rename to src/ui/react/nft/view/NFTNetwork.tsx index 94afe0f649..ae26c2328d 100644 --- a/src/nft/components/view/NFTNetwork.tsx +++ b/src/ui/react/nft/view/NFTNetwork.tsx @@ -1,8 +1,8 @@ import type { ReactNode } from 'react'; import { type Chain, base } from 'viem/chains'; import { useChainId } from 'wagmi'; -import { baseSvg } from '../../../internal/svg/baseSvg'; -import { cn, color, text } from '../../../styles/theme'; +import { baseSvg } from '../../../../internal/svg/baseSvg'; +import { cn, color, text } from '../../../../styles/theme'; type NFTNetworkReact = { className?: string; diff --git a/src/nft/components/view/NFTOwner.test.tsx b/src/ui/react/nft/view/NFTOwner.test.tsx similarity index 82% rename from src/nft/components/view/NFTOwner.test.tsx rename to src/ui/react/nft/view/NFTOwner.test.tsx index b1490274e0..db46572c54 100644 --- a/src/nft/components/view/NFTOwner.test.tsx +++ b/src/ui/react/nft/view/NFTOwner.test.tsx @@ -1,4 +1,6 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; import { render } from '@testing-library/react'; import { type Mock, @@ -9,14 +11,12 @@ import { it, vi, } from 'vitest'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { useNFTContext } from '../NFTProvider'; import { NFTOwner } from './NFTOwner'; -vi.mock('../../../core-react/useOnchainKit'); -vi.mock('../NFTProvider'); -vi.mock('../../../identity', async () => ({ - ...(await vi.importActual('../../../identity')), +vi.mock('@/core-react/useOnchainKit'); +vi.mock('@/core-react/nft/providers/NFTProvider'); +vi.mock('../../../../identity', async () => ({ + ...(await vi.importActual('../../../../identity')), Identity: ({ className, address, diff --git a/src/nft/components/view/NFTOwner.tsx b/src/ui/react/nft/view/NFTOwner.tsx similarity index 75% rename from src/nft/components/view/NFTOwner.tsx rename to src/ui/react/nft/view/NFTOwner.tsx index 5b9ef6040d..621ec1a812 100644 --- a/src/nft/components/view/NFTOwner.tsx +++ b/src/ui/react/nft/view/NFTOwner.tsx @@ -1,8 +1,8 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '@/core-react/useOnchainKit'; import type { ReactNode } from 'react'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { Avatar, Badge, Identity, Name } from '../../../identity'; -import { cn, color, text } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { Avatar, Badge, Identity, Name } from '../../../../identity'; +import { cn, color, text } from '../../../../styles/theme'; type NFTOwnerReact = { className?: string; diff --git a/src/nft/components/view/NFTTitle.test.tsx b/src/ui/react/nft/view/NFTTitle.test.tsx similarity index 88% rename from src/nft/components/view/NFTTitle.test.tsx rename to src/ui/react/nft/view/NFTTitle.test.tsx index 5911aa59f2..d8b7e1c4e2 100644 --- a/src/nft/components/view/NFTTitle.test.tsx +++ b/src/ui/react/nft/view/NFTTitle.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { render } from '@testing-library/react'; import { type Mock, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTTitle } from './NFTTitle'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTTitle.tsx b/src/ui/react/nft/view/NFTTitle.tsx similarity index 71% rename from src/nft/components/view/NFTTitle.tsx rename to src/ui/react/nft/view/NFTTitle.tsx index 47b947c4a4..9b5be80211 100644 --- a/src/nft/components/view/NFTTitle.tsx +++ b/src/ui/react/nft/view/NFTTitle.tsx @@ -1,5 +1,5 @@ -import { cn, text } from '../../../styles/theme'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import { cn, text } from '../../../../styles/theme'; type NFTTitleReact = { className?: string; diff --git a/src/nft/components/view/NFTVideo.test.tsx b/src/ui/react/nft/view/NFTVideo.test.tsx similarity index 94% rename from src/nft/components/view/NFTVideo.test.tsx rename to src/ui/react/nft/view/NFTVideo.test.tsx index bcdcaa3758..7a359a1fb3 100644 --- a/src/nft/components/view/NFTVideo.test.tsx +++ b/src/ui/react/nft/view/NFTVideo.test.tsx @@ -1,4 +1,5 @@ import '@testing-library/jest-dom'; +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; import { fireEvent, render } from '@testing-library/react'; import { type Mock, @@ -9,10 +10,9 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; import { NFTVideo } from './NFTVideo'; -vi.mock('../NFTProvider', () => ({ +vi.mock('@/core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/nft/components/view/NFTVideo.tsx b/src/ui/react/nft/view/NFTVideo.tsx similarity index 87% rename from src/nft/components/view/NFTVideo.tsx rename to src/ui/react/nft/view/NFTVideo.tsx index e14d475147..0cab84e9ad 100644 --- a/src/nft/components/view/NFTVideo.tsx +++ b/src/ui/react/nft/view/NFTVideo.tsx @@ -1,8 +1,8 @@ +import { useNFTContext } from '@/core-react/nft/providers/NFTProvider'; +import type { NFTError } from '@/core/api/types'; import { useEffect, useRef } from 'react'; -import { defaultNFTSvg } from '../../../internal/svg/defaultNFTSvg'; -import { cn } from '../../../styles/theme'; -import type { NFTError } from '../../types'; -import { useNFTContext } from '../NFTProvider'; +import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg'; +import { cn } from '../../../../styles/theme'; type NFTVideoReact = { className?: string; diff --git a/src/nft/components/view/index.ts b/src/ui/react/nft/view/index.ts similarity index 100% rename from src/nft/components/view/index.ts rename to src/ui/react/nft/view/index.ts