@moonpay/platform-sdk-react-native 1.28.1 → 1.30.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.d.cts CHANGED
@@ -7,6 +7,8 @@ export { CardResponse } from '@moonpay/platform-protocol/frames/add-card';
7
7
  import * as ApplePayFrame$1 from '@moonpay/platform-protocol/frames/apple-pay';
8
8
  export { ApplePayButtonSettings } from '@moonpay/platform-protocol/frames/apple-pay';
9
9
  export { Cancellation as ChallengeCancellation, CompleteResult as ChallengeCompleteResult, ErrorCode as ChallengeErrorCode, ResolvedResult as ChallengeResolvedResult } from '@moonpay/platform-protocol/frames/challenge';
10
+ import * as GooglePayFrame$1 from '@moonpay/platform-protocol/frames/google-pay';
11
+ export { GooglePayButtonSettings } from '@moonpay/platform-protocol/frames/google-pay';
10
12
  import { Connection } from '@moonpay/platform-protocol/models/connection';
11
13
  export { Connection, ConnectionStatus } from '@moonpay/platform-protocol/models/connection';
12
14
  import { Result } from '@moonpay/platform-protocol/result';
@@ -32,7 +34,7 @@ export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moo
32
34
  import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
33
35
  export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
34
36
  import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
35
- 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';
36
38
  import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, SimulateBankTransferError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
37
39
  import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
38
40
  import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';
