@unifold/connect-react-native 0.1.26 → 0.1.28

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
@@ -4,15 +4,24 @@ React Native/Expo SDK for crypto deposits and onramp with Unifold.
4
4
 
5
5
  ## Installation
6
6
 
7
- ```bash
8
- # npm
9
- npm install @unifold/connect-react-native react-native-svg react-native-webview
10
-
11
- # yarn
12
- yarn add @unifold/connect-react-native react-native-svg react-native-webview
7
+ Native-linked libraries are **peer dependencies** so your app (or Expo) owns a single version. That avoids duplicate `react-native-svg` / `react-native-webview` installs and the `overrides` workarounds that come from nested copies.
13
8
 
14
- # Expo (recommended)
15
- npx expo install @unifold/connect-react-native react-native-svg react-native-webview
9
+ ```bash
10
+ # Expo (recommended) versions aligned with your SDK
11
+ npx expo install @unifold/connect-react-native \
12
+ @react-native-async-storage/async-storage \
13
+ @stripe/stripe-react-native \
14
+ react-native-gesture-handler \
15
+ react-native-svg \
16
+ react-native-webview
17
+
18
+ # npm / yarn — install the same peers your Expo SDK would use
19
+ npm install @unifold/connect-react-native \
20
+ @react-native-async-storage/async-storage \
21
+ @stripe/stripe-react-native \
22
+ react-native-gesture-handler \
23
+ react-native-svg \
24
+ react-native-webview
16
25
  ```
17
26
 
18
27
  ### iOS (bare React Native only)
@@ -21,6 +30,29 @@ npx expo install @unifold/connect-react-native react-native-svg react-native-web
21
30
  cd ios && pod install
22
31
  ```
23
32
 
