@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.d.cts
CHANGED
|
@@ -28,7 +28,7 @@ import * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';
|
|
|
28
28
|
export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moonpay/platform-protocol/sdks/google-pay';
|
|
29
29
|
import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
|
|
30
30
|
export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
31
|
-
import { FrameTransport, FrameOptions, ThemeOptions, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
31
|
+
import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
32
32
|
export { ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
33
33
|
import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
|
|
34
34
|
import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
@@ -73,6 +73,8 @@ declare class WebViewTransport implements RNFrameTransport {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
interface SetupAddCardOptions {
|
|
76
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
77
|
+
presentation?: PresentationMode;
|
|
76
78
|
/** Callback for add-card frame lifecycle events. */
|
|
77
79
|
onEvent?: (event: AddCardSdk.Event) => void;
|
|
78
80
|
}
|
|
@@ -85,6 +87,8 @@ interface SetupApplePayOptions {
|
|
|
85
87
|
quote: string;
|
|
86
88
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
87
89
|
externalTransactionId?: string;
|
|
90
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
91
|
+
presentation?: PresentationMode;
|
|
88
92
|
/** Callback for Apple Pay lifecycle events. */
|
|
89
93
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
90
94
|
}
|
|
@@ -95,6 +99,8 @@ interface ApplePayFrame {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
interface SetupAuthOptions {
|
|
102
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
103
|
+
presentation?: PresentationMode;
|
|
98
104
|
/** Callback for auth frame lifecycle events. */
|
|
99
105
|
onEvent?: (event: AuthSdk.Event) => void;
|
|
100
106
|
}
|
|
@@ -121,6 +127,8 @@ interface SetupBuyButtonOptions {
|
|
|
121
127
|
quote: string;
|
|
122
128
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
123
129
|
externalTransactionId?: string;
|
|
130
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
131
|
+
presentation?: PresentationMode;
|
|
124
132
|
/** Callback for buy-button frame lifecycle events. */
|
|
125
133
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
126
134
|
}
|
|
@@ -133,6 +141,8 @@ interface BuyButtonFrame {
|
|
|
133
141
|
interface SetupChallengeOptions {
|
|
134
142
|
/** Full challenge URL received from a frame's `challenge` event. */
|
|
135
143
|
url: string;
|
|
144
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
145
|
+
presentation?: PresentationMode;
|
|
136
146
|
/** Callback for challenge frame lifecycle events. */
|
|
137
147
|
onEvent?: (event: ChallengeSdk.Event) => void;
|
|
138
148
|
}
|
|
@@ -143,6 +153,8 @@ interface ChallengeFrame {
|
|
|
143
153
|
interface ConnectOptions {
|
|
144
154
|
/** Theme for this connect frame. Overrides the provider-level `theme`. */
|
|
145
155
|
theme?: ThemeOptions;
|
|
156
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
157
|
+
presentation?: PresentationMode;
|
|
146
158
|
/** Callback for connect lifecycle events. */
|
|
147
159
|
onEvent?: (event: ConnectSdk.Event) => void;
|
|
148
160
|
}
|
|
@@ -160,6 +172,8 @@ interface GetConnectionOptions {
|
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
interface SetupCustomerExportOptions {
|
|
175
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
176
|
+
presentation?: PresentationMode;
|
|
163
177
|
/** Callback for customer-export frame lifecycle events. */
|
|
164
178
|
onEvent?: (event: CustomerExportSdk.Event) => void;
|
|
165
179
|
}
|
|
@@ -172,6 +186,8 @@ interface SetupGooglePayOptions {
|
|
|
172
186
|
quote: string;
|
|
173
187
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
174
188
|
externalTransactionId?: string;
|
|
189
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
190
|
+
presentation?: PresentationMode;
|
|
175
191
|
/** Callback for Google Pay lifecycle events. */
|
|
176
192
|
onEvent?: (event: GooglePaySdk.Event) => void;
|
|
177
193
|
}
|
|
@@ -186,6 +202,8 @@ interface SetupWidgetOptions {
|
|
|
186
202
|
quote: string;
|
|
187
203
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
188
204
|
externalTransactionId?: string;
|
|
205
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
206
|
+
presentation?: PresentationMode;
|
|
189
207
|
/** Callback for widget lifecycle events. */
|
|
190
208
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
191
209
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';
|
|
|
28
28
|
export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moonpay/platform-protocol/sdks/google-pay';
|
|
29
29
|
import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
|
|
30
30
|
export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
31
|
-
import { FrameTransport, FrameOptions, ThemeOptions, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
31
|
+
import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
32
32
|
export { ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
33
33
|
import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
|
|
34
34
|
import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
@@ -73,6 +73,8 @@ declare class WebViewTransport implements RNFrameTransport {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
interface SetupAddCardOptions {
|
|
76
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
77
|
+
presentation?: PresentationMode;
|
|
76
78
|
/** Callback for add-card frame lifecycle events. */
|
|
77
79
|
onEvent?: (event: AddCardSdk.Event) => void;
|
|
78
80
|
}
|
|
@@ -85,6 +87,8 @@ interface SetupApplePayOptions {
|
|
|
85
87
|
quote: string;
|
|
86
88
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
87
89
|
externalTransactionId?: string;
|
|
90
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
91
|
+
presentation?: PresentationMode;
|
|
88
92
|
/** Callback for Apple Pay lifecycle events. */
|
|
89
93
|
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
90
94
|
}
|
|
@@ -95,6 +99,8 @@ interface ApplePayFrame {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
interface SetupAuthOptions {
|
|
102
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
103
|
+
presentation?: PresentationMode;
|
|
98
104
|
/** Callback for auth frame lifecycle events. */
|
|
99
105
|
onEvent?: (event: AuthSdk.Event) => void;
|
|
100
106
|
}
|
|
@@ -121,6 +127,8 @@ interface SetupBuyButtonOptions {
|
|
|
121
127
|
quote: string;
|
|
122
128
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
123
129
|
externalTransactionId?: string;
|
|
130
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
131
|
+
presentation?: PresentationMode;
|
|
124
132
|
/** Callback for buy-button frame lifecycle events. */
|
|
125
133
|
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
126
134
|
}
|
|
@@ -133,6 +141,8 @@ interface BuyButtonFrame {
|
|
|
133
141
|
interface SetupChallengeOptions {
|
|
134
142
|
/** Full challenge URL received from a frame's `challenge` event. */
|
|
135
143
|
url: string;
|
|
144
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
145
|
+
presentation?: PresentationMode;
|
|
136
146
|
/** Callback for challenge frame lifecycle events. */
|
|
137
147
|
onEvent?: (event: ChallengeSdk.Event) => void;
|
|
138
148
|
}
|
|
@@ -143,6 +153,8 @@ interface ChallengeFrame {
|
|
|
143
153
|
interface ConnectOptions {
|
|
144
154
|
/** Theme for this connect frame. Overrides the provider-level `theme`. */
|
|
145
155
|
theme?: ThemeOptions;
|
|
156
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
157
|
+
presentation?: PresentationMode;
|
|
146
158
|
/** Callback for connect lifecycle events. */
|
|
147
159
|
onEvent?: (event: ConnectSdk.Event) => void;
|
|
148
160
|
}
|
|
@@ -160,6 +172,8 @@ interface GetConnectionOptions {
|
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
interface SetupCustomerExportOptions {
|
|
175
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
176
|
+
presentation?: PresentationMode;
|
|
163
177
|
/** Callback for customer-export frame lifecycle events. */
|
|
164
178
|
onEvent?: (event: CustomerExportSdk.Event) => void;
|
|
165
179
|
}
|
|
@@ -172,6 +186,8 @@ interface SetupGooglePayOptions {
|
|
|
172
186
|
quote: string;
|
|
173
187
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
174
188
|
externalTransactionId?: string;
|
|
189
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
190
|
+
presentation?: PresentationMode;
|
|
175
191
|
/** Callback for Google Pay lifecycle events. */
|
|
176
192
|
onEvent?: (event: GooglePaySdk.Event) => void;
|
|
177
193
|
}
|
|
@@ -186,6 +202,8 @@ interface SetupWidgetOptions {
|
|
|
186
202
|
quote: string;
|
|
187
203
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
188
204
|
externalTransactionId?: string;
|
|
205
|
+
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
206
|
+
presentation?: PresentationMode;
|
|
189
207
|
/** Callback for widget lifecycle events. */
|
|
190
208
|
onEvent?: (event: WidgetSdk.Event) => void;
|
|
191
209
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
ConnectionStatus
|
|
8
8
|
} from "@moonpay/platform-protocol/models/connection";
|
|
9
9
|
import {
|
|
10
|
+
applyPresentationParam,
|
|
10
11
|
decryptCredentials,
|
|
11
12
|
FRAME_PATHS,
|
|
13
|
+
presentationParams,
|
|
12
14
|
themeParams
|
|
13
15
|
} from "@moonpay/platform-sdk-core";
|
|
14
16
|
function createQuoteCommands(send, channelId) {
|
|
@@ -28,7 +30,8 @@ var applePaySpec = {
|
|
|
28
30
|
buildParams: (ctx, props) => ({
|
|
29
31
|
clientToken: ctx.core.context.clientToken,
|
|
30
32
|
signature: props.quote,
|
|
31
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
33
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
34
|
+
...presentationParams(props.presentation)
|
|
32
35
|
}),
|
|
33
36
|
createCommands: createQuoteCommands,
|
|
34
37
|
reactiveProps: {
|
|
@@ -71,7 +74,8 @@ var googlePaySpec = {
|
|
|
71
74
|
buildParams: (ctx, props) => ({
|
|
72
75
|
clientToken: ctx.core.context.clientToken,
|
|
73
76
|
signature: props.quote,
|
|
74
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
77
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
78
|
+
...presentationParams(props.presentation)
|
|
75
79
|
}),
|
|
76
80
|
createCommands: createQuoteCommands,
|
|
77
81
|
reactiveProps: {
|
|
@@ -114,7 +118,8 @@ var buyButtonSpec = {
|
|
|
114
118
|
buildParams: (ctx, props) => ({
|
|
115
119
|
clientToken: ctx.core.context.clientToken,
|
|
116
120
|
signature: props.quote,
|
|
117
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
121
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
122
|
+
...presentationParams(props.presentation)
|
|
118
123
|
}),
|
|
119
124
|
createCommands: createQuoteCommands,
|
|
120
125
|
reactiveProps: {
|
|
@@ -191,13 +196,22 @@ var connectSpec = {
|
|
|
191
196
|
path: FRAME_PATHS.connect,
|
|
192
197
|
hidden: false,
|
|
193
198
|
needsKeyPair: true,
|
|
194
|
-
buildParams: (ctx, props, publicKey) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
buildParams: (ctx, props, publicKey) => {
|
|
200
|
+
const clientToken = ctx.core.context.clientToken;
|
|
201
|
+
if (!clientToken) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
'No clientToken in context \u2014 call getConnection() first and ensure it resolved with status "connectionRequired".'
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
clientToken,
|
|
208
|
+
publicKey,
|
|
209
|
+
// Per-call override; `applyThemeParam` in the engine fills the client
|
|
210
|
+
// default for connect (and every other visible frame) when this is absent.
|
|
211
|
+
...themeParams(props.theme),
|
|
212
|
+
...presentationParams(props.presentation)
|
|
213
|
+
};
|
|
214
|
+
},
|
|
201
215
|
onMessageEffect: applyCredentialsOnComplete,
|
|
202
216
|
mapMessage: (msg) => {
|
|
203
217
|
switch (msg.kind) {
|
|
@@ -221,14 +235,14 @@ var authSpec = {
|
|
|
221
235
|
path: FRAME_PATHS.auth,
|
|
222
236
|
hidden: false,
|
|
223
237
|
needsKeyPair: true,
|
|
224
|
-
buildParams: (ctx,
|
|
238
|
+
buildParams: (ctx, props, publicKey) => {
|
|
225
239
|
const clientToken = ctx.core.context.clientToken;
|
|
226
240
|
if (!clientToken) {
|
|
227
241
|
throw new Error(
|
|
228
242
|
'No clientToken in context \u2014 call getConnection() first and ensure it resolved with status "connectionRequired".'
|
|
229
243
|
);
|
|
230
244
|
}
|
|
231
|
-
return { clientToken, publicKey };
|
|
245
|
+
return { clientToken, publicKey, ...presentationParams(props.presentation) };
|
|
232
246
|
},
|
|
233
247
|
onMessageEffect: applyCredentialsOnComplete,
|
|
234
248
|
mapMessage: (msg) => {
|
|
@@ -261,7 +275,8 @@ var widgetSpec = {
|
|
|
261
275
|
flow: "buy",
|
|
262
276
|
clientToken: ctx.core.context.clientToken,
|
|
263
277
|
quoteSignature: props.quote,
|
|
264
|
-
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId }
|
|
278
|
+
...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
|
|
279
|
+
...presentationParams(props.presentation)
|
|
265
280
|
}),
|
|
266
281
|
mapMessage: (msg) => {
|
|
267
282
|
switch (msg.kind) {
|
|
@@ -323,7 +338,10 @@ var addCardSpec = {
|
|
|
323
338
|
channelPrefix: "add-card",
|
|
324
339
|
path: FRAME_PATHS.addCard,
|
|
325
340
|
hidden: false,
|
|
326
|
-
buildParams: (ctx) => ({
|
|
341
|
+
buildParams: (ctx, props) => ({
|
|
342
|
+
clientToken: ctx.core.context.clientToken,
|
|
343
|
+
...presentationParams(props.presentation)
|
|
344
|
+
}),
|
|
327
345
|
mapMessage: (msg) => {
|
|
328
346
|
switch (msg.kind) {
|
|
329
347
|
case "ready":
|
|
@@ -348,7 +366,10 @@ var customerExportSpec = {
|
|
|
348
366
|
channelPrefix: "customer-export",
|
|
349
367
|
path: FRAME_PATHS.customerExport,
|
|
350
368
|
hidden: false,
|
|
351
|
-
buildParams: (ctx) => ({
|
|
369
|
+
buildParams: (ctx, props) => ({
|
|
370
|
+
clientToken: ctx.core.context.clientToken,
|
|
371
|
+
...presentationParams(props.presentation)
|
|
372
|
+
}),
|
|
352
373
|
mapMessage: (msg) => {
|
|
353
374
|
switch (msg.kind) {
|
|
354
375
|
case "ready":
|
|
@@ -380,7 +401,7 @@ var challengeSpec = {
|
|
|
380
401
|
buildUrl: (_ctx, props, channelId) => {
|
|
381
402
|
const url = new URL(props.url);
|
|
382
403
|
url.searchParams.set("channelId", channelId);
|
|
383
|
-
return url.toString();
|
|
404
|
+
return applyPresentationParam(url.toString(), props.presentation);
|
|
384
405
|
},
|
|
385
406
|
mapMessage: (msg) => {
|
|
386
407
|
switch (msg.kind) {
|
|
@@ -639,7 +660,9 @@ import {
|
|
|
639
660
|
import { err, ok } from "@moonpay/platform-protocol/result";
|
|
640
661
|
async function setupAddCard(deps, opts) {
|
|
641
662
|
try {
|
|
642
|
-
const { handle, dispose } = await deps.mountSession(addCardSpec, {
|
|
663
|
+
const { handle, dispose } = await deps.mountSession(addCardSpec, {
|
|
664
|
+
presentation: opts.presentation
|
|
665
|
+
});
|
|
643
666
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
644
667
|
return ok({ dispose });
|
|
645
668
|
} catch (e) {
|
|
@@ -656,7 +679,8 @@ async function setupApplePay(deps, opts) {
|
|
|
656
679
|
try {
|
|
657
680
|
const { handle, dispose } = await deps.mountSession(applePaySpec, {
|
|
658
681
|
quote: opts.quote,
|
|
659
|
-
externalTransactionId: opts.externalTransactionId
|
|
682
|
+
externalTransactionId: opts.externalTransactionId,
|
|
683
|
+
presentation: opts.presentation
|
|
660
684
|
});
|
|
661
685
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
662
686
|
return ok2({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -678,7 +702,9 @@ async function setupAuth(deps, opts) {
|
|
|
678
702
|
});
|
|
679
703
|
}
|
|
680
704
|
try {
|
|
681
|
-
const { handle, dispose } = await deps.mountSession(authSpec, {
|
|
705
|
+
const { handle, dispose } = await deps.mountSession(authSpec, {
|
|
706
|
+
presentation: opts.presentation
|
|
707
|
+
});
|
|
682
708
|
return await new Promise((resolve) => {
|
|
683
709
|
handle.onEvent((event) => {
|
|
684
710
|
opts.onEvent?.(event);
|
|
@@ -731,7 +757,8 @@ async function setupBuyButton(deps, opts) {
|
|
|
731
757
|
try {
|
|
732
758
|
const { handle, dispose } = await deps.mountSession(buyButtonSpec, {
|
|
733
759
|
quote: opts.quote,
|
|
734
|
-
externalTransactionId: opts.externalTransactionId
|
|
760
|
+
externalTransactionId: opts.externalTransactionId,
|
|
761
|
+
presentation: opts.presentation
|
|
735
762
|
});
|
|
736
763
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
737
764
|
return ok5({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -754,7 +781,10 @@ async function setupChallenge(deps, opts) {
|
|
|
754
781
|
});
|
|
755
782
|
}
|
|
756
783
|
try {
|
|
757
|
-
const { handle, dispose } = await deps.mountSession(challengeSpec, {
|
|
784
|
+
const { handle, dispose } = await deps.mountSession(challengeSpec, {
|
|
785
|
+
url: opts.url,
|
|
786
|
+
presentation: opts.presentation
|
|
787
|
+
});
|
|
758
788
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
759
789
|
return ok6({ dispose });
|
|
760
790
|
} catch (e) {
|
|
@@ -769,7 +799,10 @@ async function setupChallenge(deps, opts) {
|
|
|
769
799
|
import { err as err7, ok as ok7 } from "@moonpay/platform-protocol/result";
|
|
770
800
|
async function connect(deps, opts) {
|
|
771
801
|
try {
|
|
772
|
-
const { handle, dispose } = await deps.mountSession(connectSpec, {
|
|
802
|
+
const { handle, dispose } = await deps.mountSession(connectSpec, {
|
|
803
|
+
theme: opts.theme,
|
|
804
|
+
presentation: opts.presentation
|
|
805
|
+
});
|
|
773
806
|
return await new Promise((resolve) => {
|
|
774
807
|
handle.onEvent((event) => {
|
|
775
808
|
opts.onEvent?.(event);
|
|
@@ -846,7 +879,9 @@ async function resetConnection(deps) {
|
|
|
846
879
|
import { err as err9, ok as ok10 } from "@moonpay/platform-protocol/result";
|
|
847
880
|
async function setupCustomerExport(deps, opts) {
|
|
848
881
|
try {
|
|
849
|
-
const { handle, dispose } = await deps.mountSession(customerExportSpec, {
|
|
882
|
+
const { handle, dispose } = await deps.mountSession(customerExportSpec, {
|
|
883
|
+
presentation: opts.presentation
|
|
884
|
+
});
|
|
850
885
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
851
886
|
return ok10({ dispose });
|
|
852
887
|
} catch (e) {
|
|
@@ -863,7 +898,8 @@ async function setupGooglePay(deps, opts) {
|
|
|
863
898
|
try {
|
|
864
899
|
const { handle, dispose } = await deps.mountSession(googlePaySpec, {
|
|
865
900
|
quote: opts.quote,
|
|
866
|
-
externalTransactionId: opts.externalTransactionId
|
|
901
|
+
externalTransactionId: opts.externalTransactionId,
|
|
902
|
+
presentation: opts.presentation
|
|
867
903
|
});
|
|
868
904
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
869
905
|
return ok11({ setQuote: handle.commands.setQuote, dispose });
|
|
@@ -881,7 +917,8 @@ async function setupWidget(deps, opts) {
|
|
|
881
917
|
try {
|
|
882
918
|
const { handle, dispose } = await deps.mountSession(widgetSpec, {
|
|
883
919
|
quote: opts.quote,
|
|
884
|
-
externalTransactionId: opts.externalTransactionId
|
|
920
|
+
externalTransactionId: opts.externalTransactionId,
|
|
921
|
+
presentation: opts.presentation
|
|
885
922
|
});
|
|
886
923
|
handle.onEvent((event) => opts.onEvent?.(event));
|
|
887
924
|
return ok12({ dispose });
|