@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 CHANGED
@@ -70,7 +70,8 @@ var applePaySpec = {
70
70
  hidden: false,
71
71
  buildParams: (ctx, props) => ({
72
72
  clientToken: ctx.core.context.clientToken,
73
- signature: props.quote
73
+ signature: props.quote,
74
+ ...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
74
75
  }),
75
76
  createCommands: createQuoteCommands,
76
77
  reactiveProps: {
@@ -80,6 +81,8 @@ var applePaySpec = {
80
81
  switch (msg.kind) {
81
82
  case "ready":
82
83
  return { kind: "ready" };
84
+ case "buttonPressed":
85
+ return { kind: "buttonPressed" };
83
86
  case "complete":
84
87
  return { kind: "complete", payload: msg.payload };
85
88
  case "challenge":
@@ -121,6 +124,8 @@ var googlePaySpec = {
121
124
  switch (msg.kind) {
122
125
  case "ready":
123
126
  return { kind: "ready" };
127
+ case "buttonPressed":
128
+ return { kind: "buttonPressed" };
124
129
  case "complete":
125
130
  return { kind: "complete", payload: msg.payload };
126
131
  case "challenge":
@@ -151,7 +156,8 @@ var buyButtonSpec = {
151
156
  hidden: false,
152
157
  buildParams: (ctx, props) => ({
153
158
  clientToken: ctx.core.context.clientToken,
154
- signature: props.quote
159
+ signature: props.quote,
160
+ ...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
155
161
  }),
156
162
  createCommands: createQuoteCommands,
157
163
  reactiveProps: {
@@ -161,6 +167,8 @@ var buyButtonSpec = {
161
167
  switch (msg.kind) {
162
168
  case "ready":
163
169
  return { kind: "ready" };
170
+ case "buttonPressed":
171
+ return { kind: "buttonPressed" };
164
172
  case "complete":
165
173
  return { kind: "complete", payload: msg.payload };
166
174
  case "challenge":
@@ -287,7 +295,8 @@ var widgetSpec = {
287
295
  buildParams: (ctx, props) => ({
288
296
  flow: "buy",
289
297
  clientToken: ctx.core.context.clientToken,
290
- quoteSignature: props.quote
298
+ quoteSignature: props.quote,
299
+ ...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
291
300
  }),
292
301
  mapMessage: (msg) => {
293
302
  switch (msg.kind) {
@@ -666,7 +675,10 @@ async function setupAddCard(deps, opts) {
666
675
  var import_result2 = require("@moonpay/platform-protocol/result");
667
676
  async function setupApplePay(deps, opts) {
668
677
  try {
669
- const { handle, dispose } = await deps.mountSession(applePaySpec, { quote: opts.quote });
678
+ const { handle, dispose } = await deps.mountSession(applePaySpec, {
679
+ quote: opts.quote,
680
+ externalTransactionId: opts.externalTransactionId
681
+ });
670
682
  handle.onEvent((event) => opts.onEvent?.(event));
671
683
  return (0, import_result2.ok)({ setQuote: handle.commands.setQuote, dispose });
672
684
  } catch (e) {
@@ -738,7 +750,10 @@ async function setupBuy(deps, opts) {
738
750
  var import_result5 = require("@moonpay/platform-protocol/result");
739
751
  async function setupBuyButton(deps, opts) {
740
752
  try {
741
- const { handle, dispose } = await deps.mountSession(buyButtonSpec, { quote: opts.quote });
753
+ const { handle, dispose } = await deps.mountSession(buyButtonSpec, {
754
+ quote: opts.quote,
755
+ externalTransactionId: opts.externalTransactionId
756
+ });
742
757
  handle.onEvent((event) => opts.onEvent?.(event));
743
758
  return (0, import_result5.ok)({ setQuote: handle.commands.setQuote, dispose });
744
759
  } catch (e) {
@@ -885,7 +900,10 @@ async function setupGooglePay(deps, opts) {
885
900
  var import_result12 = require("@moonpay/platform-protocol/result");
886
901
  async function setupWidget(deps, opts) {
887
902
  try {
888
- const { handle, dispose } = await deps.mountSession(widgetSpec, { quote: opts.quote });
903
+ const { handle, dispose } = await deps.mountSession(widgetSpec, {
904
+ quote: opts.quote,
905
+ externalTransactionId: opts.externalTransactionId
906
+ });
889
907
  handle.onEvent((event) => opts.onEvent?.(event));
890
908
  return (0, import_result12.ok)({ dispose });
891
909
  } catch (e) {
@@ -1331,6 +1349,7 @@ function MoonPayAddCard({ onEvent, style }) {
1331
1349
  var import_jsx_runtime6 = require("react/jsx-runtime");
1332
1350
  function MoonPayApplePayButton({
1333
1351
  quote,
1352
+ externalTransactionId,
1334
1353
  onEvent,
1335
1354
  style
1336
1355
  }) {
@@ -1338,7 +1357,7 @@ function MoonPayApplePayButton({
1338
1357
  MoonPayFrameView,
1339
1358
  {
1340
1359
  spec: applePaySpec,
1341
- props: { quote },
1360
+ props: { quote, externalTransactionId },
1342
1361
  style,
1343
1362
  defaultStyle: { height: 48 },
1344
1363
  onEvent
@@ -1363,12 +1382,17 @@ function MoonPayAuth({ onEvent, style }) {
1363
1382
 
1364
1383
  // src/components/buy-button.tsx
1365
1384
  var import_jsx_runtime8 = require("react/jsx-runtime");
1366
- function MoonPayBuyButton({ quote, onEvent, style }) {
1385
+ function MoonPayBuyButton({
1386
+ quote,
1387
+ externalTransactionId,
1388
+ onEvent,
1389
+ style
1390
+ }) {
1367
1391
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1368
1392
  MoonPayFrameView,
1369
1393
  {
1370
1394
  spec: buyButtonSpec,
1371
- props: { quote },
1395
+ props: { quote, externalTransactionId },
1372
1396
  style,
1373
1397
  defaultStyle: { height: 48 },
1374
1398
  onEvent
@@ -1484,12 +1508,17 @@ function MoonPayGooglePayButton({
1484
1508
 
1485
1509
  // src/components/widget.tsx
1486
1510
  var import_jsx_runtime16 = require("react/jsx-runtime");
1487
- function MoonPayWidget({ quote, onEvent, style }) {
1511
+ function MoonPayWidget({
1512
+ quote,
1513
+ externalTransactionId,
1514
+ onEvent,
1515
+ style
1516
+ }) {
1488
1517
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1489
1518
  MoonPayFrameView,
1490
1519
  {
1491
1520
  spec: widgetSpec,
1492
- props: { quote },
1521
+ props: { quote, externalTransactionId },
1493
1522
  style,
1494
1523
  defaultStyle: { flex: 1 },
1495
1524
  onEvent