@moonpay/platform-sdk-react-native 1.10.0 → 1.11.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 +60 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +62 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -71,7 +71,8 @@ var applePaySpec = {
|
|
|
71
71
|
buildParams: (ctx, props) => ({
|
|
72
72
|
clientToken: ctx.core.context.clientToken,
|
|
73
73
|
signature: props.quote,
|
|
74
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
74
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
75
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
75
76
|
}),
|
|
76
77
|
createCommands: createQuoteCommands,
|
|
77
78
|
reactiveProps: {
|
|
@@ -114,7 +115,8 @@ var googlePaySpec = {
|
|
|
114
115
|
buildParams: (ctx, props) => ({
|
|
115
116
|
clientToken: ctx.core.context.clientToken,
|
|
116
117
|
signature: props.quote,
|
|
117
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
118
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
119
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
118
120
|
}),
|
|
119
121
|
createCommands: createQuoteCommands,
|
|
120
122
|
reactiveProps: {
|
|
@@ -157,7 +159,8 @@ var buyButtonSpec = {
|
|
|
157
159
|
buildParams: (ctx, props) => ({
|
|
158
160
|
clientToken: ctx.core.context.clientToken,
|
|
159
161
|
signature: props.quote,
|
|
160
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
162
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
163
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
161
164
|
}),
|
|
162
165
|
createCommands: createQuoteCommands,
|
|
163
166
|
reactiveProps: {
|
|
@@ -234,13 +237,22 @@ var connectSpec = {
|
|
|
234
237
|
path: import_platform_sdk_core.FRAME_PATHS.connect,
|
|
235
238
|
hidden: false,
|
|
236
239
|
needsKeyPair: true,
|
|
237
|
-
buildParams: (ctx, props, publicKey) =>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
buildParams: (ctx, props, publicKey) => {
|
|
241
|
+
const clientToken = ctx.core.context.clientToken;
|
|
242
|
+
if (!clientToken) {
|
|
243
|
+
throw new Error(
|
|
244
|
+
'No clientToken in context \u2014 call getConnection() first and ensure it resolved with status "connectionRequired".'
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
clientToken,
|
|
249
|
+
publicKey,
|
|
250
|
+
// Per-call override; `applyThemeParam` in the engine fills the client
|
|
251
|
+
// default for connect (and every other visible frame) when this is absent.
|
|
252
|
+
...(0, import_platform_sdk_core.themeParams)(props.theme),
|
|
253
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
254
|
+
};
|
|
255
|
+
},
|
|
244
256
|
onMessageEffect: applyCredentialsOnComplete,
|
|
245
257
|
mapMessage: (msg) => {
|
|
246
258
|
switch (msg.kind) {
|
|
@@ -264,14 +276,14 @@ var authSpec = {
|
|
|
264
276
|
path: import_platform_sdk_core.FRAME_PATHS.auth,
|
|
265
277
|
hidden: false,
|
|
266
278
|
needsKeyPair: true,
|
|
267
|
-
buildParams: (ctx,
|
|
279
|
+
buildParams: (ctx, props, publicKey) => {
|
|
268
280
|
const clientToken = ctx.core.context.clientToken;
|
|
269
281
|
if (!clientToken) {
|
|
270
282
|
throw new Error(
|
|
271
283
|
'No clientToken in context \u2014 call getConnection() first and ensure it resolved with status "connectionRequired".'
|
|
272
284
|
);
|
|
273
285
|
}
|
|
274
|
-
return { clientToken, publicKey };
|
|
286
|
+
return { clientToken, publicKey, ...(0, import_platform_sdk_core.presentationParams)(props.presentation) };
|
|
275
287
|
},
|
|
276
288
|
onMessageEffect: applyCredentialsOnComplete,
|
|
277
289
|
mapMessage: (msg) => {
|
|
@@ -304,7 +316,8 @@ var widgetSpec = {
|
|
|
304
316
|
flow: "buy",
|
|
305
317
|
clientToken: ctx.core.context.clientToken,
|
|
306
318
|
quoteSignature: props.quote,
|
|
307
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
319
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
320
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
308
321
|
}),
|
|
309
322
|
mapMessage: (msg) => {
|
|
310
323
|
switch (msg.kind) {
|
|
@@ -366,7 +379,10 @@ var addCardSpec = {
|
|
|
366
379
|
channelPrefix: "add-card",
|
|
367
380
|
path: import_platform_sdk_core.FRAME_PATHS.addCard,
|
|
368
381
|
hidden: false,
|
|
369
|
-
buildParams: (ctx) => ({
|
|
382
|
+
buildParams: (ctx, props) => ({
|
|
383
|
+
clientToken: ctx.core.context.clientToken,
|
|
384
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
385
|
+
}),
|
|
370
386
|
mapMessage: (msg) => {
|
|
371
387
|
switch (msg.kind) {
|
|
372
388
|
case "ready":
|
|
@@ -391,7 +407,10 @@ var customerExportSpec = {
|
|
|
391
407
|
channelPrefix: "customer-export",
|
|
392
408
|
path: import_platform_sdk_core.FRAME_PATHS.customerExport,
|
|
393
409
|
hidden: false,
|
|
394
|
-
buildParams: (ctx) => ({
|
|
410
|
+
buildParams: (ctx, props) => ({
|
|
411
|
+
clientToken: ctx.core.context.clientToken,
|
|
412
|
+
...(0, import_platform_sdk_core.presentationParams)(props.presentation)
|
|
413
|
+
}),
|
|
395
414
|
mapMessage: (msg) => {
|
|
396
415
|
switch (msg.kind) {
|
|
397
416
|
case "ready":
|
|
@@ -423,7 +442,7 @@ var challengeSpec = {
|
|
|
423
442
|
buildUrl: (_ctx, props, channelId) => {
|
|
424
443
|
const url = new URL(props.url);
|
|
425
444
|
url.searchParams.set("channelId", channelId);
|
|
426
|
-
return url.toString();
|
|
445
|
+
return (0, import_platform_sdk_core.applyPresentationParam)(url.toString(), props.presentation);
|
|
427
446
|
},
|
|
428
447
|
mapMessage: (msg) => {
|
|
429
448
|
switch (msg.kind) {
|
|
@@ -668,7 +687,9 @@ var import_react3 = require("react");
|
|
|
668
687
|
var import_result = require("@moonpay/platform-protocol/result");
|
|
669
688
|
async function setupAddCard(deps, opts) {
|
|
670
689
|
try {
|
|
671
|
-
const { handle, dispose } = await deps.mountSession(addCardSpec, {
|
|
690
|
+
const { handle, dispose } = await deps.mountSession(addCardSpec, {
|
|
691
|
+
presentation: opts.presentation
|
|
692
|
+
});
|
|
672
693
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
673
694
|
return (0, import_result.ok)({ dispose });
|
|
674
695
|
} catch (e) {
|
|
@@ -685,7 +706,8 @@ async function setupApplePay(deps, opts) {
|
|
|
685
706
|
try {
|
|
686
707
|
const { handle, dispose } = await deps.mountSession(applePaySpec, {
|
|
687
708
|
quote: opts.quote,
|
|
688
|
-
externalTransactionId: opts.externalTransactionId
|
|
709
|
+
externalTransactionId: opts.externalTransactionId,
|
|
710
|
+
presentation: opts.presentation
|
|
689
711
|
});
|
|
690
712
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
691
713
|
return (0, import_result2.ok)({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -707,7 +729,9 @@ async function setupAuth(deps, opts) {
|
|
|
707
729
|
});
|
|
708
730
|
}
|
|
709
731
|
try {
|
|
710
|
-
const { handle, dispose } = await deps.mountSession(authSpec, {
|
|
732
|
+
const { handle, dispose } = await deps.mountSession(authSpec, {
|
|
733
|
+
presentation: opts.presentation
|
|
734
|
+
});
|
|
711
735
|
return await new Promise((resolve) => {
|
|
712
736
|
handle.onEvent((event) => {
|
|
713
737
|
opts.onEvent?.(event);
|
|
@@ -760,7 +784,8 @@ async function setupBuyButton(deps, opts) {
|
|
|
760
784
|
try {
|
|
761
785
|
const { handle, dispose } = await deps.mountSession(buyButtonSpec, {
|
|
762
786
|
quote: opts.quote,
|
|
763
|
-
externalTransactionId: opts.externalTransactionId
|
|
787
|
+
externalTransactionId: opts.externalTransactionId,
|
|
788
|
+
presentation: opts.presentation
|
|
764
789
|
});
|
|
765
790
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
766
791
|
return (0, import_result5.ok)({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -783,7 +808,10 @@ async function setupChallenge(deps, opts) {
|
|
|
783
808
|
});
|
|
784
809
|
}
|
|
785
810
|
try {
|
|
786
|
-
const { handle, dispose } = await deps.mountSession(challengeSpec, {
|
|
811
|
+
const { handle, dispose } = await deps.mountSession(challengeSpec, {
|
|
812
|
+
url: opts.url,
|
|
813
|
+
presentation: opts.presentation
|
|
814
|
+
});
|
|
787
815
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
788
816
|
return (0, import_result6.ok)({ dispose });
|
|
789
817
|
} catch (e) {
|
|
@@ -798,7 +826,10 @@ async function setupChallenge(deps, opts) {
|
|
|
798
826
|
var import_result7 = require("@moonpay/platform-protocol/result");
|
|
799
827
|
async function connect(deps, opts) {
|
|
800
828
|
try {
|
|
801
|
-
const { handle, dispose } = await deps.mountSession(connectSpec, {
|
|
829
|
+
const { handle, dispose } = await deps.mountSession(connectSpec, {
|
|
830
|
+
theme: opts.theme,
|
|
831
|
+
presentation: opts.presentation
|
|
832
|
+
});
|
|
802
833
|
return await new Promise((resolve) => {
|
|
803
834
|
handle.onEvent((event) => {
|
|
804
835
|
opts.onEvent?.(event);
|
|
@@ -875,7 +906,9 @@ async function resetConnection(deps) {
|
|
|
875
906
|
var import_result10 = require("@moonpay/platform-protocol/result");
|
|
876
907
|
async function setupCustomerExport(deps, opts) {
|
|
877
908
|
try {
|
|
878
|
-
const { handle, dispose } = await deps.mountSession(customerExportSpec, {
|
|
909
|
+
const { handle, dispose } = await deps.mountSession(customerExportSpec, {
|
|
910
|
+
presentation: opts.presentation
|
|
911
|
+
});
|
|
879
912
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
880
913
|
return (0, import_result10.ok)({ dispose });
|
|
881
914
|
} catch (e) {
|
|
@@ -892,7 +925,8 @@ async function setupGooglePay(deps, opts) {
|
|
|
892
925
|
try {
|
|
893
926
|
const { handle, dispose } = await deps.mountSession(googlePaySpec, {
|
|
894
927
|
quote: opts.quote,
|
|
895
|
-
externalTransactionId: opts.externalTransactionId
|
|
928
|
+
externalTransactionId: opts.externalTransactionId,
|
|
929
|
+
presentation: opts.presentation
|
|
896
930
|
});
|
|
897
931
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
898
932
|
return (0, import_result11.ok)({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -910,7 +944,8 @@ async function setupWidget(deps, opts) {
|
|
|
910
944
|
try {
|
|
911
945
|
const { handle, dispose } = await deps.mountSession(widgetSpec, {
|
|
912
946
|
quote: opts.quote,
|
|
913
|
-
externalTransactionId: opts.externalTransactionId
|
|
947
|
+
externalTransactionId: opts.externalTransactionId,
|
|
948
|
+
presentation: opts.presentation
|
|
914
949
|
});
|
|
915
950
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
916
951
|
return (0, import_result12.ok)({ dispose });
|