@unifold/connect-react-native 0.1.51 → 0.1.52

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
@@ -36,7 +36,7 @@ Link Pay uses `@stripe/stripe-react-native`, which includes **native** code (App
36
36
 
37
37
  Importing `@unifold/connect-react-native` loads the Stripe UI registration in the same JS bundle as the provider. Ensure the peer dependencies in **Installation** above are installed so Metro does not duplicate native modules.
38
38
 
39
- **`expo-constants`** is a **dependency** of `@unifold/connect-react-native`. The prebuilt bundle uses a **static** `import` from `expo-constants` (in the Stripe helper that reads the Expo plugin) so Metro always links the module. (A runtime `require("expo-constants")` in that path was still emitted inside the bundle and could trigger “unknown module” in Metro.) You can still set **`config.stripeMerchantIdentifier`** on `UnifoldProvider` to override or skip reading the plugin from constants.
39
+ The Apple Pay **`merchantIdentifier`** in `app.json` is still required for the **native entitlement** at build time. The value used at runtime for `initStripe`, however, comes **only** from the Unifold dashboard (via the Stripe config endpoint) the SDK no longer reads it from a prop or `app.json`, so make sure the dashboard value matches the id compiled into your build.
40
40
 
41
41
  #### Expo Go vs development build vs prebuild
42
42
 
@@ -50,7 +50,7 @@ Importing `@unifold/connect-react-native` loads the Stripe UI registration in th
50
50
  1. **Peer dependencies** — Install everything in **Installation** (or `expo install …`). Missing peers often show up as duplicate native modules or Metro resolution errors.
51
51
  2. **`react-native-gesture-handler`** — In bare React Native, import it at the **entry file** first (see [React Navigation](https://reactnavigation.org/docs/getting-started/#installing-dependencies-into-a-bare-react-native-project)); Expo Router projects usually already satisfy this.
52
52
  3. **`UnifoldProvider` placement** — Wrap near the root so `beginDeposit` and theme context are available app-wide. Call `setDevApiUrl` **before** the provider if you use staging in development (see example app).
53
- 4. **Stripe Link Pay** — Requires a **development / EAS build** on Expo (not Expo Go), the Stripe **config plugin** in `app.json`, and `config.enableStripeLinkPay: true`. Apple Pay needs a matching `merchantIdentifier` (plugin and/or `config.stripeMerchantIdentifier`; Expo apps can rely on plugin + `expo-constants` auto-read in `StripeOnramp`).
53
+ 4. **Stripe Link Pay** — Requires a **development / EAS build** on Expo (not Expo Go), the Stripe **config plugin** in `app.json`, and `config.enableStripeLink: true`. Apple Pay's `merchantIdentifier` must be set in the `app.json` plugin (native entitlement); the runtime value is sourced from the Unifold dashboard (Stripe config endpoint), so keep the two in sync.
54
54
  5. **Theme** — `UnifoldProvider` applies `ThemeProvider` to **all** children. If you use another theme system, nest it inside or outside deliberately so `useTheme` resolves as you expect.
55
55
 
56
56
  ## Quick Start
@@ -192,8 +192,9 @@ await beginDeposit({
192
192
  | `config.fonts` | `FontConfig` | No | Granular font weight configuration |
193
193
  | `config.components` | `ComponentConfig` | No | Component-specific token overrides |
194
194
  | `config.sheetBorderRadius` | `SheetBorderRadius` | No | Border radius configuration for all bottom sheets (see below) |
195
- | `config.enableStripeLinkPay` | `boolean` | No | Show Pay with Link (Stripe) in the deposit menu (default: omit / falsy hides it). Stripe is bundled with Connect. |
196
- | `config.stripeMerchantIdentifier` | `string` | No | Apple Pay merchant id for Link Pay. Must match the Stripe Expo plugin in app.json. On Expo, omit if the id is only in the plugin (read from `expo-constants`). |
195
+ | `config.enableStripeLink` | `boolean` | No | Show Pay with Link (Stripe) in the deposit menu (default: omit / falsy hides it). Stripe is bundled with Connect. |
196
+
197
+ > **Apple Pay merchant id:** there is no longer an SDK config for this. The runtime value comes solely from the Unifold dashboard (Stripe config endpoint). Keep it in sync with the `merchantIdentifier` in your `app.json` Stripe plugin, which is still required for the native entitlement.
197
198
 
198
199
  ### SheetBorderRadius
199
200
 
@@ -251,8 +252,7 @@ const { beginDeposit, closeDeposit, publishableKey } = useUnifold();
251
252
  | `destinationTokenAddress` | `string` | No | Target token contract address |
252
253
  | `destinationTokenSymbol` | `string` | No | Target token symbol (e.g., `'USDC'`) |
253
254
  | `recipientAddress` | `string` | No | Wallet address to receive funds |
254
- | `stripeOnrampEmail` | `string` | No | Pre-fills Stripe Link Pay email when user opens Pay with Stripe Link from the deposit menu |
255
- | `stripeOnrampPhone` | `string` | No | Pre-fills Stripe Link Pay phone (use with `stripeOnrampEmail` per Stripe’s flow) |
255
+ | `user` | `{ email?: string; phone?: string }` | No | Host-app-supplied user identity. Pre-fills supported flows — currently Stripe Link Pay uses `user.email` / `user.phone` (with both set, Stripe may skip verify steps). |
256
256
  | `defaultChainType` | `'ethereum' \| 'solana' \| 'bitcoin'` | No | Pre-select source network type |
257
257
  | `defaultChainId` | `string` | No | Pre-select source chain ID |
258
258
  | `defaultTokenAddress` | `string` | No | Pre-select source token address |
@@ -308,7 +308,6 @@ import type {
308
308
  | react-native-gesture-handler | >= 2.14.0 |
309
309
  | react-native-svg | >= 13.0.0 |
310
310
  | react-native-webview | >= 13.0.0 |
311
- | expo-constants | Installed with Connect (>= 14) — mirrors `merchantIdentifier` from the Stripe Expo plugin into JS; optional override via `config.stripeMerchantIdentifier` |
312
311
 
313
312
  ## Support
314
313
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1, { ReactNode } from 'react';
2
- export { AmountScreen, CreateSessionParams, CustomerVerification, KYCData, KYCWizardScreen, OnrampConfig, OnrampCustomer, OnrampError, OnrampErrorCode, OnrampScreen, OnrampSession, OnrampSessionTransactionDetails, OnrampStep, OnrampTransaction, StripeOnramp, StripeOnrampHook, StripeOnrampPreconfigure, StripeOnrampProps, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp } from '@unifold/ui-react-native/stripe';
2
+ export { AmountScreen, CreateSessionParams, CustomerVerification, KYCData, KYCWizardScreen, OnrampConfig, OnrampCustomer, OnrampError, OnrampErrorCode, OnrampScreen, OnrampSession, OnrampSessionTransactionDetails, OnrampStep, OnrampTransaction, StripeOnramp, StripeOnrampConfig, StripeOnrampHook, StripeOnrampPreconfigure, StripeOnrampProps, getStripeConfig, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp } from '@unifold/ui-react-native/stripe';
3
3
 
4
4
  /**
5
5
  * Unifold color palette for React Native
@@ -406,6 +406,18 @@ type TransferInputVariant = "single_input" | "double_input" | "compact";
406
406
  type DepositMenuDisplay = "stacked" | "tabs";
407
407
  /** Controls which screen opens first when the deposit modal is shown */
408
408
  type DepositInitialScreen = "main" | "transfer" | "card" | "tracker" | "cashapp" | "wallet";
409
+ /**
410
+ * Host-app-supplied user identity used to pre-fill supported flows.
411
+ * Currently consumed by Stripe Link Pay (email/phone pre-fill). Kept as an
412
+ * extensible object so more fields can be added later without new top-level
413
+ * props.
414
+ */
415
+ interface UnifoldUser {
416
+ /** Pre-fills the user's email (e.g. Stripe Link Pay). */
417
+ email?: string;
418
+ /** Pre-fills the user's phone; with `email`, Stripe may skip verify steps. */
419
+ phone?: string;
420
+ }
409
421
  interface DepositModalProps {
410
422
  /** Whether the modal is visible */
411
423
  visible: boolean;
@@ -449,19 +461,14 @@ interface DepositModalProps {
449
461
  /** Enable "Deposit with Card" (fiat on-ramp) option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
450
462
  enableFiatOnramp?: boolean;
451
463
  /** Show "Pay with Link" (Stripe) option in the deposit menu */
452
- enableStripeLinkPay?: boolean;
453
- /** Registered Stripe onramp component (Connect sets this from `enableStripeLinkPay`) */
464
+ enableStripeLink?: boolean;
465
+ /** Registered Stripe onramp component (Connect sets this from `enableStripeLink`) */
454
466
  StripeOnrampComponent?: React$1.ComponentType<any>;
455
- /** Pre-fills Stripe Link Pay email — set via `beginDeposit({ stripeOnrampEmail })` (forwarded as `email` on `StripeOnramp`) */
456
- stripeOnrampEmail?: string;
457
- /** Pre-fills Stripe Link Pay phone — set via `beginDeposit({ stripeOnrampPhone })` (forwarded as `phone` on `StripeOnramp`) */
458
- stripeOnrampPhone?: string;
459
467
  /**
460
- * Apple Pay merchant id for Stripe Link Pay. Forwarded to `StripeOnramp` as `merchantIdentifier`.
461
- * On Expo, you can omit this if the same value is set on the `@stripe/stripe-react-native` plugin
462
- * in app.json (the UI reads it via `expo-constants`).
468
+ * Host-app-supplied user identity. Pre-fills supported flows (currently Stripe
469
+ * Link Pay email/phone). Set via `beginDeposit({ user })`.
463
470
  */
464
- stripeMerchantIdentifier?: string;
471
+ user?: UnifoldUser;
465
472
  /** Where to render the Stripe payment method selector: "header" or "inline". Default: "header" */
466
473
  stripePaymentSelectorPosition?: "header" | "inline";
467
474
  /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
@@ -529,7 +536,7 @@ interface DepositModalProps {
529
536
  /** Price impact & slippage info sheet */
530
537
  infoSheet?: BorderRadiusConfig;
531
538
  /** Stripe Link Pay sheet */
532
- stripeLinkPay?: BorderRadiusConfig;
539
+ stripeLink?: BorderRadiusConfig;
533
540
  /** Cash App sheet */
534
541
  cashApp?: BorderRadiusConfig;
535
542
  /** Connect Wallet sheet */
@@ -636,7 +643,7 @@ interface UnifoldConnectProviderConfig {
636
643
  * Show "Pay with Link" (Stripe) option in the deposit menu.
637
644
  * Stripe onramp is bundled with Connect; set to false to hide the option.
638
645
  */
639
- enableStripeLinkPay?: boolean;
646
+ enableStripeLink?: boolean;
640
647
  /** Enable "Transfer Crypto" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
641
648
  enableTransferCrypto?: boolean;
642
649
  /** Enable "Pay with Cash App" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? false. */
@@ -645,17 +652,13 @@ interface UnifoldConnectProviderConfig {
645
652
  enableConnectWallet?: boolean;
646
653
  /** Enable "Deposit with Card" (fiat on-ramp) option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
647
654
  enableFiatOnramp?: boolean;
648
- /**
649
- * Apple Pay merchant id (`merchant.com...`) for Stripe Link Pay. Must match the
650
- * `merchantIdentifier` in the `@stripe/stripe-react-native` Expo plugin (app.json).
651
- * On Expo you can omit this if it is only set in the plugin — `StripeOnramp` reads it from
652
- * `expo-constants`. Use this for bare React Native or to override.
653
- */
654
- stripeMerchantIdentifier?: string;
655
- /** Where to render the Stripe payment method selector: "header" (above amount) or "inline" (below). Default: "header" */
656
- stripePaymentSelectorPosition?: "header" | "inline";
657
- /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
658
- stripeSkipSuccessConfirmation?: boolean;
655
+ /** Stripe Link Pay tuning options (only applies when `enableStripeLink` is true). */
656
+ stripeLink?: {
657
+ /** Where to render the Stripe payment method selector: "header" (above amount) or "inline" (below). Default: "header" */
658
+ paymentSelectorPosition?: "header" | "inline";
659
+ /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
660
+ skipSuccessConfirmation?: boolean;
661
+ };
659
662
  };
660
663
  }
661
664
  interface DepositResult {
@@ -679,10 +682,13 @@ interface DepositConfig {
679
682
  defaultChainId?: string;
680
683
  defaultTokenAddress?: string;
681
684
  showBalance?: boolean;
682
- /** Pre-fills Stripe Link Pay email (`beginDeposit` only — not provider config) */
683
- stripeOnrampEmail?: string;
684
- /** Pre-fills Stripe Link Pay phone; with `stripeOnrampEmail`, Stripe may skip verify steps */
685
- stripeOnrampPhone?: string;
685
+ /**
686
+ * Host-app-supplied user identity (`beginDeposit` only — not provider config).
687
+ * Pre-fills supported flows; currently Stripe Link Pay uses `user.email` /
688
+ * `user.phone` (with both set, Stripe may skip verify steps). Kept as an
689
+ * object so more fields can be added later without new `stripeXxx` params.
690
+ */
691
+ user?: UnifoldUser;
686
692
  /**
687
693
  * How deposit confirmation and waiting behavior is handled.
688
694
  * - auto_ui (default): Automatically show "Processing deposit" UI and start polling after 10s. No "I've deposited" button.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1, { ReactNode } from 'react';
2
- export { AmountScreen, CreateSessionParams, CustomerVerification, KYCData, KYCWizardScreen, OnrampConfig, OnrampCustomer, OnrampError, OnrampErrorCode, OnrampScreen, OnrampSession, OnrampSessionTransactionDetails, OnrampStep, OnrampTransaction, StripeOnramp, StripeOnrampHook, StripeOnrampPreconfigure, StripeOnrampProps, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp } from '@unifold/ui-react-native/stripe';
2
+ export { AmountScreen, CreateSessionParams, CustomerVerification, KYCData, KYCWizardScreen, OnrampConfig, OnrampCustomer, OnrampError, OnrampErrorCode, OnrampScreen, OnrampSession, OnrampSessionTransactionDetails, OnrampStep, OnrampTransaction, StripeOnramp, StripeOnrampConfig, StripeOnrampHook, StripeOnrampPreconfigure, StripeOnrampProps, getStripeConfig, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp } from '@unifold/ui-react-native/stripe';
3
3
 
4
4
  /**
5
5
  * Unifold color palette for React Native
@@ -406,6 +406,18 @@ type TransferInputVariant = "single_input" | "double_input" | "compact";
406
406
  type DepositMenuDisplay = "stacked" | "tabs";
407
407
  /** Controls which screen opens first when the deposit modal is shown */
408
408
  type DepositInitialScreen = "main" | "transfer" | "card" | "tracker" | "cashapp" | "wallet";
409
+ /**
410
+ * Host-app-supplied user identity used to pre-fill supported flows.
411
+ * Currently consumed by Stripe Link Pay (email/phone pre-fill). Kept as an
412
+ * extensible object so more fields can be added later without new top-level
413
+ * props.
414
+ */
415
+ interface UnifoldUser {
416
+ /** Pre-fills the user's email (e.g. Stripe Link Pay). */
417
+ email?: string;
418
+ /** Pre-fills the user's phone; with `email`, Stripe may skip verify steps. */
419
+ phone?: string;
420
+ }
409
421
  interface DepositModalProps {
410
422
  /** Whether the modal is visible */
411
423
  visible: boolean;
@@ -449,19 +461,14 @@ interface DepositModalProps {
449
461
  /** Enable "Deposit with Card" (fiat on-ramp) option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
450
462
  enableFiatOnramp?: boolean;
451
463
  /** Show "Pay with Link" (Stripe) option in the deposit menu */
452
- enableStripeLinkPay?: boolean;
453
- /** Registered Stripe onramp component (Connect sets this from `enableStripeLinkPay`) */
464
+ enableStripeLink?: boolean;
465
+ /** Registered Stripe onramp component (Connect sets this from `enableStripeLink`) */
454
466
  StripeOnrampComponent?: React$1.ComponentType<any>;
455
- /** Pre-fills Stripe Link Pay email — set via `beginDeposit({ stripeOnrampEmail })` (forwarded as `email` on `StripeOnramp`) */
456
- stripeOnrampEmail?: string;
457
- /** Pre-fills Stripe Link Pay phone — set via `beginDeposit({ stripeOnrampPhone })` (forwarded as `phone` on `StripeOnramp`) */
458
- stripeOnrampPhone?: string;
459
467
  /**
460
- * Apple Pay merchant id for Stripe Link Pay. Forwarded to `StripeOnramp` as `merchantIdentifier`.
461
- * On Expo, you can omit this if the same value is set on the `@stripe/stripe-react-native` plugin
462
- * in app.json (the UI reads it via `expo-constants`).
468
+ * Host-app-supplied user identity. Pre-fills supported flows (currently Stripe
469
+ * Link Pay email/phone). Set via `beginDeposit({ user })`.
463
470
  */
464
- stripeMerchantIdentifier?: string;
471
+ user?: UnifoldUser;
465
472
  /** Where to render the Stripe payment method selector: "header" or "inline". Default: "header" */
466
473
  stripePaymentSelectorPosition?: "header" | "inline";
467
474
  /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
@@ -529,7 +536,7 @@ interface DepositModalProps {
529
536
  /** Price impact & slippage info sheet */
530
537
  infoSheet?: BorderRadiusConfig;
531
538
  /** Stripe Link Pay sheet */
532
- stripeLinkPay?: BorderRadiusConfig;
539
+ stripeLink?: BorderRadiusConfig;
533
540
  /** Cash App sheet */
534
541
  cashApp?: BorderRadiusConfig;
535
542
  /** Connect Wallet sheet */
@@ -636,7 +643,7 @@ interface UnifoldConnectProviderConfig {
636
643
  * Show "Pay with Link" (Stripe) option in the deposit menu.
637
644
  * Stripe onramp is bundled with Connect; set to false to hide the option.
638
645
  */
639
- enableStripeLinkPay?: boolean;
646
+ enableStripeLink?: boolean;
640
647
  /** Enable "Transfer Crypto" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
641
648
  enableTransferCrypto?: boolean;
642
649
  /** Enable "Pay with Cash App" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? false. */
@@ -645,17 +652,13 @@ interface UnifoldConnectProviderConfig {
645
652
  enableConnectWallet?: boolean;
646
653
  /** Enable "Deposit with Card" (fiat on-ramp) option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */
647
654
  enableFiatOnramp?: boolean;
648
- /**
649
- * Apple Pay merchant id (`merchant.com...`) for Stripe Link Pay. Must match the
650
- * `merchantIdentifier` in the `@stripe/stripe-react-native` Expo plugin (app.json).
651
- * On Expo you can omit this if it is only set in the plugin — `StripeOnramp` reads it from
652
- * `expo-constants`. Use this for bare React Native or to override.
653
- */
654
- stripeMerchantIdentifier?: string;
655
- /** Where to render the Stripe payment method selector: "header" (above amount) or "inline" (below). Default: "header" */
656
- stripePaymentSelectorPosition?: "header" | "inline";
657
- /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
658
- stripeSkipSuccessConfirmation?: boolean;
655
+ /** Stripe Link Pay tuning options (only applies when `enableStripeLink` is true). */
656
+ stripeLink?: {
657
+ /** Where to render the Stripe payment method selector: "header" (above amount) or "inline" (below). Default: "header" */
658
+ paymentSelectorPosition?: "header" | "inline";
659
+ /** Skip the success confirmation screen and fire onComplete immediately. Default: false */
660
+ skipSuccessConfirmation?: boolean;
661
+ };
659
662
  };
660
663
  }
661
664
  interface DepositResult {
@@ -679,10 +682,13 @@ interface DepositConfig {
679
682
  defaultChainId?: string;
680
683
  defaultTokenAddress?: string;
681
684
  showBalance?: boolean;
682
- /** Pre-fills Stripe Link Pay email (`beginDeposit` only — not provider config) */
683
- stripeOnrampEmail?: string;
684
- /** Pre-fills Stripe Link Pay phone; with `stripeOnrampEmail`, Stripe may skip verify steps */
685
- stripeOnrampPhone?: string;
685
+ /**
686
+ * Host-app-supplied user identity (`beginDeposit` only — not provider config).
687
+ * Pre-fills supported flows; currently Stripe Link Pay uses `user.email` /
688
+ * `user.phone` (with both set, Stripe may skip verify steps). Kept as an
689
+ * object so more fields can be added later without new `stripeXxx` params.
690
+ */
691
+ user?: UnifoldUser;
686
692
  /**
687
693
  * How deposit confirmation and waiting behavior is handled.
688
694
  * - auto_ui (default): Automatically show "Processing deposit" UI and start polling after 10s. No "I've deposited" button.