@unifold/connect-react 0.1.72 → 0.1.74

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/README.md CHANGED
@@ -92,6 +92,7 @@ Wraps your application and provides the Unifold context.
92
92
  - `'light'`: Force light mode
93
93
  - `'dark'`: Force dark mode (default)
94
94
  - `'auto'`: Use system preference and respond to changes
95
+ - `layout` (optional): Deposit menu layout and its options - `{ type, tabOrder }` (`type` defaults to `'tabs'`)
95
96
  - `children` (required): Your React components
96
97
 
97
98
  ```tsx
@@ -107,6 +108,62 @@ Wraps your application and provides the Unifold context.
107
108
  </UnifoldProvider>
108
109
  ```
109
110
 
111
+ #### Menu layout
112
+
113
+ `layout` controls how the deposit menu arranges the funding methods, and carries
114
+ the options belonging to that layout:
115
+
116
+ ```tsx
117
+ <UnifoldProvider
118
+ publishableKey="pk_test_..."
119
+ config={{
120
+ layout: {
121
+ type: 'tabs',
122
+ tabOrder: ['cash', 'crypto'], // opens on "Use Cash"
123
+ },
124
+ }}
125
+ >
126
+ {children}
127
+ </UnifoldProvider>
128
+ ```
129
+
130
+ `type: 'tabs'` (the default) groups the options under "Use Crypto" and "Use
131
+ Cash" tabs, and `tabOrder` controls which tab leads. `'stacked'` puts every
132
+ option in a single list instead:
133
+
134
+ ```tsx
135
+ config={{ layout: { type: 'stacked' } }}
136
+ ```
137
+
138
+ Tabs you list lead, in the order given; any tab you leave out keeps its default
139
+ position behind them, so `['cash']` is equivalent to `['cash', 'crypto']`. The
140
+ leading tab is the one shown on the main menu until the user picks another —
141
+ deep-linking with `initialScreen` still opens that method's own tab. A tab whose
142
+ methods are all disabled stays hidden regardless of order, and the tab bar
143
+ disappears entirely when only one tab has options.
144
+
145
+ `tabOrder` has no effect under `type: 'stacked'`, where the methods are
146
+ interleaved into a single list rather than split across tabs.
147
+
148
+ > **The default changed to `'tabs'`.** It was previously `'stacked'`, so an
149
+ > integration that sets neither `layout` nor `displayMode` will see the tabbed
150
+ > menu after upgrading. Pass `layout: { type: 'stacked' }` to keep the single
151
+ > list.
152
+
153
+ ##### Migrating from `displayMode`
154
+
155
+ `displayMode` is deprecated but still honoured, so existing integrations keep
156
+ working unchanged. It only sets the layout type:
157
+
158
+ ```tsx
159
+ config={{ displayMode: 'stacked' }} // before
160
+ config={{ layout: { type: 'stacked' } }} // after
161
+ ```
162
+
163
+ `layout.type` wins when both are set. A `layout` that omits `type` still falls
164
+ back to `displayMode`, so you can adopt the layout's options without changing
165
+ how the layout is selected.
166
+
110
167
  ### useUnifold()
111
168
 
112
169
  Hook that provides access to the deposit functionality.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
- export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMethod, FontConfig, HeaderTokens, I18nContextValue, I18nProvider, I18nProviderProps, InputTokens, ListTokens, LocaleCode, SUPPORTED_LOCALES, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, detectBrowserLocale, interpolate, normalizeLocale, useI18n, useSupportedDepositTokens } from '@unifold/ui-react';
4
+ import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, DepositMenuLayout, DepositMenuLayoutType, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
+ export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMenuLayout, DepositMenuLayoutType, DepositMethod, DepositTab, FontConfig, HeaderTokens, I18nContextValue, I18nProvider, I18nProviderProps, InputTokens, ListTokens, LocaleCode, SUPPORTED_LOCALES, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, detectBrowserLocale, interpolate, normalizeLocale, useI18n, useSupportedDepositTokens } from '@unifold/ui-react';
6
6
  import { CheckoutMethod, CheckoutPaymentIntent, CheckoutEvent, EvmContractCall, DirectExecutionSucceededEvent, DepositEvent, WithdrawDirectExecutionSucceededEvent, WithdrawEvent } from '@unifold/core';
