@moonpay/platform-sdk-react-native 1.6.0 → 1.7.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 +5 -3
- package/dist/index.cjs +115 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.js +106 -53
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -328,8 +328,9 @@ if (result.ok) {
|
|
|
328
328
|
|
|
329
329
|
- **Connection** — `getConnection()`, `connect()`, `setupAuth()` (requires a prior `getConnection()` call), `resetConnection()`
|
|
330
330
|
- **Payments data** — `getQuote()`, `getPaymentMethods()`, `deletePaymentMethod()`, `listTransactions()`, `getTransaction()`
|
|
331
|
-
- **Frames** — `setupWidget()`, `setupBuy()`, `setupChallenge()`, `setupAddCard()`
|
|
332
|
-
- **
|
|
331
|
+
- **Frames** — `setupWidget()`, `setupBuy()`, `setupChallenge()`, `setupAddCard()`, `setupCustomerExport()`
|
|
332
|
+
- **Customer** — `getCustomer()`, `submitCustomerKyc()`, `getCustomerUploadUrl()`, `submitCustomerFiles()` for headless integrations
|
|
333
|
+
- **Identity** *(deprecated, use Customer above)* — `createIdentity()`, `getIdentity()`, `updateIdentity()`, `verifyIdentity()` and file upload helpers
|
|
333
334
|
|
|
334
335
|
**Components**
|
|
335
336
|
|
|
@@ -338,7 +339,8 @@ if (result.ok) {
|
|
|
338
339
|
| `<MoonPayConnect>` | Connect flow, inline |
|
|
339
340
|
| `<MoonPayConnectionCheck>` | Headless connection check (nothing visible) |
|
|
340
341
|
| `<MoonPayConnectionReset>` | Headless connection reset (nothing visible) |
|
|
341
|
-
| `<MoonPayAuth>` | Email/OTP auth for headless /
|
|
342
|
+
| `<MoonPayAuth>` | Email/OTP auth for headless / Customer API integrations — check the connection first |
|
|
343
|
+
| `<MoonPayCustomerExport>` | Customer-export consent capture, inline |
|
|
342
344
|
| `<MoonPayWidget>` | Full buy widget, inline |
|
|
343
345
|
| `<MoonPayApplePayButton>` | Apple Pay button, inline |
|
|
344
346
|
| `<MoonPayGooglePayButton>` | Google Pay button, inline |
|
package/dist/index.cjs
CHANGED
|
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
ConnectionStatus: () => import_connection2.ConnectionStatus,
|
|
34
34
|
MoonPayAddCard: () => MoonPayAddCard,
|
|
35
35
|
MoonPayApplePayButton: () => MoonPayApplePayButton,
|
|
@@ -40,6 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
MoonPayConnect: () => MoonPayConnect,
|
|
41
41
|
MoonPayConnectionCheck: () => MoonPayConnectionCheck,
|
|
42
42
|
MoonPayConnectionReset: () => MoonPayConnectionReset,
|
|
43
|
+
MoonPayCustomerExport: () => MoonPayCustomerExport,
|
|
43
44
|
MoonPayFrame: () => MoonPayFrame,
|
|
44
45
|
MoonPayGooglePayButton: () => MoonPayGooglePayButton,
|
|
45
46
|
MoonPayProvider: () => MoonPayProvider,
|
|
@@ -47,7 +48,7 @@ __export(src_exports, {
|
|
|
47
48
|
WebViewTransport: () => WebViewTransport,
|
|
48
49
|
useMoonPay: () => useMoonPay
|
|
49
50
|
});
|
|
50
|
-
module.exports = __toCommonJS(
|
|
51
|
+
module.exports = __toCommonJS(index_exports);
|
|
51
52
|
var import_connection2 = require("@moonpay/platform-protocol/models/connection");
|
|
52
53
|
|
|
53
54
|
// src/frame-specs.ts
|
|
@@ -179,14 +180,12 @@ var buyButtonSpec = {
|
|
|
179
180
|
})
|
|
180
181
|
};
|
|
181
182
|
function applyCredentialsOnComplete(msg, ctx) {
|
|
182
|
-
if (msg.kind !== "complete" || !ctx.privateKey)
|
|
183
|
-
return;
|
|
183
|
+
if (msg.kind !== "complete" || !ctx.privateKey) return;
|
|
184
184
|
const connection = msg.payload;
|
|
185
185
|
if (connection.status !== import_connection.ConnectionStatus.active && connection.status !== import_connection.ConnectionStatus.connectionRequired) {
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
if (!connection.credentials)
|
|
189
|
-
return;
|
|
188
|
+
if (!connection.credentials) return;
|
|
190
189
|
const creds = (0, import_platform_sdk_core.decryptCredentials)(connection.credentials, ctx.privateKey);
|
|
191
190
|
ctx.core.context.setAccessToken(creds.accessToken);
|
|
192
191
|
ctx.core.context.setClientToken(creds.clientToken);
|
|
@@ -371,6 +370,33 @@ var addCardSpec = {
|
|
|
371
370
|
payload: { code: "generic", message }
|
|
372
371
|
})
|
|
373
372
|
};
|
|
373
|
+
var customerExportSpec = {
|
|
374
|
+
channelPrefix: "customer-export",
|
|
375
|
+
path: import_platform_sdk_core.FRAME_PATHS.customerExport,
|
|
376
|
+
hidden: false,
|
|
377
|
+
buildParams: (ctx) => ({ clientToken: ctx.core.context.clientToken }),
|
|
378
|
+
mapMessage: (msg) => {
|
|
379
|
+
switch (msg.kind) {
|
|
380
|
+
case "ready":
|
|
381
|
+
return { kind: "ready" };
|
|
382
|
+
case "complete":
|
|
383
|
+
return {
|
|
384
|
+
kind: "complete",
|
|
385
|
+
payload: msg.payload
|
|
386
|
+
};
|
|
387
|
+
case "error":
|
|
388
|
+
return { kind: "error", payload: msg.payload };
|
|
389
|
+
case "close":
|
|
390
|
+
return { kind: "close" };
|
|
391
|
+
default:
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
errorEvent: (message) => ({
|
|
396
|
+
kind: "error",
|
|
397
|
+
payload: { code: import_connection.ConnectionErrorCode.connectionFailedGeneric, message }
|
|
398
|
+
})
|
|
399
|
+
};
|
|
374
400
|
var challengeSpec = {
|
|
375
401
|
channelPrefix: "challenge",
|
|
376
402
|
path: import_platform_sdk_core.FRAME_PATHS.challenge,
|
|
@@ -408,8 +434,7 @@ var connectionResetSpec = {
|
|
|
408
434
|
handshakeTimeout: 5e3,
|
|
409
435
|
buildParams: (ctx) => ({ sessionToken: ctx.sessionToken }),
|
|
410
436
|
mapMessage: (msg) => {
|
|
411
|
-
if (msg.kind === "complete")
|
|
412
|
-
return { kind: "complete" };
|
|
437
|
+
if (msg.kind === "complete") return { kind: "complete" };
|
|
413
438
|
if (msg.kind === "error") {
|
|
414
439
|
const payload = msg.payload;
|
|
415
440
|
return { kind: "error", payload: { message: payload?.message ?? "Reset failed" } };
|
|
@@ -436,8 +461,7 @@ function MoonPayFrame({ transport, hidden, style }) {
|
|
|
436
461
|
};
|
|
437
462
|
}, [transport]);
|
|
438
463
|
const url = transport.url;
|
|
439
|
-
if (!url)
|
|
440
|
-
return null;
|
|
464
|
+
if (!url) return null;
|
|
441
465
|
const handleMessage = (event) => {
|
|
442
466
|
transport.handleWebViewMessage(event.nativeEvent.data);
|
|
443
467
|
};
|
|
@@ -457,9 +481,10 @@ function MoonPayFrame({ transport, hidden, style }) {
|
|
|
457
481
|
}
|
|
458
482
|
|
|
459
483
|
// src/frame-engine.ts
|
|
460
|
-
var
|
|
484
|
+
var import_platform_sdk_core3 = require("@moonpay/platform-sdk-core");
|
|
461
485
|
|
|
462
486
|
// src/webview-transport.ts
|
|
487
|
+
var import_platform_sdk_core2 = require("@moonpay/platform-sdk-core");
|
|
463
488
|
var WebViewTransport = class {
|
|
464
489
|
webViewRef = null;
|
|
465
490
|
handlers = [];
|
|
@@ -473,8 +498,7 @@ var WebViewTransport = class {
|
|
|
473
498
|
handleWebViewMessage(data) {
|
|
474
499
|
try {
|
|
475
500
|
const msg = JSON.parse(data);
|
|
476
|
-
if (!msg.kind)
|
|
477
|
-
return;
|
|
501
|
+
if (!msg.kind) return;
|
|
478
502
|
for (const handler of this.handlers) {
|
|
479
503
|
handler(msg);
|
|
480
504
|
}
|
|
@@ -489,6 +513,9 @@ var WebViewTransport = class {
|
|
|
489
513
|
}
|
|
490
514
|
// FrameTransport interface
|
|
491
515
|
create(url, options) {
|
|
516
|
+
if (!(0, import_platform_sdk_core2.isTrustedFrameUrl)(url)) {
|
|
517
|
+
throw new Error("Refusing to load frame: URL is not a trusted MoonPay origin");
|
|
518
|
+
}
|
|
492
519
|
this._url = url;
|
|
493
520
|
this._options = options;
|
|
494
521
|
}
|
|
@@ -502,8 +529,7 @@ var WebViewTransport = class {
|
|
|
502
529
|
this.handlers.push(handler);
|
|
503
530
|
return () => {
|
|
504
531
|
const idx = this.handlers.indexOf(handler);
|
|
505
|
-
if (idx >= 0)
|
|
506
|
-
this.handlers.splice(idx, 1);
|
|
532
|
+
if (idx >= 0) this.handlers.splice(idx, 1);
|
|
507
533
|
};
|
|
508
534
|
}
|
|
509
535
|
dispose() {
|
|
@@ -524,20 +550,20 @@ var FrameSessionDisposedError = class extends Error {
|
|
|
524
550
|
function createFrameSession(spec, ctx, props, overrides = {}) {
|
|
525
551
|
const generated = `${spec.channelPrefix}-${Date.now()}`;
|
|
526
552
|
const channelId = spec.resolveChannelId ? spec.resolveChannelId(props, generated) : generated;
|
|
527
|
-
const keyPair = spec.needsKeyPair ? (0,
|
|
528
|
-
const builtUrl = spec.buildUrl ? spec.buildUrl(ctx, props, channelId, keyPair?.publicKey) : (0,
|
|
553
|
+
const keyPair = spec.needsKeyPair ? (0, import_platform_sdk_core3.generateKeyPair)() : void 0;
|
|
554
|
+
const builtUrl = spec.buildUrl ? spec.buildUrl(ctx, props, channelId, keyPair?.publicKey) : (0, import_platform_sdk_core3.buildFrameUrl)(
|
|
529
555
|
spec.path,
|
|
530
556
|
{ ...spec.buildParams?.(ctx, props, keyPair?.publicKey), channelId },
|
|
531
557
|
{ frameBaseUrl: ctx.frameBaseUrl }
|
|
532
558
|
);
|
|
533
|
-
const url = spec.hidden ? builtUrl : (0,
|
|
559
|
+
const url = spec.hidden ? builtUrl : (0, import_platform_sdk_core3.applyThemeParam)(builtUrl, ctx.theme);
|
|
534
560
|
const transport = (overrides.createTransport ?? (() => new WebViewTransport()))();
|
|
535
561
|
let resolvedHandle = null;
|
|
536
562
|
let rejectDisposed;
|
|
537
563
|
const disposedBeforeReady = new Promise((_, reject) => {
|
|
538
564
|
rejectDisposed = reject;
|
|
539
565
|
});
|
|
540
|
-
const handleReady = (0,
|
|
566
|
+
const handleReady = (0, import_platform_sdk_core3.createFrameOrchestrator)({
|
|
541
567
|
transport,
|
|
542
568
|
channelId,
|
|
543
569
|
url,
|
|
@@ -551,8 +577,7 @@ function createFrameSession(spec, ctx, props, overrides = {}) {
|
|
|
551
577
|
const disposeHandlers = [];
|
|
552
578
|
let disposeNotified = false;
|
|
553
579
|
const notifyDisposed = () => {
|
|
554
|
-
if (disposeNotified)
|
|
555
|
-
return;
|
|
580
|
+
if (disposeNotified) return;
|
|
556
581
|
disposeNotified = true;
|
|
557
582
|
for (const handler of [...disposeHandlers]) {
|
|
558
583
|
handler();
|
|
@@ -577,8 +602,7 @@ function createFrameSession(spec, ctx, props, overrides = {}) {
|
|
|
577
602
|
eventHandlers.push(handler);
|
|
578
603
|
return () => {
|
|
579
604
|
const idx = eventHandlers.indexOf(handler);
|
|
580
|
-
if (idx >= 0)
|
|
581
|
-
eventHandlers.splice(idx, 1);
|
|
605
|
+
if (idx >= 0) eventHandlers.splice(idx, 1);
|
|
582
606
|
};
|
|
583
607
|
},
|
|
584
608
|
onMessage: (handler) => handle.onMessage(handler),
|
|
@@ -586,8 +610,7 @@ function createFrameSession(spec, ctx, props, overrides = {}) {
|
|
|
586
610
|
disposeHandlers.push(handler);
|
|
587
611
|
return () => {
|
|
588
612
|
const idx = disposeHandlers.indexOf(handler);
|
|
589
|
-
if (idx >= 0)
|
|
590
|
-
disposeHandlers.splice(idx, 1);
|
|
613
|
+
if (idx >= 0) disposeHandlers.splice(idx, 1);
|
|
591
614
|
};
|
|
592
615
|
},
|
|
593
616
|
sendMessage: send,
|
|
@@ -621,7 +644,7 @@ function createFrameSession(spec, ctx, props, overrides = {}) {
|
|
|
621
644
|
}
|
|
622
645
|
|
|
623
646
|
// src/provider.tsx
|
|
624
|
-
var
|
|
647
|
+
var import_platform_sdk_core5 = require("@moonpay/platform-sdk-core");
|
|
625
648
|
var import_react3 = require("react");
|
|
626
649
|
|
|
627
650
|
// src/methods/add-card.ts
|
|
@@ -728,15 +751,19 @@ async function setupBuyButton(deps, opts) {
|
|
|
728
751
|
|
|
729
752
|
// src/methods/challenge.ts
|
|
730
753
|
var import_result6 = require("@moonpay/platform-protocol/result");
|
|
754
|
+
var import_platform_sdk_core4 = require("@moonpay/platform-sdk-core");
|
|
731
755
|
async function setupChallenge(deps, opts) {
|
|
756
|
+
if (!(0, import_platform_sdk_core4.isTrustedFrameUrl)(opts.url)) {
|
|
757
|
+
return (0, import_result6.err)({
|
|
758
|
+
kind: "configurationError",
|
|
759
|
+
message: "Challenge URL must be served from a trusted MoonPay origin"
|
|
760
|
+
});
|
|
761
|
+
}
|
|
732
762
|
try {
|
|
733
763
|
const { handle, dispose } = await deps.mountSession(challengeSpec, { url: opts.url });
|
|
734
764
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
735
765
|
return (0, import_result6.ok)({ dispose });
|
|
736
766
|
} catch (e) {
|
|
737
|
-
if (e instanceof TypeError) {
|
|
738
|
-
return (0, import_result6.err)({ kind: "configurationError", message: "Invalid challenge URL" });
|
|
739
|
-
}
|
|
740
767
|
return (0, import_result6.err)({
|
|
741
768
|
kind: "genericError",
|
|
742
769
|
message: e instanceof Error ? e.message : "Challenge setup failed"
|
|
@@ -821,8 +848,23 @@ async function resetConnection(deps) {
|
|
|
821
848
|
}
|
|
822
849
|
}
|
|
823
850
|
|
|
824
|
-
// src/methods/
|
|
851
|
+
// src/methods/customer-export.ts
|
|
825
852
|
var import_result10 = require("@moonpay/platform-protocol/result");
|
|
853
|
+
async function setupCustomerExport(deps, opts) {
|
|
854
|
+
try {
|
|
855
|
+
const { handle, dispose } = await deps.mountSession(customerExportSpec, {});
|
|
856
|
+
handle.onEvent((event) => opts.onEvent?.(event));
|
|
857
|
+
return (0, import_result10.ok)({ dispose });
|
|
858
|
+
} catch (e) {
|
|
859
|
+
return (0, import_result10.err)({
|
|
860
|
+
kind: "genericError",
|
|
861
|
+
message: e instanceof Error ? e.message : "Customer export setup failed"
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// src/methods/google-pay.ts
|
|
867
|
+
var import_result11 = require("@moonpay/platform-protocol/result");
|
|
826
868
|
async function setupGooglePay(deps, opts) {
|
|
827
869
|
try {
|
|
828
870
|
const { handle, dispose } = await deps.mountSession(googlePaySpec, {
|
|
@@ -830,9 +872,9 @@ async function setupGooglePay(deps, opts) {
|
|
|
830
872
|
externalTransactionId: opts.externalTransactionId
|
|
831
873
|
});
|
|
832
874
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
833
|
-
return (0,
|
|
875
|
+
return (0, import_result11.ok)({ setQuote: handle.commands.setQuote, dispose });
|
|
834
876
|
} catch (e) {
|
|
835
|
-
return (0,
|
|
877
|
+
return (0, import_result11.err)({
|
|
836
878
|
kind: "genericError",
|
|
837
879
|
message: e instanceof Error ? e.message : "Google Pay setup failed"
|
|
838
880
|
});
|
|
@@ -840,14 +882,14 @@ async function setupGooglePay(deps, opts) {
|
|
|
840
882
|
}
|
|
841
883
|
|
|
842
884
|
// src/methods/widget.ts
|
|
843
|
-
var
|
|
885
|
+
var import_result12 = require("@moonpay/platform-protocol/result");
|
|
844
886
|
async function setupWidget(deps, opts) {
|
|
845
887
|
try {
|
|
846
888
|
const { handle, dispose } = await deps.mountSession(widgetSpec, { quote: opts.quote });
|
|
847
889
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
848
|
-
return (0,
|
|
890
|
+
return (0, import_result12.ok)({ dispose });
|
|
849
891
|
} catch (e) {
|
|
850
|
-
return (0,
|
|
892
|
+
return (0, import_result12.err)({
|
|
851
893
|
kind: "genericError",
|
|
852
894
|
message: e instanceof Error ? e.message : "Widget setup failed"
|
|
853
895
|
});
|
|
@@ -875,6 +917,11 @@ function createRNClient(deps) {
|
|
|
875
917
|
resetConnection: () => resetConnection(deps),
|
|
876
918
|
setupChallenge: (opts) => setupChallenge(deps, opts),
|
|
877
919
|
setupAddCard: (opts) => setupAddCard(deps, opts),
|
|
920
|
+
setupCustomerExport: (opts) => setupCustomerExport(deps, opts),
|
|
921
|
+
getCustomer: (id) => core.getCustomer(id),
|
|
922
|
+
submitCustomerKyc: (id, body) => core.submitCustomerKyc(id, body),
|
|
923
|
+
getCustomerUploadUrl: (id, body) => core.getCustomerUploadUrl(id, body),
|
|
924
|
+
submitCustomerFiles: (id, body) => core.submitCustomerFiles(id, body),
|
|
878
925
|
createIdentity: (body) => core.createIdentity(body),
|
|
879
926
|
getIdentity: (id) => core.getIdentity(id),
|
|
880
927
|
updateIdentity: (id, body) => core.updateIdentity(id, body),
|
|
@@ -924,18 +971,15 @@ var NOOP = {
|
|
|
924
971
|
close: false
|
|
925
972
|
};
|
|
926
973
|
function resolvePresentation(phase, signal) {
|
|
927
|
-
if (phase === "closed")
|
|
928
|
-
return { phase: "closed", ...NOOP };
|
|
974
|
+
if (phase === "closed") return { phase: "closed", ...NOOP };
|
|
929
975
|
switch (signal) {
|
|
930
976
|
case "ready":
|
|
931
977
|
return { ...NOOP, phase: "presented", present: phase === "hidden", liftSpinner: true };
|
|
932
978
|
case "grace":
|
|
933
|
-
if (phase === "presented")
|
|
934
|
-
return { phase: "presented", ...NOOP };
|
|
979
|
+
if (phase === "presented") return { phase: "presented", ...NOOP };
|
|
935
980
|
return { ...NOOP, phase: "presented", present: true };
|
|
936
981
|
case "terminal":
|
|
937
|
-
if (phase === "hidden")
|
|
938
|
-
return { ...NOOP, phase: "closed", dismissSilent: true };
|
|
982
|
+
if (phase === "hidden") return { ...NOOP, phase: "closed", dismissSilent: true };
|
|
939
983
|
return { ...NOOP, phase: "closed", close: true };
|
|
940
984
|
}
|
|
941
985
|
}
|
|
@@ -975,13 +1019,11 @@ function VisibleFrameSlotSheet({
|
|
|
975
1019
|
onCloseRef.current = onClose;
|
|
976
1020
|
const closingRef = (0, import_react2.useRef)(false);
|
|
977
1021
|
const close = (0, import_react2.useCallback)(() => {
|
|
978
|
-
if (closingRef.current)
|
|
979
|
-
return;
|
|
1022
|
+
if (closingRef.current) return;
|
|
980
1023
|
closingRef.current = true;
|
|
981
1024
|
phaseRef.current = "closed";
|
|
982
1025
|
animateSheet(translateY, sheetHeight, ({ finished }) => {
|
|
983
|
-
if (finished)
|
|
984
|
-
onCloseRef.current();
|
|
1026
|
+
if (finished) onCloseRef.current();
|
|
985
1027
|
});
|
|
986
1028
|
}, [translateY, sheetHeight]);
|
|
987
1029
|
const panResponder = (0, import_react2.useMemo)(
|
|
@@ -1024,12 +1066,9 @@ function VisibleFrameSlotSheet({
|
|
|
1024
1066
|
setPresented(true);
|
|
1025
1067
|
animateSheet(translateY, 0);
|
|
1026
1068
|
}
|
|
1027
|
-
if (result.liftSpinner)
|
|
1028
|
-
|
|
1029
|
-
if (result.
|
|
1030
|
-
onCloseRef.current();
|
|
1031
|
-
if (result.close)
|
|
1032
|
-
close();
|
|
1069
|
+
if (result.liftSpinner) setFrameReady(true);
|
|
1070
|
+
if (result.dismissSilent) onCloseRef.current();
|
|
1071
|
+
if (result.close) close();
|
|
1033
1072
|
},
|
|
1034
1073
|
[translateY, close]
|
|
1035
1074
|
);
|
|
@@ -1039,10 +1078,8 @@ function VisibleFrameSlotSheet({
|
|
|
1039
1078
|
}, [dispatch]);
|
|
1040
1079
|
(0, import_react2.useEffect)(() => {
|
|
1041
1080
|
const unsubscribe = slot.transport.onMessage((msg) => {
|
|
1042
|
-
if (msg.kind === "ready")
|
|
1043
|
-
|
|
1044
|
-
else if (msg.kind === "complete" || msg.kind === "error")
|
|
1045
|
-
dispatch("terminal");
|
|
1081
|
+
if (msg.kind === "ready") dispatch("ready");
|
|
1082
|
+
else if (msg.kind === "complete" || msg.kind === "error") dispatch("terminal");
|
|
1046
1083
|
});
|
|
1047
1084
|
return unsubscribe;
|
|
1048
1085
|
}, [slot.transport, dispatch]);
|
|
@@ -1144,7 +1181,7 @@ function MoonPayProvider({
|
|
|
1144
1181
|
}, []);
|
|
1145
1182
|
const coreRef = (0, import_react3.useRef)(null);
|
|
1146
1183
|
if (!coreRef.current) {
|
|
1147
|
-
coreRef.current = (0,
|
|
1184
|
+
coreRef.current = (0, import_platform_sdk_core5.createClientCore)({
|
|
1148
1185
|
apiBaseUrl,
|
|
1149
1186
|
frameBaseUrl,
|
|
1150
1187
|
createTransport: () => new WebViewTransport()
|
|
@@ -1265,8 +1302,7 @@ function MoonPayFrameView({
|
|
|
1265
1302
|
}, [mountKey, spec, sessionToken, core, frameBaseUrl]);
|
|
1266
1303
|
(0, import_react4.useEffect)(() => {
|
|
1267
1304
|
const handle = handleRef.current;
|
|
1268
|
-
if (!handle)
|
|
1269
|
-
return;
|
|
1305
|
+
if (!handle) return;
|
|
1270
1306
|
applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);
|
|
1271
1307
|
}, [liveKey]);
|
|
1272
1308
|
if (spec.hidden) {
|
|
@@ -1411,15 +1447,30 @@ function MoonPayConnectionReset({ onEvent }) {
|
|
|
1411
1447
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MoonPayFrameView, { spec: connectionResetSpec, props: {}, defaultStyle: {}, onEvent });
|
|
1412
1448
|
}
|
|
1413
1449
|
|
|
1414
|
-
// src/components/
|
|
1450
|
+
// src/components/customer-export.tsx
|
|
1415
1451
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1452
|
+
function MoonPayCustomerExport({ onEvent, style }) {
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1454
|
+
MoonPayFrameView,
|
|
1455
|
+
{
|
|
1456
|
+
spec: customerExportSpec,
|
|
1457
|
+
props: {},
|
|
1458
|
+
style,
|
|
1459
|
+
defaultStyle: { flex: 1 },
|
|
1460
|
+
onEvent
|
|
1461
|
+
}
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
// src/components/google-pay-button.tsx
|
|
1466
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1416
1467
|
function MoonPayGooglePayButton({
|
|
1417
1468
|
quote,
|
|
1418
1469
|
externalTransactionId,
|
|
1419
1470
|
onEvent,
|
|
1420
1471
|
style
|
|
1421
1472
|
}) {
|
|
1422
|
-
return /* @__PURE__ */ (0,
|
|
1473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1423
1474
|
MoonPayFrameView,
|
|
1424
1475
|
{
|
|
1425
1476
|
spec: googlePaySpec,
|
|
@@ -1432,9 +1483,9 @@ function MoonPayGooglePayButton({
|
|
|
1432
1483
|
}
|
|
1433
1484
|
|
|
1434
1485
|
// src/components/widget.tsx
|
|
1435
|
-
var
|
|
1486
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1436
1487
|
function MoonPayWidget({ quote, onEvent, style }) {
|
|
1437
|
-
return /* @__PURE__ */ (0,
|
|
1488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1438
1489
|
MoonPayFrameView,
|
|
1439
1490
|
{
|
|
1440
1491
|
spec: widgetSpec,
|
|
@@ -1457,6 +1508,7 @@ function MoonPayWidget({ quote, onEvent, style }) {
|
|
|
1457
1508
|
MoonPayConnect,
|
|
1458
1509
|
MoonPayConnectionCheck,
|
|
1459
1510
|
MoonPayConnectionReset,
|
|
1511
|
+
MoonPayCustomerExport,
|
|
1460
1512
|
MoonPayFrame,
|
|
1461
1513
|
MoonPayGooglePayButton,
|
|
1462
1514
|
MoonPayProvider,
|