@unifold/connect-react 0.1.42 → 0.1.44

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 CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
4
4
  export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, WithdrawTransactionInfo } from '@unifold/ui-react';
5
- export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
5
+ export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
6
6
 
7
7
  interface UnifoldConnectProviderConfig {
8
8
  publishableKey: string;
@@ -94,6 +94,15 @@ interface DepositConfig {
94
94
  */
95
95
  initialScreen?: DepositModalInitialScreen;
96
96
  }
97
+ interface CheckoutResult {
98
+ paymentIntentId: string;
99
+ status: string;
100
+ }
101
+ interface CheckoutError {
102
+ message: string;
103
+ error?: unknown;
104
+ code?: string;
105
+ }
97
106
  interface WithdrawResult {
98
107
  message: string;
99
108
  transaction?: unknown;
@@ -103,6 +112,15 @@ interface WithdrawError {
103
112
  error?: unknown;
104
113
  code?: string;
105
114
  }
115
+ interface CheckoutConfig {
116
+ /** The client_secret from a PaymentIntent created on your server */
117
+ clientSecret: string;
118
+ /** Optional callbacks (fired immediately when events occur) */
119
+ onSuccess?: (data: CheckoutResult) => void;
120
+ onError?: (error: CheckoutError) => void;
121
+ /** Called when the user dismisses the checkout dialog */
122
+ onClose?: () => void;
123
+ }
106
124
  interface WithdrawConfig {
107
125
  /** External user ID — required, same as deposit */
108
126
  externalUserId: string;
@@ -142,6 +160,8 @@ declare function useUnifold(): {
142
160
  publishableKey: string;
143
161
  beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
144
162
  closeDeposit: () => void;
163
+ beginCheckout: (config: CheckoutConfig) => Promise<CheckoutResult>;
164
+ closeCheckout: () => void;
145
165
  beginWithdraw: (config: WithdrawConfig) => Promise<WithdrawResult>;
146
166
  closeWithdraw: () => void;
147
167
  };
@@ -169,4 +189,4 @@ declare function useUnifold(): {
169
189
  */
170
190
  declare function useAllowedCountry(): AllowedCountryResult;
171
191
 
172
- export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };
192
+ export { type CheckoutConfig, type CheckoutError, type CheckoutResult, type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
4
4
  export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, WithdrawTransactionInfo } from '@unifold/ui-react';
5
- export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
5
+ export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
6
6
 
7
7
  interface UnifoldConnectProviderConfig {
8
8
  publishableKey: string;
@@ -94,6 +94,15 @@ interface DepositConfig {
94
94
  */
95
95
  initialScreen?: DepositModalInitialScreen;
96
96
  }
97
+ interface CheckoutResult {
98
+ paymentIntentId: string;
99
+ status: string;
100
+ }
101
+ interface CheckoutError {
102
+ message: string;
103
+ error?: unknown;
104
+ code?: string;
105
+ }
97
106
  interface WithdrawResult {
98
107
  message: string;
99
108
  transaction?: unknown;
@@ -103,6 +112,15 @@ interface WithdrawError {
103
112
  error?: unknown;
104
113
  code?: string;
105
114
  }
115
+ interface CheckoutConfig {
116
+ /** The client_secret from a PaymentIntent created on your server */
117
+ clientSecret: string;
118
+ /** Optional callbacks (fired immediately when events occur) */
119
+ onSuccess?: (data: CheckoutResult) => void;
120
+ onError?: (error: CheckoutError) => void;
121
+ /** Called when the user dismisses the checkout dialog */
122
+ onClose?: () => void;
123
+ }
106
124
  interface WithdrawConfig {
107
125
  /** External user ID — required, same as deposit */
108
126
  externalUserId: string;
@@ -142,6 +160,8 @@ declare function useUnifold(): {
142
160
  publishableKey: string;
143
161
  beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
144
162
  closeDeposit: () => void;
163
+ beginCheckout: (config: CheckoutConfig) => Promise<CheckoutResult>;
164
+ closeCheckout: () => void;
145
165
  beginWithdraw: (config: WithdrawConfig) => Promise<WithdrawResult>;
146
166
  closeWithdraw: () => void;
147
167
  };
@@ -169,4 +189,4 @@ declare function useUnifold(): {
169
189
  */
170
190
  declare function useAllowedCountry(): AllowedCountryResult;
171
191
 
172
- export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };
192
+ export { type CheckoutConfig, type CheckoutError, type CheckoutResult, type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };