@moonpay/platform-sdk-react-native 1.22.0 → 1.24.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/dist/index.cjs CHANGED
@@ -205,7 +205,7 @@ var buyButtonSpec = {
205
205
  function applyCredentialsOnComplete(msg, ctx) {
206
206
  if (msg.kind !== "complete" || !ctx.privateKey) return;
207
207
  const connection = msg.payload;
208
- if (connection.status !== import_connection.ConnectionStatus.active && connection.status !== import_connection.ConnectionStatus.connectionRequired) {
208
+ if (connection.status !== import_connection.ConnectionStatus.active && connection.status !== import_connection.ConnectionStatus.pending && connection.status !== import_connection.ConnectionStatus.connectionRequired) {
209
209
  return;
210
210
  }
211
211
  if (!connection.credentials) return;
@@ -306,7 +306,7 @@ var authSpec = {
306
306
  return { kind: "error", payload: msg.payload };
307
307
  case "complete": {
308
308
  const connection = msg.payload;
309
- if (connection.status === import_connection.ConnectionStatus.active || connection.status === import_connection.ConnectionStatus.termsAcceptanceRequired) {
309
+ if (connection.status === import_connection.ConnectionStatus.active || connection.status === import_connection.ConnectionStatus.pending || connection.status === import_connection.ConnectionStatus.termsAcceptanceRequired) {
310
310
  return { kind: "complete", payload: msg.payload };
311
311
  }
312
312
  return null;
@@ -513,7 +513,8 @@ function MoonPayFrame({
513
513
  transport,
514
514
  hidden,
515
515
  style,
516
- webViewProps
516
+ webViewProps,
517
+ onRef
517
518
  }) {
518
519
  const webViewRef = (0, import_react.useRef)(null);
519
520
  (0, import_react.useEffect)(() => {
@@ -521,6 +522,10 @@ function MoonPayFrame({
521
522
  return () => {
522
523
  };
523
524
  }, [transport]);
525
+ (0, import_react.useEffect)(() => {
526
+ onRef?.(webViewRef.current);
527
+ return () => onRef?.(null);
528
+ }, [onRef]);
524
529
  const url = transport.url;
525
530
  if (!url) return null;
526
531
  const handleMessage = (event) => {
@@ -1355,7 +1360,8 @@ function MoonPayFrameView({
1355
1360
  style,
1356
1361
  defaultStyle,
1357
1362
  onEvent,
1358
- webViewProps
1363
+ webViewProps,
1364
+ onRef
1359
1365
  }) {
1360
1366
  const { sessionToken, core, frameBaseUrl, theme } = useMoonPayContext();
1361
1367
  const [transport, setTransport] = (0, import_react4.useState)(null);
@@ -1423,10 +1429,10 @@ function MoonPayFrameView({
1423
1429
  applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);
1424
1430
  }, [liveKey]);
1425
1431
  if (spec.hidden) {
1426
- return transport ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MoonPayFrame, { transport, hidden: true, webViewProps }) : null;
1432
+ return transport ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MoonPayFrame, { transport, hidden: true, webViewProps, onRef }) : null;
1427
1433
  }
1428
1434
  const resolvedStyle = { ...defaultStyle, ...style };
1429
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native3.View, { style: resolvedStyle, children: transport ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MoonPayFrame, { transport, webViewProps }) : null });
1435
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native3.View, { style: resolvedStyle, children: transport ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MoonPayFrame, { transport, webViewProps, onRef }) : null });
1430
1436
  }
1431
1437
 
1432
1438
  // src/components/add-card.tsx
@@ -1453,7 +1459,8 @@ function MoonPayApplePayButton({
1453
1459
  applePayButtonSettings,
1454
1460
  onEvent,
1455
1461
  style,
1456
- webViewProps
1462
+ webViewProps,
1463
+ onRef
1457
1464
  }) {
1458
1465
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1459
1466
  MoonPayFrameView,
@@ -1463,7 +1470,8 @@ function MoonPayApplePayButton({
1463
1470
  style,
1464
1471
  defaultStyle: { height: 48 },
1465
1472
  onEvent,
1466
- webViewProps
1473
+ webViewProps,
1474
+ onRef
1467
1475
  }
1468
1476
  );
1469
1477
  }