@moonpay/platform-sdk-react-native 1.29.0 → 1.31.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/README.md +12 -2
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -34,7 +34,7 @@ export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moo
|
|
|
34
34
|
import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
|
|
35
35
|
export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
36
36
|
import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
37
|
-
export { Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
37
|
+
export { Credentials, CustomTheme, GetCredentialsError, GetPaymentMethodsParams, HexColor, ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
38
38
|
import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, SimulateBankTransferError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
|
|
39
39
|
import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
40
40
|
import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';
|
|
@@ -183,7 +183,7 @@ interface ChallengeFrame {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
interface ConnectOptions {
|
|
186
|
-
/** Theme for this connect frame.
|
|
186
|
+
/** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. */
|
|
187
187
|
theme?: ThemeOptions;
|
|
188
188
|
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
189
189
|
presentation?: PresentationMode;
|
|
@@ -483,7 +483,7 @@ interface MoonPayChallengeProps {
|
|
|
483
483
|
declare function MoonPayChallenge({ url, resume, onEvent, style, webViewProps, }: MoonPayChallengeProps): JSX.Element;
|
|
484
484
|
|
|
485
485
|
interface MoonPayConnectProps {
|
|
486
|
-
/** Theme for this connect frame.
|
|
486
|
+
/** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. Mount-time only. */
|
|
487
487
|
theme?: ThemeOptions;
|
|
488
488
|
/** Callback for connect lifecycle events. */
|
|
489
489
|
onEvent?: (event: ConnectSdk.Event) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moo
|
|
|
34
34
|
import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
|
|
35
35
|
export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
36
36
|
import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
|
|
37
|
-
export { Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
37
|
+
export { Credentials, CustomTheme, GetCredentialsError, GetPaymentMethodsParams, HexColor, ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';
|
|
38
38
|
import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, SimulateBankTransferError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
|
|
39
39
|
import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
40
40
|
import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';
|
|
@@ -183,7 +183,7 @@ interface ChallengeFrame {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
interface ConnectOptions {
|
|
186
|
-
/** Theme for this connect frame.
|
|
186
|
+
/** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. */
|
|
187
187
|
theme?: ThemeOptions;
|
|
188
188
|
/** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
|
|
189
189
|
presentation?: PresentationMode;
|
|
@@ -483,7 +483,7 @@ interface MoonPayChallengeProps {
|
|
|
483
483
|
declare function MoonPayChallenge({ url, resume, onEvent, style, webViewProps, }: MoonPayChallengeProps): JSX.Element;
|
|
484
484
|
|
|
485
485
|
interface MoonPayConnectProps {
|
|
486
|
-
/** Theme for this connect frame.
|
|
486
|
+
/** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. Mount-time only. */
|
|
487
487
|
theme?: ThemeOptions;
|
|
488
488
|
/** Callback for connect lifecycle events. */
|
|
489
489
|
onEvent?: (event: ConnectSdk.Event) => void;
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
applyResumeParam,
|
|
13
13
|
decryptCredentials,
|
|
14
14
|
FRAME_PATHS,
|
|
15
|
+
isAuthResult,
|
|
15
16
|
presentationParams,
|
|
16
17
|
themeParams
|
|
17
18
|
} from "@moonpay/platform-sdk-core";
|
|
@@ -284,10 +285,7 @@ var authSpec = {
|
|
|
284
285
|
return { kind: "error", payload: msg.payload };
|
|
285
286
|
case "complete": {
|
|
286
287
|
const connection = msg.payload;
|
|
287
|
-
|
|
288
|
-
return { kind: "complete", payload: msg.payload };
|
|
289
|
-
}
|
|
290
|
-
return null;
|
|
288
|
+
return isAuthResult(connection) ? { kind: "complete", payload: connection } : null;
|
|
291
289
|
}
|
|
292
290
|
default:
|
|
293
291
|
return null;
|
|
@@ -1343,6 +1341,9 @@ function FrameSlots({
|
|
|
1343
1341
|
))
|
|
1344
1342
|
] });
|
|
1345
1343
|
}
|
|
1344
|
+
function themeDependencyKey(theme) {
|
|
1345
|
+
return theme ? JSON.stringify(theme) : void 0;
|
|
1346
|
+
}
|
|
1346
1347
|
function MoonPayProvider({
|
|
1347
1348
|
sessionToken: sessionTokenProp,
|
|
1348
1349
|
apiBaseUrl,
|
|
@@ -1362,9 +1363,10 @@ function MoonPayProvider({
|
|
|
1362
1363
|
},
|
|
1363
1364
|
[core]
|
|
1364
1365
|
);
|
|
1366
|
+
const themeKey = themeDependencyKey(theme);
|
|
1365
1367
|
const specCtx = useMemo2(
|
|
1366
1368
|
() => ({ sessionToken, core, frameBaseUrl, theme }),
|
|
1367
|
-
[sessionToken, core, frameBaseUrl,
|
|
1369
|
+
[sessionToken, core, frameBaseUrl, themeKey]
|
|
1368
1370
|
);
|
|
1369
1371
|
const client = useMemo2(
|
|
1370
1372
|
() => createRNClient({
|
|
@@ -1388,9 +1390,10 @@ function MoonPayEnterpriseProvider({
|
|
|
1388
1390
|
const { frameSlots, addSlot, removeSlot } = useFrameSlots();
|
|
1389
1391
|
const core = useCore(void 0, frameBaseUrl);
|
|
1390
1392
|
core.context.setClientToken(clientToken);
|
|
1393
|
+
const themeKey = themeDependencyKey(theme);
|
|
1391
1394
|
const specCtx = useMemo2(
|
|
1392
1395
|
() => ({ core, frameBaseUrl, theme, enterpriseClientToken: clientToken }),
|
|
1393
|
-
[clientToken, core, frameBaseUrl,
|
|
1396
|
+
[clientToken, core, frameBaseUrl, themeKey]
|
|
1394
1397
|
);
|
|
1395
1398
|
const value = useMemo2(
|
|
1396
1399
|
() => ({
|