7
7
  export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CheckoutEvent, CheckoutEventType, CheckoutMethod, CheckoutPaymentIntent, CheckoutPaymentIntentData, CheckoutPaymentIntentSucceededEvent, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, DirectExecution, DirectExecutionResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, StripeAccessTokenResponse, StripeAuthIntentResponse, StripeConfigResponse, StripeConfirmRequest, StripeConsumerWallet, StripeCreateSessionRequest, StripeCryptoCustomer, StripeCustomerVerification, StripeDefaultTokenResponse, StripeListResponse, StripeOnrampSession, StripeOnrampTransactionDetails, StripePaymentToken, StripeQuoteRequest, StripeQuotesResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, WithdrawEventType, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp } from '@unifold/core';
8
8
 
@@ -37,10 +37,25 @@ interface UnifoldConnectProviderConfig {
37
37
  /** Transfer input variant: 'single_input' or 'double_input'. Defaults to 'double_input' */
38
38
  transferInputVariant?: 'single_input' | 'double_input';
39
39
  /**
40
- * Deposit menu layout: 'stacked' (default, stacked list) or 'tabs'
41
- * (options grouped under "Use Crypto" / "Use Cash" tabs).
40
+ * Deposit menu layout, and the options belonging to it:
41
+ *
42
+ * ```ts
43
+ * layout: { type: 'tabs', tabOrder: ['cash', 'crypto'] }
44
+ * ```
45
+ *
46
+ * `layout.type` takes precedence over the superseded `displayMode`. A
47
+ * `layout` that omits `type` still falls back to it, so the layout's
48
+ * options can be adopted without changing how the layout is selected.
42
49
  */
43
- displayMode?: 'stacked' | 'tabs';
50
+ layout?: DepositMenuLayout;
51
+ /**
52
+ * Deposit menu layout: 'tabs' (default, options grouped under "Use Crypto"
53
+ * / "Use Cash" tabs) or 'stacked' (every option in a single list).
54
+ *
55
+ * @deprecated Use `layout` instead, which also carries the layout's own
56
+ * options. `displayMode: 'stacked'` becomes `layout: { type: 'stacked' }`.
57
+ */
58
+ displayMode?: DepositMenuLayoutType;
44
59
  /** Enable "Transfer Crypto" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
45
60
  enableTransferCrypto?: boolean;
46
61
  /** Enable browser wallet connection option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
@@ -179,6 +194,20 @@ interface DepositConfig {
179
194
  * suggested amount.
180
195
  */
181
196
  prefilledAmountUsd?: string;
197
+ /**
198
+ * Fiat on-ramp ("Deposit with Card") options, scoped to that flow so they can
199
+ * be added/removed independently of the rest of the deposit config.
200
+ */
201
+ fiatOnramp?: {
202
+ /**
203
+ * Fixed crypto (destination) amount to buy. When set, the card flow's fiat
204
+ * input is locked (view-only, shown as the USD→local-currency conversion) and
205
+ * the onramp is quoted/charged by this crypto amount with provider fees added
206
+ * on top. Only providers that support a fixed destination amount are shown,
207
+ * and only stablecoin destinations are supported.
208
+ */
209
+ destinationAmount?: string;
210
+ };
182
211
  /** How to confirm deposit: 'auto_ui' (default), 'auto_silent', or 'manual' */
183
212
  depositConfirmationMode?: DepositConfirmationMode;
184
213
  onSuccess?: (data: DepositResult) => void;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
- export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMethod, FontConfig, HeaderTokens, I18nContextValue, I18nProvider, I18nProviderProps, InputTokens, ListTokens, LocaleCode, SUPPORTED_LOCALES, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, detectBrowserLocale, interpolate, normalizeLocale, useI18n, useSupportedDepositTokens } from '@unifold/ui-react';
4
+ import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, DepositMenuLayout, DepositMenuLayoutType, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
+ export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMenuLayout, DepositMenuLayoutType, DepositMethod, DepositTab, FontConfig, HeaderTokens, I18nContextValue, I18nProvider, I18nProviderProps, InputTokens, ListTokens, LocaleCode, SUPPORTED_LOCALES, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, detectBrowserLocale, interpolate, normalizeLocale, useI18n, useSupportedDepositTokens } from '@unifold/ui-react';
6
6
  import { CheckoutMethod, CheckoutPaymentIntent, CheckoutEvent, EvmContractCall, DirectExecutionSucceededEvent, DepositEvent, WithdrawDirectExecutionSucceededEvent, WithdrawEvent } from '@unifold/core';
