@moonpay/platform-sdk-react-native 1.29.0 → 1.31.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 +12 -2
- package/dist/index.cjs +8 -6
- 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 +9 -6
- 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
|
|
|
@@ -242,7 +252,7 @@ function SignInScreen({ onAuthenticated }: { onAuthenticated: () => void }) {
|
|
|
242
252
|
}
|
|
243
253
|
```
|
|
244
254
|
|
|
245
|
-
Mounting `<MoonPayAuth>` — or calling `setupAuth()` — without that prior `getConnection()` call emits an `error` event. On completion, credentials are applied to the shared client automatically, and `event.payload.status` is
|
|
255
|
+
Mounting `<MoonPayAuth>` — or calling `setupAuth()` — without that prior `getConnection()` call emits an `error` event. On completion, credentials are applied to the shared client automatically, and `event.payload.status` is `active`, `pending`, `termsAcceptanceRequired`, `unavailable` or `failed` (see [Connection statuses](#connection-statuses)). Check the status before you continue: only `active` and `pending` deliver credentials.
|
|
246
256
|
|
|
247
257
|
### Get a quote and render the widget
|
|
248
258
|
|
package/dist/index.cjs
CHANGED
|
@@ -325,10 +325,7 @@ var authSpec = {
|
|
|
325
325
|
return { kind: "error", payload: msg.payload };
|
|
326
326
|
case "complete": {
|
|
327
327
|
const connection = msg.payload;
|
|
328
|
-
|
|
329
|
-
return { kind: "complete", payload: msg.payload };
|
|
330
|
-
}
|
|
331
|
-
return null;
|
|
328
|
+
return (0, import_platform_sdk_core.isAuthResult)(connection) ? { kind: "complete", payload: connection } : null;
|
|
332
329
|
}
|
|
333
330
|
default:
|
|
334
331
|
return null;
|
|
@@ -1358,6 +1355,9 @@ function FrameSlots({
|
|
|
1358
1355
|
))
|
|
1359
1356
|
] });
|
|
1360
1357
|
}
|
|
1358
|
+
function themeDependencyKey(theme) {
|
|
1359
|
+
return theme ? JSON.stringify(theme) : void 0;
|
|
1360
|
+
}
|
|
1361
1361
|
function MoonPayProvider({
|
|
1362
1362
|
sessionToken: sessionTokenProp,
|
|
1363
1363
|
apiBaseUrl,
|
|
@@ -1377,9 +1377,10 @@ function MoonPayProvider({
|
|
|
1377
1377
|
},
|
|
1378
1378
|
[core]
|
|
1379
1379
|
);
|
|
1380
|
+
const themeKey = themeDependencyKey(theme);
|
|
1380
1381
|
const specCtx = (0, import_react3.useMemo)(
|
|
1381
1382
|
() => ({ sessionToken, core, frameBaseUrl, theme }),
|
|
1382
|
-
[sessionToken, core, frameBaseUrl,
|
|
1383
|
+
[sessionToken, core, frameBaseUrl, themeKey]
|
|
1383
1384
|
);
|
|
1384
1385
|
const client = (0, import_react3.useMemo)(
|
|
1385
1386
|
() => createRNClient({
|
|
@@ -1403,9 +1404,10 @@ function MoonPayEnterpriseProvider({
|
|
|
1403
1404
|
const { frameSlots, addSlot, removeSlot } = useFrameSlots();
|
|
1404
1405
|
const core = useCore(void 0, frameBaseUrl);
|
|
1405
1406
|
core.context.setClientToken(clientToken);
|
|
1407
|
+
const themeKey = themeDependencyKey(theme);
|
|
1406
1408
|
const specCtx = (0, import_react3.useMemo)(
|
|
1407
1409
|
() => ({ core, frameBaseUrl, theme, enterpriseClientToken: clientToken }),
|
|
1408
|
-
[clientToken, core, frameBaseUrl,
|
|
1410
|
+
[clientToken, core, frameBaseUrl, themeKey]
|
|
1409
1411
|
);
|
|
1410
1412
|
const value = (0, import_react3.useMemo)(
|
|
1411
1413
|
() => ({
|