@moonpay/platform-sdk-react-native 0.3.0 → 1.0.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 +1060 -653
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +276 -82
- package/dist/index.d.ts +276 -82
- package/dist/index.js +1058 -665
- package/dist/index.js.map +1 -1
- package/package.json +9 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { ListPaymentMethodsResponse, GetQuoteParams, Quote, Transaction, PaginationInfo, TransactionWithStages } from '@moonpay/platform-protocol/api';
|
|
2
|
+
export { GetQuoteParams, ListPaymentMethodsResponse, PaginationInfo, PaymentMethodConfig, PaymentMethodType, Quote, StoredCardPaymentMethod, StoredPaymentMethod, Transaction, TransactionWithStages } from '@moonpay/platform-protocol/api';
|
|
3
|
+
export { CardResponse } from '@moonpay/platform-protocol/frames/add-card';
|
|
4
|
+
export { Cancellation as ChallengeCancellation, CompleteResult as ChallengeCompleteResult } from '@moonpay/platform-protocol/frames/challenge';
|
|
5
|
+
import { Connection } from '@moonpay/platform-protocol/models/connection';
|
|
6
|
+
export { Connection, ConnectionStatus } from '@moonpay/platform-protocol/models/connection';
|
|
7
|
+
import { Result } from '@moonpay/platform-protocol/result';
|
|
8
|
+
export { Result } from '@moonpay/platform-protocol/result';
|
|
9
|
+
import * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';
|
|
10
|
+
export { Event as AddCardEvent, SetupError as SetupAddCardError } from '@moonpay/platform-protocol/sdks/add-card';
|
|
11
|
+
import * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';
|
|
12
|
+
export { Event as ApplePayEvent, SetupError as SetupApplePayError } from '@moonpay/platform-protocol/sdks/apple-pay';
|
|
13
|
+
import * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';
|
|
14
|
+
export { Event as AuthEvent, SetupError as SetupAuthError } from '@moonpay/platform-protocol/sdks/auth';
|
|
15
|
+
import * as BuySdk from '@moonpay/platform-protocol/sdks/buy';
|
|
16
|
+
export { Event as BuyEvent, SetupError as SetupBuyError } from '@moonpay/platform-protocol/sdks/buy';
|
|
17
|
+
import * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';
|
|
18
|
+
export { Event as BuyButtonEvent, SetupError as SetupBuyButtonError } from '@moonpay/platform-protocol/sdks/buy-button';
|
|
19
|
+
import * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';
|
|
20
|
+
export { Event as ChallengeEvent, SetupError as SetupChallengeError } from '@moonpay/platform-protocol/sdks/challenge';
|
|
21
|
+
import * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';
|
|
22
|
+
export { Event as ConnectEvent } from '@moonpay/platform-protocol/sdks/connect';
|
|
23
|
+
import * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';
|
|
24
|
+
export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moonpay/platform-protocol/sdks/google-pay';
|
|
25
|
+
import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
|
|
26
|
+
export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
27
|
+
import { GetPaymentMethodsError, GetQuoteError, GetTransactionsError, DevPlatformApiError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
|
|
28
|
+
import { CreateIdentityRequestBody, Identity, UpdateIdentityRequestBody, IdentityVerificationResponse, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody } from '@moonpay/platform-protocol/api/identity';
|
|
29
|
+
import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';
|
|
4
30
|
import { FrameTransport, FrameOptions, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
31
|
+
import { ViewStyle } from 'react-native';
|
|
32
|
+
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
5
33
|
import { RefObject, ReactNode } from 'react';
|
|
6
34
|
import WebView from 'react-native-webview';
|
|
7
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Transport surface the RN SDK passes around internally. `WebViewTransport`
|
|
38
|
+
* is the production implementation; tests substitute fakes.
|
|
39
|
+
*/
|
|
40
|
+
interface RNFrameTransport extends FrameTransport {
|
|
41
|
+
readonly url: string;
|
|
42
|
+
readonly options: FrameOptions | null;
|
|
43
|
+
attachWebView(ref: RefObject<WebView | null>): void;
|
|
44
|
+
handleWebViewMessage(data: string): void;
|
|
45
|
+
}
|
|
8
46
|
/**
|
|
9
47
|
* FrameTransport implementation for React Native using react-native-webview.
|
|
10
48
|
*
|
|
@@ -12,7 +50,7 @@ import WebView from 'react-native-webview';
|
|
|
12
50
|
* React components. This transport bridges the imperative FrameTransport
|
|
13
51
|
* interface to a WebView ref.
|
|
14
52
|
*/
|
|
15
|
-
declare class WebViewTransport implements
|
|
53
|
+
declare class WebViewTransport implements RNFrameTransport {
|
|
16
54
|
private webViewRef;
|
|
17
55
|
private handlers;
|
|
18
56
|
private _url;
|
|
@@ -29,122 +67,118 @@ declare class WebViewTransport implements FrameTransport {
|
|
|
29
67
|
dispose(): void;
|
|
30
68
|
}
|
|
31
69
|
|
|
32
|
-
interface
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/** Whether this is a hidden utility frame (zero height). */
|
|
36
|
-
hidden?: boolean;
|
|
37
|
-
/** Optional style overrides for the container view. */
|
|
38
|
-
style?: ViewStyle;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Reusable React Native component that renders a MoonPay frame as a WebView.
|
|
42
|
-
* Bridges the WebViewTransport to the actual WebView instance.
|
|
43
|
-
*/
|
|
44
|
-
declare function MoonPayFrame({ transport, hidden, style }: MoonPayFrameProps): JSX.Element | null;
|
|
45
|
-
|
|
46
|
-
interface GetConnectionOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Pass `true` for headless / Identity-API integrations so the check
|
|
49
|
-
* frame opts out of KYC-based statuses. Legal (`termsAcceptanceRequired`)
|
|
50
|
-
* is always surfaced regardless. Defaults to `false`.
|
|
51
|
-
*/
|
|
52
|
-
skipKyc?: boolean;
|
|
53
|
-
}
|
|
54
|
-
interface ConnectOptions {
|
|
55
|
-
/** Theme options for the connect frame. */
|
|
56
|
-
theme?: {
|
|
57
|
-
appearance?: 'light' | 'dark';
|
|
58
|
-
};
|
|
59
|
-
/** Callback for connect lifecycle events. */
|
|
60
|
-
onEvent?: (event: ConnectEvent) => void;
|
|
61
|
-
}
|
|
62
|
-
interface ConnectFrame {
|
|
63
|
-
dispose(): void;
|
|
64
|
-
}
|
|
65
|
-
interface SetupWidgetOptions {
|
|
66
|
-
/** Quote signature from getQuote(). */
|
|
67
|
-
quote: string;
|
|
68
|
-
/** Callback for widget lifecycle events. */
|
|
69
|
-
onEvent?: (event: WidgetEvent) => void;
|
|
70
|
+
interface SetupAddCardOptions {
|
|
71
|
+
/** Callback for add-card frame lifecycle events. */
|
|
72
|
+
onEvent?: (event: AddCardSdk.Event) => void;
|
|
70
73
|
}
|
|
71
|
-
interface
|
|
74
|
+
interface AddCardFrame {
|
|
72
75
|
dispose(): void;
|
|
73
76
|
}
|
|
77
|
+
|
|
74
78
|
interface SetupApplePayOptions {
|
|
75
79
|
/** Quote signature from getQuote(). */
|
|
76
80
|
quote: string;
|
|
77
81
|
/** Callback for Apple Pay lifecycle events. */
|
|
78
|
-
onEvent?: (event:
|
|
82
|
+
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
79
83
|
}
|
|
80
84
|
interface ApplePayFrame {
|
|
81
85
|
/** Update the quote (e.g., after expiry). */
|
|
82
86
|
setQuote(signature: string): void;
|
|
83
87
|
dispose(): void;
|
|
84
88
|
}
|
|
89
|
+
|
|
90
|
+
interface SetupAuthOptions {
|
|
91
|
+
/** Callback for auth frame lifecycle events. */
|
|
92
|
+
onEvent?: (event: AuthSdk.Event) => void;
|
|
93
|
+
}
|
|
94
|
+
interface AuthFrame {
|
|
95
|
+
dispose(): void;
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
interface SetupBuyOptions {
|
|
86
99
|
/** Quote signature from getQuote(). */
|
|
87
100
|
quote: string;
|
|
88
101
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
89
102
|
externalTransactionId?: string;
|
|
90
103
|
/** Callback for buy frame lifecycle events. */
|
|
91
|
-
onEvent?: (event:
|
|
104
|
+
onEvent?: (event: BuySdk.Event) => void;
|
|
92
105
|
}
|
|
93
106
|
interface BuyFrame {
|
|
94
107
|
/** Update the quote (e.g., after expiry). */
|
|
95
108
|
setQuote(signature: string): void;
|
|
96
109
|
dispose(): void;
|
|
97
110
|
}
|
|
111
|
+
|
|
98
112
|
interface SetupBuyButtonOptions {
|
|
99
113
|
/** Quote signature from getQuote(). */
|
|
100
114
|
quote: string;
|
|
101
115
|
/** Callback for buy-button frame lifecycle events. */
|
|
102
|
-
onEvent?: (event:
|
|
116
|
+
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
103
117
|
}
|
|
104
118
|
interface BuyButtonFrame {
|
|
105
119
|
/** Update the quote (e.g., after expiry). */
|
|
106
120
|
setQuote(signature: string): void;
|
|
107
121
|
dispose(): void;
|
|
108
122
|
}
|
|
123
|
+
|
|
124
|
+
interface SetupChallengeOptions {
|
|
125
|
+
/** Full challenge URL received from a frame's `challenge` event. */
|
|
126
|
+
url: string;
|
|
127
|
+
/** Callback for challenge frame lifecycle events. */
|
|
128
|
+
onEvent?: (event: ChallengeSdk.Event) => void;
|
|
129
|
+
}
|
|
130
|
+
interface ChallengeFrame {
|
|
131
|
+
dispose(): void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface ConnectOptions {
|
|
135
|
+
/** Theme options for the connect frame. */
|
|
136
|
+
theme?: {
|
|
137
|
+
appearance?: 'light' | 'dark';
|
|
138
|
+
};
|
|
139
|
+
/** Callback for connect lifecycle events. */
|
|
140
|
+
onEvent?: (event: ConnectSdk.Event) => void;
|
|
141
|
+
}
|
|
142
|
+
interface ConnectFrame {
|
|
143
|
+
dispose(): void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface GetConnectionOptions {
|
|
147
|
+
/**
|
|
148
|
+
* Pass `true` for headless / Identity-API integrations so the check
|
|
149
|
+
* frame opts out of KYC-based statuses. Legal (`termsAcceptanceRequired`)
|
|
150
|
+
* is always surfaced regardless. Defaults to `false`.
|
|
151
|
+
*/
|
|
152
|
+
skipKyc?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
109
155
|
interface SetupGooglePayOptions {
|
|
110
156
|
/** Quote signature from getQuote(). */
|
|
111
157
|
quote: string;
|
|
112
158
|
/** Partner-assigned identifier for this transaction attempt. */
|
|
113
159
|
externalTransactionId?: string;
|
|
114
160
|
/** Callback for Google Pay lifecycle events. */
|
|
115
|
-
onEvent?: (event:
|
|
161
|
+
onEvent?: (event: GooglePaySdk.Event) => void;
|
|
116
162
|
}
|
|
117
163
|
interface GooglePayFrame {
|
|
118
164
|
/** Update the quote (e.g., after expiry). */
|
|
119
165
|
setQuote(signature: string): void;
|
|
120
166
|
dispose(): void;
|
|
121
167
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
interface ChallengeFrame {
|
|
129
|
-
dispose(): void;
|
|
130
|
-
}
|
|
131
|
-
interface SetupAddCardOptions {
|
|
132
|
-
/** Callback for add-card frame lifecycle events. */
|
|
133
|
-
onEvent?: (event: AddCardEvent) => void;
|
|
134
|
-
}
|
|
135
|
-
interface AddCardFrame {
|
|
136
|
-
dispose(): void;
|
|
137
|
-
}
|
|
138
|
-
interface SetupAuthOptions {
|
|
139
|
-
/** Callback for auth frame lifecycle events. */
|
|
140
|
-
onEvent?: (event: AuthEvent) => void;
|
|
168
|
+
|
|
169
|
+
interface SetupWidgetOptions {
|
|
170
|
+
/** Quote signature from getQuote(). */
|
|
171
|
+
quote: string;
|
|
172
|
+
/** Callback for widget lifecycle events. */
|
|
173
|
+
onEvent?: (event: WidgetSdk.Event) => void;
|
|
141
174
|
}
|
|
142
|
-
interface
|
|
175
|
+
interface WidgetFrame {
|
|
143
176
|
dispose(): void;
|
|
144
177
|
}
|
|
178
|
+
|
|
145
179
|
interface RNClient {
|
|
146
|
-
getConnection(options?: GetConnectionOptions): Promise<Result<Connection, GetConnectionError>>;
|
|
147
|
-
connect(options: ConnectOptions): Promise<Result<ConnectFrame, ConnectError>>;
|
|
180
|
+
getConnection(options?: GetConnectionOptions): Promise<Result<Connection, ConnectSdk.GetConnectionError>>;
|
|
181
|
+
connect(options: ConnectOptions): Promise<Result<ConnectFrame, ConnectSdk.ConnectError>>;
|
|
148
182
|
/**
|
|
149
183
|
* Launch the auth frame — the lighter-weight counterpart to `connect()`
|
|
150
184
|
* for headless / Identity-API partners. Requires a `clientToken` to be
|
|
@@ -153,8 +187,10 @@ interface RNClient {
|
|
|
153
187
|
* Call `getConnection()` first; if its status is `connectionRequired`,
|
|
154
188
|
* call `setupAuth()` to drive the customer through email/OTP.
|
|
155
189
|
*/
|
|
156
|
-
setupAuth(options: SetupAuthOptions): Promise<Result<AuthFrame,
|
|
157
|
-
getPaymentMethods(): Promise<Result<
|
|
190
|
+
setupAuth(options: SetupAuthOptions): Promise<Result<AuthFrame, AuthSdk.SetupError>>;
|
|
191
|
+
getPaymentMethods(): Promise<Result<{
|
|
192
|
+
data: ListPaymentMethodsResponse;
|
|
193
|
+
}, GetPaymentMethodsError>>;
|
|
158
194
|
getQuote(params: GetQuoteParams): Promise<Result<{
|
|
159
195
|
data: Quote;
|
|
160
196
|
}, GetQuoteError>>;
|
|
@@ -165,11 +201,14 @@ interface RNClient {
|
|
|
165
201
|
getTransaction(id: string): Promise<Result<{
|
|
166
202
|
data: TransactionWithStages;
|
|
167
203
|
}, GetTransactionsError>>;
|
|
168
|
-
setupWidget(options: SetupWidgetOptions): Promise<Result<WidgetFrame,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
204
|
+
setupWidget(options: SetupWidgetOptions): Promise<Result<WidgetFrame, WidgetSdk.SetupError>>;
|
|
205
|
+
/** @deprecated Render <MoonPayApplePayButton> instead — it mounts inline where you place it. */
|
|
206
|
+
setupApplePay(options: SetupApplePayOptions): Promise<Result<ApplePayFrame, ApplePaySdk.SetupError>>;
|
|
207
|
+
setupBuy(options: SetupBuyOptions): Promise<Result<BuyFrame, BuySdk.SetupError>>;
|
|
208
|
+
/** @deprecated Render <MoonPayBuyButton> instead — it mounts inline where you place it. */
|
|
209
|
+
setupBuyButton(options: SetupBuyButtonOptions): Promise<Result<BuyButtonFrame, BuyButtonSdk.SetupError>>;
|
|
210
|
+
/** @deprecated Render <MoonPayGooglePayButton> instead — it mounts inline where you place it. */
|
|
211
|
+
setupGooglePay(options: SetupGooglePayOptions): Promise<Result<GooglePayFrame, GooglePaySdk.SetupError>>;
|
|
173
212
|
deletePaymentMethod(id: string): Promise<Result<void, DevPlatformApiError>>;
|
|
174
213
|
/**
|
|
175
214
|
* Clears the customer's MoonPay connection for this partner by running the
|
|
@@ -178,8 +217,8 @@ interface RNClient {
|
|
|
178
217
|
* can be captured before disposal since the session token is baked in).
|
|
179
218
|
*/
|
|
180
219
|
resetConnection(): Promise<Result<void, ResetConnectionError>>;
|
|
181
|
-
setupChallenge(options: SetupChallengeOptions): Promise<Result<ChallengeFrame,
|
|
182
|
-
setupAddCard(options: SetupAddCardOptions): Promise<Result<AddCardFrame,
|
|
220
|
+
setupChallenge(options: SetupChallengeOptions): Promise<Result<ChallengeFrame, ChallengeSdk.SetupError>>;
|
|
221
|
+
setupAddCard(options: SetupAddCardOptions): Promise<Result<AddCardFrame, AddCardSdk.SetupError>>;
|
|
183
222
|
createIdentity(body: CreateIdentityRequestBody): Promise<Result<{
|
|
184
223
|
data: Identity | null;
|
|
185
224
|
}, CreateIdentityError>>;
|
|
@@ -199,9 +238,162 @@ interface RNClient {
|
|
|
199
238
|
data: Identity;
|
|
200
239
|
}, SubmitIdentityFilesError>>;
|
|
201
240
|
}
|
|
202
|
-
|
|
203
|
-
|
|
241
|
+
|
|
242
|
+
interface MoonPayAddCardProps {
|
|
243
|
+
/** Callback for add-card lifecycle events. */
|
|
244
|
+
onEvent?: (event: AddCardSdk.Event) => void;
|
|
245
|
+
/** Container style. Defaults to flex: 1. */
|
|
246
|
+
style?: ViewStyle;
|
|
204
247
|
}
|
|
248
|
+
/** Inline add-card frame — embed card entry in your own layout/animation. */
|
|
249
|
+
declare function MoonPayAddCard({ onEvent, style }: MoonPayAddCardProps): JSX.Element;
|
|
250
|
+
|
|
251
|
+
interface MoonPayApplePayButtonProps {
|
|
252
|
+
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
253
|
+
quote: string;
|
|
254
|
+
/** Callback for Apple Pay lifecycle events. */
|
|
255
|
+
onEvent?: (event: ApplePaySdk.Event) => void;
|
|
256
|
+
/** Container style. Defaults to height 48. */
|
|
257
|
+
style?: ViewStyle;
|
|
258
|
+
}
|
|
259
|
+
/** Inline Apple Pay button. Render it wherever it should appear in your layout. */
|
|
260
|
+
declare function MoonPayApplePayButton({ quote, onEvent, style, }: MoonPayApplePayButtonProps): JSX.Element;
|
|
261
|
+
|
|
262
|
+
interface MoonPayAuthProps {
|
|
263
|
+
/** Callback for auth lifecycle events. */
|
|
264
|
+
onEvent?: (event: AuthSdk.Event) => void;
|
|
265
|
+
/** Container style. Defaults to flex: 1. */
|
|
266
|
+
style?: ViewStyle;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Inline auth frame for headless / Identity-API integrations. Requires a clientToken in context —
|
|
270
|
+
* call getConnection() (or render <MoonPayConnectionCheck>) first; if it resolves with
|
|
271
|
+
* `connectionRequired`, mount this component. Emits an error event otherwise.
|
|
272
|
+
*/
|
|
273
|
+
declare function MoonPayAuth({ onEvent, style }: MoonPayAuthProps): JSX.Element;
|
|
274
|
+
|
|
275
|
+
interface MoonPayBuyButtonProps {
|
|
276
|
+
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
277
|
+
quote: string;
|
|
278
|
+
/** Callback for buy button lifecycle events. */
|
|
279
|
+
onEvent?: (event: BuyButtonSdk.Event) => void;
|
|
280
|
+
/** Container style. Defaults to height 48. */
|
|
281
|
+
style?: ViewStyle;
|
|
282
|
+
}
|
|
283
|
+
/** Inline card/buy button. Render it wherever it should appear in your layout. */
|
|
284
|
+
declare function MoonPayBuyButton({ quote, onEvent, style }: MoonPayBuyButtonProps): JSX.Element;
|
|
285
|
+
|
|
286
|
+
interface MoonPayBuyFrameProps {
|
|
287
|
+
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
288
|
+
quote: string;
|
|
289
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
290
|
+
externalTransactionId?: string;
|
|
291
|
+
/** Callback for buy frame lifecycle events. */
|
|
292
|
+
onEvent?: (event: BuySdk.Event) => void;
|
|
293
|
+
}
|
|
294
|
+
/** Headless buy frame (renders nothing visible). The declarative alternative to client.setupBuy(). */
|
|
295
|
+
declare function MoonPayBuyFrame({ quote, externalTransactionId, onEvent, }: MoonPayBuyFrameProps): JSX.Element;
|
|
296
|
+
|
|
297
|
+
interface MoonPayChallengeProps {
|
|
298
|
+
/** Full challenge URL received from a frame's `challenge` event. Mount-time only. */
|
|
299
|
+
url: string;
|
|
300
|
+
/** Callback for challenge lifecycle events. */
|
|
301
|
+
onEvent?: (event: ChallengeSdk.Event) => void;
|
|
302
|
+
/** Container style. Defaults to flex: 1. */
|
|
303
|
+
style?: ViewStyle;
|
|
304
|
+
}
|
|
305
|
+
/** Inline 3DS/challenge frame. Mount it when a payment frame emits a `challenge` event. */
|
|
306
|
+
declare function MoonPayChallenge({ url, onEvent, style }: MoonPayChallengeProps): JSX.Element;
|
|
307
|
+
|
|
308
|
+
interface MoonPayConnectProps {
|
|
309
|
+
/** Theme options for the connect frame. Mount-time only. */
|
|
310
|
+
theme?: {
|
|
311
|
+
appearance?: 'light' | 'dark';
|
|
312
|
+
};
|
|
313
|
+
/** Callback for connect lifecycle events. */
|
|
314
|
+
onEvent?: (event: ConnectSdk.Event) => void;
|
|
315
|
+
/** Container style. Defaults to flex: 1. */
|
|
316
|
+
style?: ViewStyle;
|
|
317
|
+
}
|
|
318
|
+
/** Inline connect frame. On an active completion, credentials are applied to the shared client automatically. */
|
|
319
|
+
declare function MoonPayConnect({ theme, onEvent, style }: MoonPayConnectProps): JSX.Element;
|
|
320
|
+
|
|
321
|
+
type ConnectionCheckEvent = {
|
|
322
|
+
kind: 'complete';
|
|
323
|
+
payload: Connection;
|
|
324
|
+
} | {
|
|
325
|
+
kind: 'error';
|
|
326
|
+
payload: {
|
|
327
|
+
message: string;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
type ConnectionResetEvent = {
|
|
331
|
+
kind: 'complete';
|
|
332
|
+
} | {
|
|
333
|
+
kind: 'error';
|
|
334
|
+
payload: {
|
|
335
|
+
message: string;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
interface MoonPayConnectionCheckProps {
|
|
340
|
+
/** Pass `true` for headless / Identity-API integrations. Mount-time only. */
|
|
341
|
+
skipKyc?: boolean;
|
|
342
|
+
/** Emits `complete` with the Connection, or `error`. */
|
|
343
|
+
onEvent?: (event: ConnectionCheckEvent) => void;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Headless connection check (renders nothing visible). The declarative
|
|
347
|
+
* alternative to client.getConnection() — on an active connection,
|
|
348
|
+
* credentials are applied to the shared client automatically.
|
|
349
|
+
*/
|
|
350
|
+
declare function MoonPayConnectionCheck({ skipKyc, onEvent, }: MoonPayConnectionCheckProps): JSX.Element;
|
|
351
|
+
|
|
352
|
+
interface MoonPayConnectionResetProps {
|
|
353
|
+
/** Callback for connection reset lifecycle events. */
|
|
354
|
+
onEvent?: (event: ConnectionResetEvent) => void;
|
|
355
|
+
}
|
|
356
|
+
/** Headless reset frame (renders nothing visible). The declarative alternative to client.resetConnection(). */
|
|
357
|
+
declare function MoonPayConnectionReset({ onEvent }: MoonPayConnectionResetProps): JSX.Element;
|
|
358
|
+
|
|
359
|
+
interface MoonPayGooglePayButtonProps {
|
|
360
|
+
/** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
|
|
361
|
+
quote: string;
|
|
362
|
+
/** Partner-assigned identifier for this transaction attempt. Mount-time only. */
|
|
363
|
+
externalTransactionId?: string;
|
|
364
|
+
/** Callback for Google Pay lifecycle events. */
|
|
365
|
+
onEvent?: (event: GooglePaySdk.Event) => void;
|
|
366
|
+
/** Container style. Defaults to height 48. */
|
|
367
|
+
style?: ViewStyle;
|
|
368
|
+
}
|
|
369
|
+
/** Inline Google Pay button. Render it wherever it should appear in your layout. */
|
|
370
|
+
declare function MoonPayGooglePayButton({ quote, externalTransactionId, onEvent, style, }: MoonPayGooglePayButtonProps): JSX.Element;
|
|
371
|
+
|
|
372
|
+
interface MoonPayWidgetProps {
|
|
373
|
+
/** Quote signature from getQuote(). Mount-time only — changing it reloads the widget. */
|
|
374
|
+
quote: string;
|
|
375
|
+
/** Callback for widget lifecycle events. */
|
|
376
|
+
onEvent?: (event: WidgetSdk.Event) => void;
|
|
377
|
+
/** Container style. Defaults to flex: 1. */
|
|
378
|
+
style?: ViewStyle;
|
|
379
|
+
}
|
|
380
|
+
/** Inline widget frame. Render it wherever it should appear in your layout. */
|
|
381
|
+
declare function MoonPayWidget({ quote, onEvent, style }: MoonPayWidgetProps): JSX.Element;
|
|
382
|
+
|
|
383
|
+
interface MoonPayFrameProps {
|
|
384
|
+
/** The transport instance managing this frame's communication. */
|
|
385
|
+
transport: RNFrameTransport;
|
|
386
|
+
/** Whether this is a hidden utility frame (zero height). */
|
|
387
|
+
hidden?: boolean;
|
|
388
|
+
/** Optional style overrides for the container view. */
|
|
389
|
+
style?: ViewStyle;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Reusable React Native component that renders a MoonPay frame as a WebView.
|
|
393
|
+
* Bridges the WebViewTransport to the actual WebView instance.
|
|
394
|
+
*/
|
|
395
|
+
declare function MoonPayFrame({ transport, hidden, style }: MoonPayFrameProps): JSX.Element | null;
|
|
396
|
+
|
|
205
397
|
interface MoonPayProviderProps {
|
|
206
398
|
sessionToken: string;
|
|
207
399
|
apiBaseUrl?: string;
|
|
@@ -209,6 +401,8 @@ interface MoonPayProviderProps {
|
|
|
209
401
|
children: ReactNode;
|
|
210
402
|
}
|
|
211
403
|
declare function MoonPayProvider({ sessionToken, apiBaseUrl, frameBaseUrl, children, }: MoonPayProviderProps): JSX.Element;
|
|
212
|
-
declare function useMoonPay():
|
|
404
|
+
declare function useMoonPay(): {
|
|
405
|
+
client: RNClient;
|
|
406
|
+
};
|
|
213
407
|
|
|
214
|
-
export { type AddCardFrame, type ApplePayFrame, type AuthFrame, type BuyButtonFrame, type BuyFrame, type ChallengeFrame, type ConnectFrame, type ConnectOptions, type GetConnectionOptions, type GooglePayFrame, MoonPayFrame, type MoonPayFrameProps, MoonPayProvider, type MoonPayProviderProps, type RNClient, type SetupAddCardOptions, type SetupApplePayOptions, type SetupAuthOptions, type SetupBuyButtonOptions, type SetupBuyOptions, type SetupChallengeOptions, type SetupGooglePayOptions, type SetupWidgetOptions, WebViewTransport, type WidgetFrame, useMoonPay };
|
|
408
|
+
export { type AddCardFrame, type ApplePayFrame, type AuthFrame, type BuyButtonFrame, type BuyFrame, type ChallengeFrame, type ConnectFrame, type ConnectOptions, type ConnectionCheckEvent, type ConnectionResetEvent, type GetConnectionOptions, type GooglePayFrame, MoonPayAddCard, type MoonPayAddCardProps, MoonPayApplePayButton, type MoonPayApplePayButtonProps, MoonPayAuth, type MoonPayAuthProps, MoonPayBuyButton, type MoonPayBuyButtonProps, MoonPayBuyFrame, type MoonPayBuyFrameProps, MoonPayChallenge, type MoonPayChallengeProps, MoonPayConnect, type MoonPayConnectProps, MoonPayConnectionCheck, type MoonPayConnectionCheckProps, MoonPayConnectionReset, type MoonPayConnectionResetProps, MoonPayFrame, type MoonPayFrameProps, MoonPayGooglePayButton, type MoonPayGooglePayButtonProps, MoonPayProvider, type MoonPayProviderProps, MoonPayWidget, type MoonPayWidgetProps, type RNClient, type SetupAddCardOptions, type SetupApplePayOptions, type SetupAuthOptions, type SetupBuyButtonOptions, type SetupBuyOptions, type SetupChallengeOptions, type SetupGooglePayOptions, type SetupWidgetOptions, WebViewTransport, type WidgetFrame, useMoonPay };
|