@@ -138,6 +140,11 @@ interface SetupBuyButtonOptions {
138
140
  externalTransactionId?: string;
139
141
  /** Styling for the Apple Pay button variant. Passed through to the frame, which is authoritative. */
140
142
  applePayButtonSettings?: ApplePayFrame$1.ApplePayButtonSettings;
143
+ /**
144
+ * Styling for the Google Pay button variant. Passed through to the frame, which is
145
+ * authoritative. Ignored when `headless` is set, since no button renders.
146
+ */
147
+ googlePayButtonSettings?: GooglePayFrame$1.GooglePayButtonSettings;
141
148
  /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
142
149
  presentation?: PresentationMode;
143
150
  /**
@@ -176,7 +183,7 @@ interface ChallengeFrame {
176
183
  }
177
184
 
178
185
  interface ConnectOptions {
179
- /** Theme for this connect frame. Overrides the provider-level `theme`. */
186
+ /** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. */
180
187
  theme?: ThemeOptions;
181
188
  /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
182
189
  presentation?: PresentationMode;
@@ -420,6 +427,8 @@ interface MoonPayBuyButtonProps {
420
427
  externalTransactionId?: string;
421
428
  /** Styling for the Apple Pay button variant. Passed through to the frame, which is authoritative. Mount-time only. */
422
429
  applePayButtonSettings?: ApplePayFrame$1.ApplePayButtonSettings;
430
+ /** Styling for the Google Pay button variant. Passed through to the frame, which is authoritative. Ignored when `headless` is set. Mount-time only. */
431
+ googlePayButtonSettings?: GooglePayFrame$1.GooglePayButtonSettings;
423
432
  /**
424
433
  * Render nothing visible and process the quote on load, the way the
425
434
  * deprecated `<MoonPayBuyFrame>` did. Mount-time only.
@@ -433,7 +442,7 @@ interface MoonPayBuyButtonProps {
433
442
  webViewProps?: Partial<WebViewProps>;
434
443
  }
435
444
  /** Inline card/buy button. Render it wherever it should appear in your layout. */
436
- declare function MoonPayBuyButton({ quote, externalTransactionId, applePayButtonSettings, headless, onEvent, style, webViewProps, }: MoonPayBuyButtonProps): JSX.Element;
445
+ declare function MoonPayBuyButton({ quote, externalTransactionId, applePayButtonSettings, googlePayButtonSettings, headless, onEvent, style, webViewProps, }: MoonPayBuyButtonProps): JSX.Element;
437
446
 
438
447
  interface MoonPayBuyFrameProps {
439
448
  /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
@@ -474,7 +483,7 @@ interface MoonPayChallengeProps {
474
483
  declare function MoonPayChallenge({ url, resume, onEvent, style, webViewProps, }: MoonPayChallengeProps): JSX.Element;
475
484
 
476
485
  interface MoonPayConnectProps {
477
- /** Theme for this connect frame. Overrides the provider-level `theme`. Mount-time only. */
486
+ /** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. Mount-time only. */
478
487
  theme?: ThemeOptions;
479
488
  /** Callback for connect lifecycle events. */
480
489
  onEvent?: (event: ConnectSdk.Event) => void;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export { CardResponse } from '@moonpay/platform-protocol/frames/add-card';
7
7
  import * as ApplePayFrame$1 from '@moonpay/platform-protocol/frames/apple-pay';
8
8
  export { ApplePayButtonSettings } from '@moonpay/platform-protocol/frames/apple-pay';
9
9
  export { Cancellation as ChallengeCancellation, CompleteResult as ChallengeCompleteResult, ErrorCode as ChallengeErrorCode, ResolvedResult as ChallengeResolvedResult } from '@moonpay/platform-protocol/frames/challenge';
10
+ import * as GooglePayFrame$1 from '@moonpay/platform-protocol/frames/google-pay';
11
+ export { GooglePayButtonSettings } from '@moonpay/platform-protocol/frames/google-pay';
10
12
  import { Connection } from '@moonpay/platform-protocol/models/connection';
11
13
  export { Connection, ConnectionStatus } from '@moonpay/platform-protocol/models/connection';
12
14
  import { Result } from '@moonpay/platform-protocol/result';
@@ -32,7 +34,7 @@ export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moo
32
34
  import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';
33
35
  export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
34
36
  import { FrameTransport, FrameOptions, PresentationMode, ThemeOptions, Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';
35
- 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';
36
38
  import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, SimulateBankTransferError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors';
37
39
  import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
38
40
  import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';
@@ -138,6 +140,11 @@ interface SetupBuyButtonOptions {
138
140
  externalTransactionId?: string;
139
141
  /** Styling for the Apple Pay button variant. Passed through to the frame, which is authoritative. */
140
142
  applePayButtonSettings?: ApplePayFrame$1.ApplePayButtonSettings;
143
+ /**
144
+ * Styling for the Google Pay button variant. Passed through to the frame, which is
145
+ * authoritative. Ignored when `headless` is set, since no button renders.
146
+ */
147
+ googlePayButtonSettings?: GooglePayFrame$1.GooglePayButtonSettings;
141
148
  /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
142
149
  presentation?: PresentationMode;
143
150
  /**
@@ -176,7 +183,7 @@ interface ChallengeFrame {
176
183
  }
177
184
 
178
185
  interface ConnectOptions {
179
- /** Theme for this connect frame. Overrides the provider-level `theme`. */
186
+ /** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. */
180
187
  theme?: ThemeOptions;
181
188
  /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */
182
189
  presentation?: PresentationMode;
@@ -420,6 +427,8 @@ interface MoonPayBuyButtonProps {
420
427
  externalTransactionId?: string;
421
428
  /** Styling for the Apple Pay button variant. Passed through to the frame, which is authoritative. Mount-time only. */
422
429
  applePayButtonSettings?: ApplePayFrame$1.ApplePayButtonSettings;
430
+ /** Styling for the Google Pay button variant. Passed through to the frame, which is authoritative. Ignored when `headless` is set. Mount-time only. */
431
+ googlePayButtonSettings?: GooglePayFrame$1.GooglePayButtonSettings;
423
432
  /**
424
433
  * Render nothing visible and process the quote on load, the way the
425
434
  * deprecated `<MoonPayBuyFrame>` did. Mount-time only.
@@ -433,7 +442,7 @@ interface MoonPayBuyButtonProps {
433
442
  webViewProps?: Partial<WebViewProps>;
434
443
  }
435
444
  /** Inline card/buy button. Render it wherever it should appear in your layout. */
436
- declare function MoonPayBuyButton({ quote, externalTransactionId, applePayButtonSettings, headless, onEvent, style, webViewProps, }: MoonPayBuyButtonProps): JSX.Element;
445
+ declare function MoonPayBuyButton({ quote, externalTransactionId, applePayButtonSettings, googlePayButtonSettings, headless, onEvent, style, webViewProps, }: MoonPayBuyButtonProps): JSX.Element;
437
446
 
438
447
  interface MoonPayBuyFrameProps {
439
448
  /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */
@@ -474,7 +483,7 @@ interface MoonPayChallengeProps {
474
483
  declare function MoonPayChallenge({ url, resume, onEvent, style, webViewProps, }: MoonPayChallengeProps): JSX.Element;
475
484
 
476
485
  interface MoonPayConnectProps {
477
- /** Theme for this connect frame. Overrides the provider-level `theme`. Mount-time only. */
486
+ /** Theme for this connect frame. Each option set here overrides the same option on the provider-level `theme`. Mount-time only. */
478
487
  theme?: ThemeOptions;
479
488
  /** Callback for connect lifecycle events. */
480
489
  onEvent?: (event: ConnectSdk.Event) => void;
package/dist/index.js CHANGED
@@ -134,6 +134,9 @@ var buyButtonSpec = {
134
134
  signature: props.quote,
135
135
  ...props.externalTransactionId && { externalTransactionId: props.externalTransactionId },
136
136
  ...props.applePayButtonSettings && { applePayButtonSettings: props.applePayButtonSettings },
137
+ ...props.googlePayButtonSettings && {
138
+ googlePayButtonSettings: props.googlePayButtonSettings
139
+ },
137
140
  ...presentationParams(props.presentation)
138
141
  }),
139
142
  createCommands: createQuoteCommands,
@@ -829,6 +832,7 @@ async function setupBuyButton(deps, opts) {
829
832
  quote: opts.quote,
830
833
  externalTransactionId: opts.externalTransactionId,
831
834
  applePayButtonSettings: opts.applePayButtonSettings,
835
+ googlePayButtonSettings: opts.googlePayButtonSettings,
832
836
  presentation: opts.presentation
833
837
  }
834
838
  );
@@ -1339,6 +1343,9 @@ function FrameSlots({
1339
1343
  ))
1340
1344
  ] });
1341
1345
  }
1346
+ function themeDependencyKey(theme) {
1347
+ return theme ? JSON.stringify(theme) : void 0;
1348
+ }
1342
1349
  function MoonPayProvider({
1343
1350
  sessionToken: sessionTokenProp,
1344
1351
  apiBaseUrl,
@@ -1358,9 +1365,10 @@ function MoonPayProvider({
1358
1365
  },
1359
1366
  [core]
1360
1367
  );
1368
+ const themeKey = themeDependencyKey(theme);
1361
1369
  const specCtx = useMemo2(
1362
1370
  () => ({ sessionToken, core, frameBaseUrl, theme }),
1363
- [sessionToken, core, frameBaseUrl, theme?.appearance]
1371
+ [sessionToken, core, frameBaseUrl, themeKey]
1364
1372
  );
1365
1373
  const client = useMemo2(
1366
1374
  () => createRNClient({
@@ -1384,9 +1392,10 @@ function MoonPayEnterpriseProvider({
1384
1392
  const { frameSlots, addSlot, removeSlot } = useFrameSlots();
1385
1393
  const core = useCore(void 0, frameBaseUrl);
1386
1394
  core.context.setClientToken(clientToken);
1395
+ const themeKey = themeDependencyKey(theme);
1387
1396
  const specCtx = useMemo2(
1388
1397
  () => ({ core, frameBaseUrl, theme, enterpriseClientToken: clientToken }),
1389
- [clientToken, core, frameBaseUrl, theme?.appearance]
1398
+ [clientToken, core, frameBaseUrl, themeKey]
1390
1399
  );
1391
1400
  const value = useMemo2(
1392
1401
  () => ({
@@ -1578,6 +1587,7 @@ function MoonPayBuyButton({
1578
1587
  quote,
1579
1588
  externalTransactionId,
1580
1589
  applePayButtonSettings,
1590
+ googlePayButtonSettings,
1581
1591
  headless,
1582
1592
  onEvent,
1583
1593
  style,
@@ -1587,7 +1597,7 @@ function MoonPayBuyButton({
1587
1597
  MoonPayFrameView,
1588
1598
  {
1589
1599
  spec: headless ? headlessBuyButtonSpec : buyButtonSpec,
1590
- props: { quote, externalTransactionId, applePayButtonSettings },
1600
+ props: { quote, externalTransactionId, applePayButtonSettings, googlePayButtonSettings },
1591
1601
  style,
1592
1602
  defaultStyle: { height: 48 },
1593
1603
  onEvent,