33
+ ### Stripe Link Pay (native)
34
+
35
+ Link Pay uses `@stripe/stripe-react-native`, which includes **native** code (Apple Pay, onramp Turbo Module). In **Expo**, add the [Stripe config plugin](https://docs.expo.dev/guides/using-stripe/) to `app.json` (for example `merchantIdentifier`, `enableApplePay`, `includeOnramp: true`). You need a **development build** or EAS build — **Expo Go** does not ship Stripe’s onramp native module.
36
+
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
+
39
+ **`expo-constants`** is a **dependency** of `@unifold/connect-react-native` so `require("expo-constants")` always resolves when reading `merchantIdentifier` from the Stripe Expo plugin in JS. You can still set **`config.stripeMerchantIdentifier`** on `UnifoldProvider` to override or skip that path.
40
+
41
+ #### Expo Go vs development build vs prebuild
42
+
43
+ - **Expo Go** is a generic client: it does **not** include this app’s Stripe onramp native code, so Link Pay / onramp will not work there. That is a limitation of Expo Go, not of “Expo” as a whole.
44
+ - A **development build** is *your* app binary (Stripe plugin + native modules baked in). Create it with **`npx expo prebuild`** (generates `ios/` / `android/`) and then **`npx expo run:ios`** / **`run:android`**, or with **EAS Build** (`eas build --profile development`). Day to day you still use **`expo start`** for JS; only the **installed** app is custom, not Expo Go.
45
+ - **Simulator**: A development build usually runs on the **iOS Simulator** without the same provisioning hassle as a physical device for many flows. **Apple Pay** can still be picky (wallet sheet, merchant validation); use a **real device** when Apple Pay misbehaves on the simulator, and ensure the **merchant ID** exists in your [Apple Developer](https://developer.apple.com) account and matches `app.json` / Stripe.
46
+ - **Certificates / signing**: Debug builds for Simulator often work with **Xcode automatic signing** and a free Apple ID. **Device** distribution (TestFlight, App Store) needs your normal certificates and team. Apple Pay production behavior also depends on merchant configuration in Apple and Stripe dashboards—not only the simulator.
47
+
48
+ ## Integration checklist
49
+
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
+ 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
+ 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`).
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
+
24
56
  ## Quick Start
25
57
 
26
58
  ### 1. Wrap your app with UnifoldProvider
@@ -160,6 +192,8 @@ await beginDeposit({
160
192
  | `config.fonts` | `FontConfig` | No | Granular font weight configuration |
161
193
  | `config.components` | `ComponentConfig` | No | Component-specific token overrides |
162
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`). |
163
197
 
164
198
  ### SheetBorderRadius
165
199
 
@@ -269,8 +303,12 @@ import type {
269
303
  |------------|---------|
270
304
  | React Native | >= 0.72.0 |
271
305
  | Expo (optional) | >= 49.0.0 |
306
+ | @react-native-async-storage/async-storage | >= 1.19.0 |
307
+ | @stripe/stripe-react-native | >= 0.62.0 |
308
+ | react-native-gesture-handler | >= 2.14.0 |
272
309
  | react-native-svg | >= 13.0.0 |
273
- | react-native-webview | >= 11.0.0 |
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` |
274
312
 
275
313
  ## Support
276
314
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
+ 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';
3
4
 
4
5
  /**
5
6
  * Unifold color palette for React Native
@@ -297,12 +298,18 @@ interface DepositModalProps {
297
298
  hideDepositTracker?: boolean;
298
299
  /** Show "Pay with Link" (Stripe) option in the deposit menu */
299
300
  enableStripeLinkPay?: boolean;
300
- /** Injected StripeOnramp component avoids bundling Stripe into the main entry */
301
+ /** Registered Stripe onramp component (Connect sets this from `enableStripeLinkPay`) */
301
302
  StripeOnrampComponent?: React$1.ComponentType<any>;
302
303
  /** Pre-fills Stripe Link Pay email — set via `beginDeposit({ stripeOnrampEmail })` (forwarded as `email` on `StripeOnramp`) */
303
304
  stripeOnrampEmail?: string;
304
305
  /** Pre-fills Stripe Link Pay phone — set via `beginDeposit({ stripeOnrampPhone })` (forwarded as `phone` on `StripeOnramp`) */
305
306
  stripeOnrampPhone?: string;
307
+ /**
308
+ * Apple Pay merchant id for Stripe Link Pay. Forwarded to `StripeOnramp` as `merchantIdentifier`.
309
+ * On Expo, you can omit this if the same value is set on the `@stripe/stripe-react-native` plugin
310
+ * in app.json (the UI reads it via `expo-constants`).
311
+ */
312
+ stripeMerchantIdentifier?: string;
306
313
  /**
307
314
  * Same ThemeProvider options as `UnifoldProvider` (`theme`, `components`, fonts, etc.).
308
315
  * Re-wrapped around the Stripe Link Pay sheet so nested modals receive theme context and
@@ -362,8 +369,8 @@ interface DepositModalProps {
362
369
 
363
370
  /**
364
371
  * Opt-in dev-only API base URL (staging, localhost, etc.).
365
- * Has no effect unless `__DEV__` is true; trimmed empty string clears any prior override (back to production).
366
- * Release builds always use production regardless of calls here.
372
+ * Stored on `globalThis` so it applies everywhere this file is inlined (e.g. Connect’s prebundle).
373
+ * No-op when not `__DEV__`; empty / whitespace clears the override.
367
374
  */
368
375
  declare function setDevApiUrl(url: string): void;
369
376
 
@@ -409,11 +416,10 @@ declare function useAllowedCountry(publishableKey: string, enabled?: boolean): A
409
416
 
410
417
  /**
411
418
  * Register the StripeOnramp component so the deposit menu can render it.
412
- * Called automatically by `@unifold/connect-react-native/stripe` when imported,
413
- * or manually by the consumer.
419
+ * Connect calls this once at SDK load (`register-stripe-onramp.ts`); you may call
420
+ * `registerStripeOnramp` again to swap in a custom implementation.
414
421
  *
415
- * Uses globalThis so the registration survives across separately-bundled entries
416
- * (tsup bundles index.js and stripe.js with splitting:false, creating isolated scopes).
422
+ * Uses globalThis so a custom registration can still be read consistently.
417
423
  */
418
424
  declare function registerStripeOnramp(component: React.ComponentType<any>): void;
419
425
 
@@ -440,10 +446,16 @@ interface UnifoldConnectProviderConfig {
440
446
  sheetBorderRadius?: DepositModalProps["sheetBorderRadius"];
441
447
  /**
442
448
  * Show "Pay with Link" (Stripe) option in the deposit menu.
443
- * Requires `import "@unifold/connect-react-native/stripe"` in your app entry
444
- * and `@stripe/stripe-react-native` to be installed.
449
+ * Stripe onramp is bundled with Connect; set to false to hide the option.
445
450
  */
446
451
  enableStripeLinkPay?: boolean;
452
+ /**
453
+ * Apple Pay merchant id (`merchant.com...`) for Stripe Link Pay. Must match the
454
+ * `merchantIdentifier` in the `@stripe/stripe-react-native` Expo plugin (app.json).
455
+ * On Expo you can omit this if it is only set in the plugin — `StripeOnramp` reads it from
456
+ * `expo-constants`. Use this for bare React Native or to override.
457
+ */
458
+ stripeMerchantIdentifier?: string;
447
459
  };
448
460
  }
449
461
  interface DepositResult {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
+ 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';
3
4
 
4
5
  /**
5
6
  * Unifold color palette for React Native
@@ -297,12 +298,18 @@ interface DepositModalProps {
297
298
  hideDepositTracker?: boolean;
298
299
  /** Show "Pay with Link" (Stripe) option in the deposit menu */
299
300
  enableStripeLinkPay?: boolean;
300
- /** Injected StripeOnramp component avoids bundling Stripe into the main entry */
301
+ /** Registered Stripe onramp component (Connect sets this from `enableStripeLinkPay`) */
301
302
  StripeOnrampComponent?: React$1.ComponentType<any>;
302
303
  /** Pre-fills Stripe Link Pay email — set via `beginDeposit({ stripeOnrampEmail })` (forwarded as `email` on `StripeOnramp`) */
303
304
  stripeOnrampEmail?: string;
304
305
  /** Pre-fills Stripe Link Pay phone — set via `beginDeposit({ stripeOnrampPhone })` (forwarded as `phone` on `StripeOnramp`) */
305
306
  stripeOnrampPhone?: string;
307
+ /**
308
+ * Apple Pay merchant id for Stripe Link Pay. Forwarded to `StripeOnramp` as `merchantIdentifier`.
309
+ * On Expo, you can omit this if the same value is set on the `@stripe/stripe-react-native` plugin
310
+ * in app.json (the UI reads it via `expo-constants`).
311
+ */
312
+ stripeMerchantIdentifier?: string;
306
313
  /**
307
314
  * Same ThemeProvider options as `UnifoldProvider` (`theme`, `components`, fonts, etc.).
308
315
  * Re-wrapped around the Stripe Link Pay sheet so nested modals receive theme context and
@@ -362,8 +369,8 @@ interface DepositModalProps {
362
369
 
363
370
  /**
364
371
  * Opt-in dev-only API base URL (staging, localhost, etc.).
365
- * Has no effect unless `__DEV__` is true; trimmed empty string clears any prior override (back to production).
366
- * Release builds always use production regardless of calls here.
372
+ * Stored on `globalThis` so it applies everywhere this file is inlined (e.g. Connect’s prebundle).
373
+ * No-op when not `__DEV__`; empty / whitespace clears the override.
367
374
  */
368
375
  declare function setDevApiUrl(url: string): void;
369
376
 
@@ -409,11 +416,10 @@ declare function useAllowedCountry(publishableKey: string, enabled?: boolean): A
409
416
 
410
417
  /**
411
418
  * Register the StripeOnramp component so the deposit menu can render it.
412
- * Called automatically by `@unifold/connect-react-native/stripe` when imported,
413
- * or manually by the consumer.
419
+ * Connect calls this once at SDK load (`register-stripe-onramp.ts`); you may call
420
+ * `registerStripeOnramp` again to swap in a custom implementation.
414
421
  *
415
- * Uses globalThis so the registration survives across separately-bundled entries
416
- * (tsup bundles index.js and stripe.js with splitting:false, creating isolated scopes).
422
+ * Uses globalThis so a custom registration can still be read consistently.
417
423
  */
418
424
  declare function registerStripeOnramp(component: React.ComponentType<any>): void;
419
425
 
@@ -440,10 +446,16 @@ interface UnifoldConnectProviderConfig {
440
446
  sheetBorderRadius?: DepositModalProps["sheetBorderRadius"];
441
447
  /**
442
448
  * Show "Pay with Link" (Stripe) option in the deposit menu.
443
- * Requires `import "@unifold/connect-react-native/stripe"` in your app entry
444
- * and `@stripe/stripe-react-native` to be installed.
449
+ * Stripe onramp is bundled with Connect; set to false to hide the option.
445
450
  */
446
451
  enableStripeLinkPay?: boolean;
452
+ /**
453
+ * Apple Pay merchant id (`merchant.com...`) for Stripe Link Pay. Must match the
454
+ * `merchantIdentifier` in the `@stripe/stripe-react-native` Expo plugin (app.json).
455
+ * On Expo you can omit this if it is only set in the plugin — `StripeOnramp` reads it from
456
+ * `expo-constants`. Use this for bare React Native or to override.
457
+ */
458
+ stripeMerchantIdentifier?: string;
447
459
  };
448
460
  }
449
461
  interface DepositResult {