@moonpay/platform-sdk-react-native 1.28.1 → 1.30.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 +11 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -84,7 +84,17 @@ export function App() {
|
|
|
84
84
|
|
|
85
85
|
`MoonPayProvider` also accepts optional `apiBaseUrl` and `frameBaseUrl` props that point the SDK at a different MoonPay environment — useful if MoonPay gives you test endpoints during onboarding. Leave them unset to use production.
|
|
86
86
|
|
|
87
|
-
Pass an optional `theme
|
|
87
|
+
Pass an optional `theme` to style every visible MoonPay frame:
|
|
88
|
+
|
|
89
|
+
- `appearance` — `'light'` or `'dark'`. Omit it to follow the customer's system preference.
|
|
90
|
+
- `brandColor` — your brand color (for example `'FF6B00'`). The frame derives its whole palette from it.
|
|
91
|
+
- `customTheme` — border radius, color scheme and palette overrides. See [Theming](https://dev.moonpay.com/platform/frames/theming).
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<MoonPayProvider theme={{ appearance: 'dark', brandColor: 'FF6B00', customTheme: { borderRadius: 'l' } }}>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`brandColor` and `customTheme` apply to the auth, widget, buy button and customer export frames. The connect, add card, challenge and reset frames ignore them for now. The connect flow can override any option per call (`client.connect({ theme })` or `<MoonPayConnect theme={...} />`).
|
|
88
98
|
|
|
89
99
|
#### Providing the session token later
|
|
90
100
|
|
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
|
);
|
|
@@ -1354,6 +1358,9 @@ function FrameSlots({
|
|
|
1354
1358
|
))
|
|
1355
1359
|
] });
|
|
1356
1360
|
}
|
|
1361
|
+
function themeDependencyKey(theme) {
|
|
1362
|
+
return theme ? JSON.stringify(theme) : void 0;
|
|
1363
|
+
}
|
|
1357
1364
|
function MoonPayProvider({
|
|
1358
1365
|
sessionToken: sessionTokenProp,
|
|
1359
1366
|
apiBaseUrl,
|
|
@@ -1373,9 +1380,10 @@ function MoonPayProvider({
|
|
|
1373
1380
|
},
|
|
1374
1381
|
[core]
|
|
1375
1382
|
);
|
|
1383
|
+
const themeKey = themeDependencyKey(theme);
|
|
1376
1384
|
const specCtx = (0, import_react3.useMemo)(
|
|
1377
1385
|
() => ({ sessionToken, core, frameBaseUrl, theme }),
|
|
1378
|
-
[sessionToken, core, frameBaseUrl,
|
|
1386
|
+
[sessionToken, core, frameBaseUrl, themeKey]
|
|
1379
1387
|
);
|
|
1380
1388
|
const client = (0, import_react3.useMemo)(
|
|
1381
1389
|
() => createRNClient({
|
|
@@ -1399,9 +1407,10 @@ function MoonPayEnterpriseProvider({
|
|
|
1399
1407
|
const { frameSlots, addSlot, removeSlot } = useFrameSlots();
|
|
1400
1408
|
const core = useCore(void 0, frameBaseUrl);
|
|
1401
1409
|
core.context.setClientToken(clientToken);
|
|
1410
|
+
const themeKey = themeDependencyKey(theme);
|
|
1402
1411
|
const specCtx = (0, import_react3.useMemo)(
|
|
1403
1412
|
() => ({ core, frameBaseUrl, theme, enterpriseClientToken: clientToken }),
|
|
1404
|
-
[clientToken, core, frameBaseUrl,
|
|
1413
|
+
[clientToken, core, frameBaseUrl, themeKey]
|
|
1405
1414
|
);
|
|
1406
1415
|
const value = (0, import_react3.useMemo)(
|
|
1407
1416
|
() => ({
|
|
@@ -1593,6 +1602,7 @@ function MoonPayBuyButton({
|
|
|
1593
1602
|
quote,
|
|
1594
1603
|
externalTransactionId,
|
|
1595
1604
|
applePayButtonSettings,
|
|
1605
|
+
googlePayButtonSettings,
|
|
1596
1606
|
headless,
|
|
1597
1607
|
onEvent,
|
|
1598
1608
|
style,
|
|
@@ -1602,7 +1612,7 @@ function MoonPayBuyButton({
|
|
|
1602
1612
|
MoonPayFrameView,
|
|
1603
1613
|
{
|
|
1604
1614
|
spec: headless ? headlessBuyButtonSpec : buyButtonSpec,
|
|
1605
|
-
props: { quote, externalTransactionId, applePayButtonSettings },
|
|
1615
|
+
props: { quote, externalTransactionId, applePayButtonSettings, googlePayButtonSettings },
|
|
1606
1616
|
style,
|
|
1607
1617
|
defaultStyle: { height: 48 },
|
|
1608
1618
|
onEvent,
|