@moonpay/platform-sdk-react-native 1.28.0 → 1.29.0
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 +6 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.js +6 -1
- 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 |
|
package/dist/index.cjs
CHANGED
|
@@ -175,6 +175,9 @@ var buyButtonSpec = {
|
|
|
175
175
|
signature: props.quote,
|
|
176
176
|
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
177
177
|
...props.applePayButtonSettings && { applePayButtonSettings: props.applePayButtonSettings },
|
|
178
|
+
...props.googlePayButtonSettings && {
|
|
179
|
+
googlePayButtonSettings: props.googlePayButtonSettings
|
|
180
|
+
},
|
|
178
181
|
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
179
182
|
}),
|
|
180
183
|
createCommands: createQuoteCommands,
|
|
@@ -855,6 +858,7 @@ async function setupBuyButton(deps, opts) {
|
|
|
855
858
|
quote: opts.quote,
|
|
856
859
|
externalTransactionId: opts.externalTransactionId,
|
|
857
860
|
applePayButtonSettings: opts.applePayButtonSettings,
|
|
861
|
+
googlePayButtonSettings: opts.googlePayButtonSettings,
|
|
858
862
|
presentation: opts.presentation
|
|
859
863
|
}
|
|
860
864
|
);
|
|
@@ -1593,6 +1597,7 @@ function MoonPayBuyButton({
|
|
|
1593
1597
|
quote,
|
|
1594
1598
|
externalTransactionId,
|
|
1595
1599
|
applePayButtonSettings,
|
|
1600
|
+
googlePayButtonSettings,
|
|
1596
1601
|
headless,
|
|
1597
1602
|
onEvent,
|
|
1598
1603
|
style,
|
|
@@ -1602,7 +1607,7 @@ function MoonPayBuyButton({
|
|
|
1602
1607
|
MoonPayFrameView,
|
|
1603
1608
|
{
|
|
1604
1609
|
spec: headless ? headlessBuyButtonSpec : buyButtonSpec,
|
|
1605
|
-
props: { quote, externalTransactionId, applePayButtonSettings },
|
|
1610
|
+
props: { quote, externalTransactionId, applePayButtonSettings, googlePayButtonSettings },
|
|
1606
1611
|
style,
|
|
1607
1612
|
defaultStyle: { height: 48 },
|
|
1608
1613
|
onEvent,
|