@moonpay/platform-sdk-react-native 1.29.0 → 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 +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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
|
@@ -1358,6 +1358,9 @@ function FrameSlots({
|
|
|
1358
1358
|
))
|
|
1359
1359
|
] });
|
|
1360
1360
|
}
|
|
1361
|
+
function themeDependencyKey(theme) {
|
|
1362
|
+
return theme ? JSON.stringify(theme) : void 0;
|
|
1363
|
+
}
|
|
1361
1364
|
function MoonPayProvider({
|
|
1362
1365
|
sessionToken: sessionTokenProp,
|
|
1363
1366
|
apiBaseUrl,
|
|
@@ -1377,9 +1380,10 @@ function MoonPayProvider({
|
|
|
1377
1380
|
},
|
|
1378
1381
|
[core]
|
|
1379
1382
|
);
|
|
1383
|
+
const themeKey = themeDependencyKey(theme);
|
|
1380
1384
|
const specCtx = (0, import_react3.useMemo)(
|
|
1381
1385
|
() => ({ sessionToken, core, frameBaseUrl, theme }),
|
|
1382
|
-
[sessionToken, core, frameBaseUrl,
|
|
1386
|
+
[sessionToken, core, frameBaseUrl, themeKey]
|
|
1383
1387
|
);
|
|
1384
1388
|
const client = (0, import_react3.useMemo)(
|
|
1385
1389
|
() => createRNClient({
|
|
@@ -1403,9 +1407,10 @@ function MoonPayEnterpriseProvider({
|
|
|
1403
1407
|
const { frameSlots, addSlot, removeSlot } = useFrameSlots();
|
|
1404
1408
|
const core = useCore(void 0, frameBaseUrl);
|
|
1405
1409
|
core.context.setClientToken(clientToken);
|
|
1410
|
+
const themeKey = themeDependencyKey(theme);
|
|
1406
1411
|
const specCtx = (0, import_react3.useMemo)(
|
|
1407
1412
|
() => ({ core, frameBaseUrl, theme, enterpriseClientToken: clientToken }),
|
|
1408
|
-
[clientToken, core, frameBaseUrl,
|
|
1413
|
+
[clientToken, core, frameBaseUrl, themeKey]
|
|
1409
1414
|
);
|
|
1410
1415
|
const value = (0, import_react3.useMemo)(
|
|
1411
1416
|
() => ({
|