@moonpay/platform-sdk-react-native 1.8.0 → 1.9.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 +40 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +40 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -83,6 +83,8 @@ interface AddCardFrame {
|
|
|
83
83
|
interface SetupApplePayOptions {
|
|
84
84
|
/** Quote signature from getQuote(). */
|
|
85
85
|
quote: string;
|
|
86
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
87
|
+
externalTransactionId?: string;
|
|
86
88
|
/** Callback for Apple Pay lifecycle events. */
|
|
87
89
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
88
90
|
}
|
|
@@ -117,6 +119,8 @@ interface BuyFrame {
|
|
|
117
119
|
interface SetupBuyButtonOptions {
|
|
118
120
|
/** Quote signature from getQuote(). */
|
|
119
121
|
quote: string;
|
|
122
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
123
|
+
externalTransactionId?: string;
|
|
120
124
|
/** Callback for buy-button frame lifecycle events. */
|
|
121
125
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
122
126
|
}
|
|
@@ -180,6 +184,8 @@ interface GooglePayFrame {
|
|
|
180
184
|
interface SetupWidgetOptions {
|
|
181
185
|
/** Quote signature from getQuote(). */
|
|
182
186
|
quote: string;
|
|
187
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
188
|
+
externalTransactionId?: string;
|
|
183
189
|
/** Callback for widget lifecycle events. */
|
|
184
190
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
185
191
|
}
|
|
@@ -297,13 +303,15 @@ declare function MoonPayAddCard({ onEvent, style }: MoonPayAddCardProps): JSX.El
|
|
|
297
303
|
interface MoonPayApplePayButtonProps {
|
|
298
304
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
299
305
|
quote: string;
|
|
306
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
307
|
+
externalTransactionId?: string;
|
|
300
308
|
/** Callback for Apple Pay lifecycle events. */
|
|
301
309
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
302
310
|
/** Container style. Defaults to height 48. */
|
|
303
311
|
style?: ViewStyle;
|
|
304
312
|
}
|
|
305
313
|
/** Inline Apple Pay button. Render it wherever it should appear in your layout. */
|
|
306
|
-
declare function MoonPayApplePayButton({ quote, onEvent, style, }: MoonPayApplePayButtonProps): JSX.Element;
|
|
314
|
+
declare function MoonPayApplePayButton({ quote, externalTransactionId, onEvent, style, }: MoonPayApplePayButtonProps): JSX.Element;
|
|
307
315
|
|
|
308
316
|
interface MoonPayAuthProps {
|
|
309
317
|
/** Callback for auth lifecycle events. */
|
|
@@ -321,13 +329,15 @@ declare function MoonPayAuth({ onEvent, style }: MoonPayAuthProps): JSX.Element;
|
|
|
321
329
|
interface MoonPayBuyButtonProps {
|
|
322
330
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
323
331
|
quote: string;
|
|
332
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
333
|
+
externalTransactionId?: string;
|
|
324
334
|
/** Callback for buy button lifecycle events. */
|
|
325
335
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
326
336
|
/** Container style. Defaults to height 48. */
|
|
327
337
|
style?: ViewStyle;
|
|
328
338
|
}
|
|
329
339
|
/** Inline card/buy button. Render it wherever it should appear in your layout. */
|
|
330
|
-
declare function MoonPayBuyButton({ quote, onEvent, style }: MoonPayBuyButtonProps): JSX.Element;
|
|
340
|
+
declare function MoonPayBuyButton({ quote, externalTransactionId, onEvent, style, }: MoonPayBuyButtonProps): JSX.Element;
|
|
331
341
|
|
|
332
342
|
interface MoonPayBuyFrameProps {
|
|
333
343
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
@@ -425,13 +435,15 @@ declare function MoonPayGooglePayButton({ quote, externalTransactionId, onEvent,
|
|
|
425
435
|
interface MoonPayWidgetProps {
|
|
426
436
|
/** Quote signature from getQuote(). Mount-time only — changing it reloads the widget. */
|
|
427
437
|
quote: string;
|
|
438
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
439
|
+
externalTransactionId?: string;
|
|
428
440
|
/** Callback for widget lifecycle events. */
|
|
429
441
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
430
442
|
/** Container style. Defaults to flex: 1. */
|
|
431
443
|
style?: ViewStyle;
|
|
432
444
|
}
|
|
433
445
|
/** Inline widget frame. Render it wherever it should appear in your layout. */
|
|
434
|
-
declare function MoonPayWidget({ quote, onEvent, style }: MoonPayWidgetProps): JSX.Element;
|
|
446
|
+
declare function MoonPayWidget({ quote, externalTransactionId, onEvent, style, }: MoonPayWidgetProps): JSX.Element;
|
|
435
447
|
|
|
436
448
|
interface MoonPayFrameProps {
|
|
437
449
|
/** The transport instance managing this frame's communication. */
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ interface AddCardFrame {
|
|
|
83
83
|
interface SetupApplePayOptions {
|
|
84
84
|
/** Quote signature from getQuote(). */
|
|
85
85
|
quote: string;
|
|
86
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
87
|
+
externalTransactionId?: string;
|
|
86
88
|
/** Callback for Apple Pay lifecycle events. */
|
|
87
89
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
88
90
|
}
|
|
@@ -117,6 +119,8 @@ interface BuyFrame {
|
|
|
117
119
|
interface SetupBuyButtonOptions {
|
|
118
120
|
/** Quote signature from getQuote(). */
|
|
119
121
|
quote: string;
|
|
122
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
123
|
+
externalTransactionId?: string;
|
|
120
124
|
/** Callback for buy-button frame lifecycle events. */
|
|
121
125
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
122
126
|
}
|
|
@@ -180,6 +184,8 @@ interface GooglePayFrame {
|
|
|
180
184
|
interface SetupWidgetOptions {
|
|
181
185
|
/** Quote signature from getQuote(). */
|
|
182
186
|
quote: string;
|
|
187
|
+
/** Partner-assigned identifier for this transaction attempt. */
|
|
188
|
+
externalTransactionId?: string;
|
|
183
189
|
/** Callback for widget lifecycle events. */
|
|
184
190
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
185
191
|
}
|
|
@@ -297,13 +303,15 @@ declare function MoonPayAddCard({ onEvent, style }: MoonPayAddCardProps): JSX.El
|
|
|
297
303
|
interface MoonPayApplePayButtonProps {
|
|
298
304
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
299
305
|
quote: string;
|
|
306
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
307
|
+
externalTransactionId?: string;
|
|
300
308
|
/** Callback for Apple Pay lifecycle events. */
|
|
301
309
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
302
310
|
/** Container style. Defaults to height 48. */
|
|
303
311
|
style?: ViewStyle;
|
|
304
312
|
}
|
|
305
313
|
/** Inline Apple Pay button. Render it wherever it should appear in your layout. */
|
|
306
|
-
declare function MoonPayApplePayButton({ quote, onEvent, style, }: MoonPayApplePayButtonProps): JSX.Element;
|
|
314
|
+
declare function MoonPayApplePayButton({ quote, externalTransactionId, onEvent, style, }: MoonPayApplePayButtonProps): JSX.Element;
|
|
307
315
|
|
|
308
316
|
interface MoonPayAuthProps {
|
|
309
317
|
/** Callback for auth lifecycle events. */
|
|
@@ -321,13 +329,15 @@ declare function MoonPayAuth({ onEvent, style }: MoonPayAuthProps): JSX.Element;
|
|
|
321
329
|
interface MoonPayBuyButtonProps {
|
|
322
330
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
323
331
|
quote: string;
|
|
332
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
333
|
+
externalTransactionId?: string;
|
|
324
334
|
/** Callback for buy button lifecycle events. */
|
|
325
335
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
326
336
|
/** Container style. Defaults to height 48. */
|
|
327
337
|
style?: ViewStyle;
|
|
328
338
|
}
|
|
329
339
|
/** Inline card/buy button. Render it wherever it should appear in your layout. */
|
|
330
|
-
declare function MoonPayBuyButton({ quote, onEvent, style }: MoonPayBuyButtonProps): JSX.Element;
|
|
340
|
+
declare function MoonPayBuyButton({ quote, externalTransactionId, onEvent, style, }: MoonPayBuyButtonProps): JSX.Element;
|
|
331
341
|
|
|
332
342
|
interface MoonPayBuyFrameProps {
|
|
333
343
|
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
@@ -425,13 +435,15 @@ declare function MoonPayGooglePayButton({ quote, externalTransactionId, onEvent,
|
|
|
425
435
|
interface MoonPayWidgetProps {
|
|
426
436
|
/** Quote signature from getQuote(). Mount-time only — changing it reloads the widget. */
|
|
427
437
|
quote: string;
|
|
438
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
439
|
+
externalTransactionId?: string;
|
|
428
440
|
/** Callback for widget lifecycle events. */
|
|
429
441
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
430
442
|
/** Container style. Defaults to flex: 1. */
|
|
431
443
|
style?: ViewStyle;
|
|
432
444
|
}
|
|
433
445
|
/** Inline widget frame. Render it wherever it should appear in your layout. */
|
|
434
|
-
declare function MoonPayWidget({ quote, onEvent, style }: MoonPayWidgetProps): JSX.Element;
|
|
446
|
+
declare function MoonPayWidget({ quote, externalTransactionId, onEvent, style, }: MoonPayWidgetProps): JSX.Element;
|
|
435
447
|
|
|
436
448
|
interface MoonPayFrameProps {
|
|
437
449
|
/** The transport instance managing this frame's communication. */
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,8 @@ var applePaySpec = {
|
|
|
27
27
|
hidden: false,
|
|
28
28
|
buildParams: (ctx, props) => ({
|
|
29
29
|
clientToken: ctx.core.context.clientToken,
|
|
30
|
-
signature: props.quote
|
|
30
|
+
signature: props.quote,
|
|
31
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
31
32
|
}),
|
|
32
33
|
createCommands: createQuoteCommands,
|
|
33
34
|
reactiveProps: {
|
|
@@ -37,6 +38,8 @@ var applePaySpec = {
|
|
|
37
38
|
switch (msg.kind) {
|
|
38
39
|
case "ready":
|
|
39
40
|
return { kind: "ready" };
|
|
41
|
+
case "buttonPressed":
|
|
42
|
+
return { kind: "buttonPressed" };
|
|
40
43
|
case "complete":
|
|
41
44
|
return { kind: "complete", payload: msg.payload };
|
|
42
45
|
case "challenge":
|
|
@@ -78,6 +81,8 @@ var googlePaySpec = {
|
|
|
78
81
|
switch (msg.kind) {
|
|
79
82
|
case "ready":
|
|
80
83
|
return { kind: "ready" };
|
|
84
|
+
case "buttonPressed":
|
|
85
|
+
return { kind: "buttonPressed" };
|
|
81
86
|
case "complete":
|
|
82
87
|
return { kind: "complete", payload: msg.payload };
|
|
83
88
|
case "challenge":
|
|
@@ -108,7 +113,8 @@ var buyButtonSpec = {
|
|
|
108
113
|
hidden: false,
|
|
109
114
|
buildParams: (ctx, props) => ({
|
|
110
115
|
clientToken: ctx.core.context.clientToken,
|
|
111
|
-
signature: props.quote
|
|
116
|
+
signature: props.quote,
|
|
117
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
112
118
|
}),
|
|
113
119
|
createCommands: createQuoteCommands,
|
|
114
120
|
reactiveProps: {
|
|
@@ -118,6 +124,8 @@ var buyButtonSpec = {
|
|
|
118
124
|
switch (msg.kind) {
|
|
119
125
|
case "ready":
|
|
120
126
|
return { kind: "ready" };
|
|
127
|
+
case "buttonPressed":
|
|
128
|
+
return { kind: "buttonPressed" };
|
|
121
129
|
case "complete":
|
|
122
130
|
return { kind: "complete", payload: msg.payload };
|
|
123
131
|
case "challenge":
|
|
@@ -244,7 +252,8 @@ var widgetSpec = {
|
|
|
244
252
|
buildParams: (ctx, props) => ({
|
|
245
253
|
flow: "buy",
|
|
246
254
|
clientToken: ctx.core.context.clientToken,
|
|
247
|
-
quoteSignature: props.quote
|
|
255
|
+
quoteSignature: props.quote,
|
|
256
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
248
257
|
}),
|
|
249
258
|
mapMessage: (msg) => {
|
|
250
259
|
switch (msg.kind) {
|
|
@@ -637,7 +646,10 @@ async function setupAddCard(deps, opts) {
|
|
|
637
646
|
import { err as err2, ok as ok2 } from "@moonpay/platform-protocol/result";
|
|
638
647
|
async function setupApplePay(deps, opts) {
|
|
639
648
|
try {
|
|
640
|
-
const { handle, dispose } = await deps.mountSession(applePaySpec, {
|
|
649
|
+
const { handle, dispose } = await deps.mountSession(applePaySpec, {
|
|
650
|
+
quote: opts.quote,
|
|
651
|
+
externalTransactionId: opts.externalTransactionId
|
|
652
|
+
});
|
|
641
653
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
642
654
|
return ok2({ setQuote: handle.commands.setQuote, dispose });
|
|
643
655
|
} catch (e) {
|
|
@@ -709,7 +721,10 @@ async function setupBuy(deps, opts) {
|
|
|
709
721
|
import { err as err5, ok as ok5 } from "@moonpay/platform-protocol/result";
|
|
710
722
|
async function setupBuyButton(deps, opts) {
|
|
711
723
|
try {
|
|
712
|
-
const { handle, dispose } = await deps.mountSession(buyButtonSpec, {
|
|
724
|
+
const { handle, dispose } = await deps.mountSession(buyButtonSpec, {
|
|
725
|
+
quote: opts.quote,
|
|
726
|
+
externalTransactionId: opts.externalTransactionId
|
|
727
|
+
});
|
|
713
728
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
714
729
|
return ok5({ setQuote: handle.commands.setQuote, dispose });
|
|
715
730
|
} catch (e) {
|
|
@@ -856,7 +871,10 @@ async function setupGooglePay(deps, opts) {
|
|
|
856
871
|
import { err as err11, ok as ok12 } from "@moonpay/platform-protocol/result";
|
|
857
872
|
async function setupWidget(deps, opts) {
|
|
858
873
|
try {
|
|
859
|
-
const { handle, dispose } = await deps.mountSession(widgetSpec, {
|
|
874
|
+
const { handle, dispose } = await deps.mountSession(widgetSpec, {
|
|
875
|
+
quote: opts.quote,
|
|
876
|
+
externalTransactionId: opts.externalTransactionId
|
|
877
|
+
});
|
|
860
878
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
861
879
|
return ok12({ dispose });
|
|
862
880
|
} catch (e) {
|
|
@@ -1313,6 +1331,7 @@ function MoonPayAddCard({ onEvent, style }) {
|
|
|
1313
1331
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1314
1332
|
function MoonPayApplePayButton({
|
|
1315
1333
|
quote,
|
|
1334
|
+
externalTransactionId,
|
|
1316
1335
|
onEvent,
|
|
1317
1336
|
style
|
|
1318
1337
|
}) {
|
|
@@ -1320,7 +1339,7 @@ function MoonPayApplePayButton({
|
|
|
1320
1339
|
MoonPayFrameView,
|
|
1321
1340
|
{
|
|
1322
1341
|
spec: applePaySpec,
|
|
1323
|
-
props: { quote },
|
|
1342
|
+
props: { quote, externalTransactionId },
|
|
1324
1343
|
style,
|
|
1325
1344
|
defaultStyle: { height: 48 },
|
|
1326
1345
|
onEvent
|
|
@@ -1345,12 +1364,17 @@ function MoonPayAuth({ onEvent, style }) {
|
|
|
1345
1364
|
|
|
1346
1365
|
// src/components/buy-button.tsx
|
|
1347
1366
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1348
|
-
function MoonPayBuyButton({
|
|
1367
|
+
function MoonPayBuyButton({
|
|
1368
|
+
quote,
|
|
1369
|
+
externalTransactionId,
|
|
1370
|
+
onEvent,
|
|
1371
|
+
style
|
|
1372
|
+
}) {
|
|
1349
1373
|
return /* @__PURE__ */ jsx8(
|
|
1350
1374
|
MoonPayFrameView,
|
|
1351
1375
|
{
|
|
1352
1376
|
spec: buyButtonSpec,
|
|
1353
|
-
props: { quote },
|
|
1377
|
+
props: { quote, externalTransactionId },
|
|
1354
1378
|
style,
|
|
1355
1379
|
defaultStyle: { height: 48 },
|
|
1356
1380
|
onEvent
|
|
@@ -1466,12 +1490,17 @@ function MoonPayGooglePayButton({
|
|
|
1466
1490
|
|
|
1467
1491
|
// src/components/widget.tsx
|
|
1468
1492
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1469
|
-
function MoonPayWidget({
|
|
1493
|
+
function MoonPayWidget({
|
|
1494
|
+
quote,
|
|
1495
|
+
externalTransactionId,
|
|
1496
|
+
onEvent,
|
|
1497
|
+
style
|
|
1498
|
+
}) {
|
|
1470
1499
|
return /* @__PURE__ */ jsx16(
|
|
1471
1500
|
MoonPayFrameView,
|
|
1472
1501
|
{
|
|
1473
1502
|
spec: widgetSpec,
|
|
1474
|
-
props: { quote },
|
|
1503
|
+
props: { quote, externalTransactionId },
|
|
1475
1504
|
style,
|
|
1476
1505
|
defaultStyle: { flex: 1 },
|
|
1477
1506
|
onEvent
|