7
7
  export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CheckoutEvent, CheckoutEventType, CheckoutMethod, CheckoutPaymentIntent, CheckoutPaymentIntentData, CheckoutPaymentIntentSucceededEvent, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, DirectExecution, DirectExecutionResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, StripeAccessTokenResponse, StripeAuthIntentResponse, StripeConfigResponse, StripeConfirmRequest, StripeConsumerWallet, StripeCreateSessionRequest, StripeCryptoCustomer, StripeCustomerVerification, StripeDefaultTokenResponse, StripeListResponse, StripeOnrampSession, StripeOnrampTransactionDetails, StripePaymentToken, StripeQuoteRequest, StripeQuotesResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, WithdrawEventType, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp } from '@unifold/core';
8
8
 
@@ -37,10 +37,25 @@ interface UnifoldConnectProviderConfig {
37
37
  /** Transfer input variant: 'single_input' or 'double_input'. Defaults to 'double_input' */
38
38
  transferInputVariant?: 'single_input' | 'double_input';
39
39
  /**
40
- * Deposit menu layout: 'stacked' (default, stacked list) or 'tabs'
41
- * (options grouped under "Use Crypto" / "Use Cash" tabs).
40
+ * Deposit menu layout, and the options belonging to it:
41
+ *
42
+ * ```ts
43
+ * layout: { type: 'tabs', tabOrder: ['cash', 'crypto'] }
44
+ * ```
45
+ *
46
+ * `layout.type` takes precedence over the superseded `displayMode`. A
47
+ * `layout` that omits `type` still falls back to it, so the layout's
48
+ * options can be adopted without changing how the layout is selected.
42
49
  */
43
- displayMode?: 'stacked' | 'tabs';
50
+ layout?: DepositMenuLayout;
51
+ /**
52
+ * Deposit menu layout: 'tabs' (default, options grouped under "Use Crypto"
53
+ * / "Use Cash" tabs) or 'stacked' (every option in a single list).
54
+ *
55
+ * @deprecated Use `layout` instead, which also carries the layout's own
56
+ * options. `displayMode: 'stacked'` becomes `layout: { type: 'stacked' }`.
57
+ */
58
+ displayMode?: DepositMenuLayoutType;
44
59
  /** Enable "Transfer Crypto" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
45
60
  enableTransferCrypto?: boolean;
46
61
  /** Enable browser wallet connection option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
@@ -179,6 +194,20 @@ interface DepositConfig {
179
194
  * suggested amount.
180
195
  */
181
196
  prefilledAmountUsd?: string;
197
+ /**
198
+ * Fiat on-ramp ("Deposit with Card") options, scoped to that flow so they can
199
+ * be added/removed independently of the rest of the deposit config.
200
+ */
201
+ fiatOnramp?: {
202
+ /**
203
+ * Fixed crypto (destination) amount to buy. When set, the card flow's fiat
204
+ * input is locked (view-only, shown as the USD→local-currency conversion) and
205
+ * the onramp is quoted/charged by this crypto amount with provider fees added
206
+ * on top. Only providers that support a fixed destination amount are shown,
207
+ * and only stablecoin destinations are supported.
208
+ */
209
+ destinationAmount?: string;
210
+ };
182
211
  /** How to confirm deposit: 'auto_ui' (default), 'auto_silent', or 'manual' */
183
212
  depositConfirmationMode?: DepositConfirmationMode;
184
213
  onSuccess?: (data: DepositResult) => void;