@moonpay/platform-sdk-react-native 1.27.0 → 1.28.1
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 +16 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ All client methods return a `Result<T, E>` discriminated union instead of throwi
|
|
|
180
180
|
|
|
181
181
|
The SDK supports both a declarative and an imperative style:
|
|
182
182
|
|
|
183
|
-
- **Components** (`<MoonPayWidget>`, `<
|
|
183
|
+
- **Components** (`<MoonPayWidget>`, `<MoonPayBuyButton>`, …) render inline wherever you place them in your layout. Prefer these — you keep full control over placement, styling, and navigation.
|
|
184
184
|
- **Client methods** (`client.setupWidget()`, `client.connect()`, …) present the frame in a full-screen modal managed by the SDK. Useful when you want a flow to take over the screen without layout work.
|
|
185
185
|
|
|
186
186
|
Headless frames (`<MoonPayConnectionCheck>`, `<MoonPayBuyFrame>`, `<MoonPayConnectionReset>`) render nothing visible — they run a flow in a hidden WebView and report results through `onEvent`.
|
|
@@ -282,14 +282,14 @@ function WidgetScreen() {
|
|
|
282
282
|
}
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
### Render
|
|
285
|
+
### Render a buy button
|
|
286
286
|
|
|
287
|
-
The button mounts inline at its natural size (height 48 by default). Quote updates are pushed into the frame without remounting:
|
|
287
|
+
`<MoonPayBuyButton>` renders the button for the quote's payment method: an Apple Pay button for an Apple Pay quote, a Google Pay button for a Google Pay quote. The button mounts inline at its natural size (height 48 by default). Quote updates are pushed into the frame without remounting:
|
|
288
288
|
|
|
289
289
|
```tsx
|
|
290
|
-
import {
|
|
290
|
+
import { MoonPayBuyButton } from '@moonpay/platform-sdk-react-native';
|
|
291
291
|
|
|
292
|
-
<
|
|
292
|
+
<MoonPayBuyButton
|
|
293
293
|
quote={quoteSignature}
|
|
294
294
|
onEvent={(event) => {
|
|
295
295
|
switch (event.kind) {
|
|
@@ -300,19 +300,20 @@ import { MoonPayApplePayButton } from '@moonpay/platform-sdk-react-native';
|
|
|
300
300
|
// Card issuer requires 3DS — see "Handle a 3DS challenge" below
|
|
301
301
|
setChallengeUrl(event.payload.url);
|
|
302
302
|
break;
|
|
303
|
-
case '
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
303
|
+
case 'error':
|
|
304
|
+
if (event.payload.code === 'quoteExpired') {
|
|
305
|
+
// Fetch a fresh quote; the new `quote` prop is pushed without remounting
|
|
306
|
+
refreshQuote().then(setQuoteSignature);
|
|
307
|
+
} else if (event.payload.code === 'applePayUnavailable') {
|
|
308
|
+
// Device or region does not support Apple Pay — render a fallback
|
|
309
|
+
}
|
|
309
310
|
break;
|
|
310
311
|
}
|
|
311
312
|
}}
|
|
312
313
|
/>
|
|
313
314
|
```
|
|
314
315
|
|
|
315
|
-
`<
|
|
316
|
+
`<MoonPayApplePayButton>` and `<MoonPayGooglePayButton>` are deprecated: the Apple Pay and Google Pay frames are being removed. Render `<MoonPayBuyButton>` instead.
|
|
316
317
|
|
|
317
318
|
### Execute a buy headlessly
|
|
318
319
|
|
|
@@ -414,9 +415,9 @@ if (result.ok) {
|
|
|
414
415
|
| `<MoonPayAuth>` | Email/OTP auth for headless / Customer API integrations — check the connection first |
|
|
415
416
|
| `<MoonPayCustomerExport>` | Customer-export consent capture, inline |
|
|
416
417
|
| `<MoonPayWidget>` | Full buy widget, inline |
|
|
417
|
-
| `<
|
|
418
|
-
| `<
|
|
419
|
-
| `<
|
|
418
|
+
| `<MoonPayBuyButton>` | Buy button (Apple Pay, Google Pay or card), inline |
|
|
419
|
+
| `<MoonPayApplePayButton>` | *Deprecated, use `<MoonPayBuyButton>`.* Apple Pay button, inline |
|
|
420
|
+
| `<MoonPayGooglePayButton>` | *Deprecated, use `<MoonPayBuyButton>`.* Google Pay button, inline |
|
|
420
421
|
| `<MoonPayBuyFrame>` | Headless buy execution (nothing visible) |
|
|
421
422
|
| `<MoonPayAddCard>` | Card entry form, inline |
|
|
422
423
|
| `<MoonPayChallenge>` | 3DS challenge, inline |
|